Use a MIME Base64 decoder for attachment signing keys.

This commit is contained in:
Jon Chambers 2021-04-26 18:46:44 -04:00 committed by Jon Chambers
parent 4b42dd1db3
commit 59e401f41e
2 changed files with 2 additions and 2 deletions

View File

@ -76,7 +76,7 @@ public class CanonicalRequestSigner {
if (matcher.matches()) {
try {
final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
final PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(matcher.group(1)));
final PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64.getMimeDecoder().decode(matcher.group(1)));
final PrivateKey key = keyFactory.generatePrivate(keySpec);
testKeyIsValidForSigning(key);

View File

@ -64,7 +64,7 @@ public class AttachmentControllerTest {
final KeyPair keyPair = keyPairGenerator.generateKeyPair();
RSA_PRIVATE_KEY_PEM = "-----BEGIN PRIVATE KEY-----\n" +
Base64.getEncoder().encodeToString(keyPair.getPrivate().getEncoded()) + "\n" +
Base64.getMimeEncoder().encodeToString(keyPair.getPrivate().getEncoded()) + "\n" +
"-----END PRIVATE KEY-----";
} catch (NoSuchAlgorithmException e) {
throw new AssertionError(e);