IdentificationResultWithEncryptionKey result = identifyAndGetEncryptionKey(message.recipient.toIdentification());
if (result.getResultCode() == IdentificationResultCode.DIGIPOST) {
singleChannelMessage = setMapAndMessageToDigipost(message, documentsAndContent, documentsAndInputstream);
if (singleChannelMessage.hasAnyDocumentRequiringEncryption()) {
eventLogger.log("Mottaker er Digipost-bruker. Bruker brukers krypteringsnøkkel.");
<BUG>publicKeys = optional(new DigipostPublicKey(result.getEncryptionKey()));
</BUG>
}
} else if (message.recipient.hasPrintDetails()) {
singleChannelMessage = setMapAndMessageToPrint(message, documentsAndContent, documentsAndInputstream);

IdentificationResultWithEncryptionKey result = identifyAndGetEncryptionKey(message.recipient.toIdentification());
if (result.getResultCode() == IdentificationResultCode.DIGIPOST) {
singleChannelMessage = setMapAndMessageToDigipost(message, documentsAndContent, documentsAndInputstream);
if (singleChannelMessage.hasAnyDocumentRequiringEncryption()) {
eventLogger.log("Mottaker er Digipost-bruker. Bruker brukers krypteringsnøkkel.");
publicKeys = Optional.of(new DigipostPublicKey(result.getEncryptionKey()));
}
} else if (message.recipient.hasPrintDetails()) {
singleChannelMessage = setMapAndMessageToPrint(message, documentsAndContent, documentsAndInputstream);
