Class SelfSignedCertificateGenerator
java.lang.Object
org.eclipse.milo.opcua.stack.core.util.SelfSignedCertificateGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAuthorityKeyIdentifier(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder, KeyPair keyPair) protected voidaddBasicConstraints(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder, org.bouncycastle.asn1.x509.BasicConstraints basicConstraints) protected voidaddExtendedKeyUsage(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder) protected voidaddKeyUsage(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder) protected voidaddSubjectAlternativeNames(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder, KeyPair keyPair, @Nullable String applicationUri, List<String> dnsNames, List<String> ipAddresses) static KeyPairgenerateEcKeyPair(int length) Generate an ECKeyPairof bit lengthlength.static KeyPairgenerateRsaKeyPair(int length) Generate an RSAKeyPairof bit lengthlength.generateSelfSigned(KeyPair keyPair, Date notBefore, Date notAfter, String commonName, String organization, @Nullable String organizationalUnit, @Nullable String localityName, @Nullable String stateName, @Nullable String countryCode, @Nullable String applicationUri, List<String> dnsNames, List<String> ipAddresses, String signatureAlgorithm)
-
Constructor Details
-
SelfSignedCertificateGenerator
public SelfSignedCertificateGenerator()
-
-
Method Details
-
generateRsaKeyPair
Generate an RSAKeyPairof bit lengthlength.- Parameters:
length- the length, in bits, of the key to generate.- Returns:
- a
KeyPairof bit lengthlength. - Throws:
NoSuchAlgorithmException- if noProvidersupports RSA KeyPair generation.
-
generateEcKeyPair
Generate an ECKeyPairof bit lengthlength.- Parameters:
length- the length, in bits, of the key to generate.- Returns:
- a
KeyPairof bit lengthlength. - Throws:
NoSuchAlgorithmException- if noProvidersupports EC KeyPair generation.
-
generateSelfSigned
public X509Certificate generateSelfSigned(KeyPair keyPair, Date notBefore, Date notAfter, String commonName, String organization, @Nullable String organizationalUnit, @Nullable String localityName, @Nullable String stateName, @Nullable String countryCode, @Nullable String applicationUri, List<String> dnsNames, List<String> ipAddresses, String signatureAlgorithm) throws Exception - Throws:
Exception
-
addSubjectAlternativeNames
protected void addSubjectAlternativeNames(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder, KeyPair keyPair, @Nullable String applicationUri, List<String> dnsNames, List<String> ipAddresses) throws org.bouncycastle.cert.CertIOException, NoSuchAlgorithmException - Throws:
org.bouncycastle.cert.CertIOExceptionNoSuchAlgorithmException
-
addExtendedKeyUsage
protected void addExtendedKeyUsage(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder) throws org.bouncycastle.cert.CertIOException - Throws:
org.bouncycastle.cert.CertIOException
-
addKeyUsage
protected void addKeyUsage(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder) throws org.bouncycastle.cert.CertIOException - Throws:
org.bouncycastle.cert.CertIOException
-
addBasicConstraints
protected void addBasicConstraints(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder, org.bouncycastle.asn1.x509.BasicConstraints basicConstraints) throws org.bouncycastle.cert.CertIOException - Throws:
org.bouncycastle.cert.CertIOException
-
addAuthorityKeyIdentifier
protected void addAuthorityKeyIdentifier(org.bouncycastle.cert.X509v3CertificateBuilder certificateBuilder, KeyPair keyPair) throws org.bouncycastle.cert.CertIOException, NoSuchAlgorithmException - Throws:
org.bouncycastle.cert.CertIOExceptionNoSuchAlgorithmException
-