Treat blank strings as null pre-keys

This commit is contained in:
Jon Chambers
2023-06-09 10:39:16 -04:00
parent 17aa5d8e74
commit 7f1ee015d1
4 changed files with 115 additions and 0 deletions

View File

@@ -42,6 +42,10 @@ public class ECPublicKeyAdapter {
throw new JsonParseException(parser, "Could not parse EC public key as a base64-encoded value", e);
}
if (ecPublicKeyBytes.length == 0) {
return null;
}
try {
return new ECPublicKey(ecPublicKeyBytes);
} catch (final InvalidKeyException e) {

View File

@@ -42,6 +42,10 @@ public class KEMPublicKeyAdapter {
throw new JsonParseException(parser, "Could not parse KEM public key as a base64-encoded value", e);
}
if (kemPublicKeyBytes.length == 0) {
return null;
}
try {
return new KEMPublicKey(kemPublicKeyBytes);
} catch (final InvalidKeyException e) {