Skip to content
Snippets Groups Projects
Commit 90f27eb8 authored by Martin Vogel's avatar Martin Vogel
Browse files

refactor(validation): return empty on insecure public key

parent b797ce46
No related branches found
No related tags found
No related merge requests found
......@@ -457,8 +457,9 @@ public final class SenderClient {
final Destination destination = sender.getDestination(destinationId);
final RSAKey encryptionKey = sender.getEncryptionKeyForDestination(destinationId, destination.getEncryptionKid());
final ValidationResult validationResult = sender.validatePublicKey(encryptionKey);
if (validationResult.hasError()) {
LOGGER.error("Invalid public key: ", validationResult.getError());
if (validationResult.hasError() && !environment.isAllowInsecurePublicKey()) {
LOGGER.error("Invalid public key", validationResult.getError());
return Optional.empty();
}
return Optional.of(encryptionKey.toJSONString());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment