-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asadmin to import plain PKCS#8 RSA keypairs into the java keystore #2599
Conversation
…ing the JAVA api directly (not via keytool). Don't allow empty or short key and/or keystore passwords. Methods to enfore glassfish convention of keys using the same passwords as the keystore.
thanks I will try and review soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good just a javadoc needed
import java.security.cert.CertificateFactory; | ||
import java.security.spec.InvalidKeySpecException; | ||
import java.security.spec.PKCS8EncodedKeySpec; | ||
import java.util.Base64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a JDK8 only class. This is OK for Payara 5 branch but not for Payara 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. So should we make this backportable to Payara 4 too? Which class would you suggest to use for decoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW: com.sun.enterprise.v3.admin.AdminAdapter is using this class too, so I thought it's ok.
return Base64.getDecoder().decode(base64KeyData); | ||
} | ||
|
||
public Collection<? extends Certificate> readPemCertificateChain ( File pemFile ) throws KeyStoreException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc needed
jenkins test please |
Quick build and test passed! |
jenkins test please |
jenkins test please |
Quick build and test passed! |
ASADMIN command to import unencrypted PKCS8 RSA keypairs into JAVA keystores using the api directly (not via keytool). Such keys and certificates are produced by LETSEncrypt.
Don't allow empty or short key and/or keystore passwords.
Added convenience methods to enforce glassfish convention of keys using the same passwords as the keystore.
A couple of considerations:
keyStoreType
, but as of https://bugs.openjdk.java.net/browse/JDK-8062552 it could be omitted and presume "JKS" as it works both for PKCS12 and JKS keystores - there's a relevant test for it.