Package net.dona.doip.util.tls
Class X509CertificateGenerator
java.lang.Object
net.dona.doip.util.tls.X509CertificateGenerator
Utility methods to generate X509 certificates, and to read and write
certificates from and to PEM files.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic X509Certificate
generate
(String handle, int index, PublicKey pubKey, PrivateKey privKey) static X509Certificate
generate
(String handle, PublicKey pubKey, PrivateKey privKey) static X509Certificate
generateWithCnAndUid
(String cn, String uid, PublicKey pubKey, PrivateKey privKey) static X509Certificate
generateWithUid
(String uid, PublicKey pubKey, PrivateKey privKey) static X509Certificate
readCertAsPem
(Reader reader) static X509Certificate[]
readCertChainAsPem
(Reader reader) static void
storeCertAndKey
(KeyStore keyStore, Certificate cert, PrivateKey privKey, String alias, String keyPass) static void
writeCertAsPem
(Writer writer, Certificate cert)
-
Constructor Details
-
X509CertificateGenerator
public X509CertificateGenerator()
-
-
Method Details
-
generate
public static X509Certificate generate(String handle, PublicKey pubKey, PrivateKey privKey) throws Exception - Throws:
Exception
-
generate
public static X509Certificate generate(String handle, int index, PublicKey pubKey, PrivateKey privKey) throws Exception - Throws:
Exception
-
generateWithUid
public static X509Certificate generateWithUid(String uid, PublicKey pubKey, PrivateKey privKey) throws Exception - Throws:
Exception
-
generateWithCnAndUid
public static X509Certificate generateWithCnAndUid(String cn, String uid, PublicKey pubKey, PrivateKey privKey) throws Exception - Throws:
Exception
-
storeCertAndKey
public static void storeCertAndKey(KeyStore keyStore, Certificate cert, PrivateKey privKey, String alias, String keyPass) throws KeyStoreException - Throws:
KeyStoreException
-
writeCertAsPem
- Throws:
IOException
-
readCertAsPem
- Throws:
IOException
-
readCertChainAsPem
- Throws:
IOException
-