Class SelfSignedCertificateGenerator

java.lang.Object
org.eclipse.milo.opcua.stack.core.util.SelfSignedCertificateGenerator

public class SelfSignedCertificateGenerator extends Object
  • Constructor Details

    • SelfSignedCertificateGenerator

      public SelfSignedCertificateGenerator()
  • Method Details

    • generateRsaKeyPair

      public static KeyPair generateRsaKeyPair(int length) throws NoSuchAlgorithmException
      Generate an RSA KeyPair of bit length length.
      Parameters:
      length - the length, in bits, of the key to generate.
      Returns:
      a KeyPair of bit length length.
      Throws:
      NoSuchAlgorithmException - if no Provider supports RSA KeyPair generation.
    • generateEcKeyPair

      public static KeyPair generateEcKeyPair(int length) throws NoSuchAlgorithmException
      Generate an EC KeyPair of bit length length.
      Parameters:
      length - the length, in bits, of the key to generate.
      Returns:
      a KeyPair of bit length length.
      Throws:
      NoSuchAlgorithmException - if no Provider supports 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.CertIOException
      NoSuchAlgorithmException
    • 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.CertIOException
      NoSuchAlgorithmException