mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(acm): reject mismatched certificate private keys (#5987)
Preserve existing certificates when an import supplies the wrong key.
This commit is contained in:
1 parent
b14537baa7
commit
84dfb77f99
5 files changed
+111
-2
No files matched your search
@@ -402,7 +402,9 @@ public class AcmService implements ResourceProvider {
|
||||
|
||||
// Parse and validate private key
|
||||
try {
|
||||
Pem.parsePrivateKey(privateKeyPem);
|
||||
if (!Pem.isPair(Pem.parsePrivateKey(privateKeyPem), x509Cert.getPublicKey())) {
|
||||
throw new IllegalArgumentException("The private key does not match the certificate");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new AwsException("ValidationException", "Invalid private key: " + e.getMessage(), 400);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user