Class CertificateParameter


  • public final class CertificateParameter
    extends java.lang.Object
    Container class with enough information to create a certificate.
     
      CertificateParameter cp = new CertificateParameter();
        X500NameBuilder subject = new X500NameBuilder();
    
        subject.addRDN(X509ObjectIdentifiers.countryName, "GB");
        subject.addRDN(X509ObjectIdentifiers.stateOrProvinceName, "Middlesex");
        subject.addRDN(X509ObjectIdentifiers.localityName, "Uxbridge");
        subject.addRDN(X509ObjectIdentifiers.organization, "Adaptris");
        subject.addRDN(X509ObjectIdentifiers.organizationalUnitName, "Development");
        subject.addRDN(X509ObjectIdentifiers.commonName, "My Name");
        subject.addRDN(PKCSObjectIdentifiers.pkcs_9_at_emailAddress, "myname@mycompany.com");
        cp.setSignatureAlgorithm("Md5WithRSAencryption");
        cp.setKeyAlgorithm("RSA", 2048);
        cp.setSubjectInfo(subject.build());
       
      
    See Also:
    CertificateBuilder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getKeyAlgorithm()
      Return the keyAlgorithm.
      int getKeySize()
      Return the key size.
      java.lang.String getSignatureAlgorithm()
      Return the signatureAlgorithm.
      org.bouncycastle.asn1.x500.X500Name getSubjectInfo()
      Return the subject.
      void setKeyAlgorithm​(java.lang.String keyAlg, int bits)
      Set the key algorithm for a certificate.
      void setSignatureAlgorithm​(java.lang.String sigAlg)
      Set the signature algorithm for a certificate.
      void setSubjectInfo​(org.bouncycastle.asn1.x500.X500Name name)
      Set the subject of the certificate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CertificateParameter

        public CertificateParameter()
        Default constructor
    • Method Detail

      • setSignatureAlgorithm

        public void setSignatureAlgorithm​(java.lang.String sigAlg)
                                   throws java.security.NoSuchAlgorithmException
        Set the signature algorithm for a certificate.

        Common certificate signature algorithms are MD5withRSAencryption, SHA1withRSAEncryption, MD4withRSAEncryption

        Parameters:
        sigAlg - the signature algorithm to use
        Throws:
        java.security.NoSuchAlgorithmException - if the algorithm is not available
      • setKeyAlgorithm

        public void setKeyAlgorithm​(java.lang.String keyAlg,
                                    int bits)
                             throws java.security.NoSuchAlgorithmException
        Set the key algorithm for a certificate.

        The most common key algorithm is RSA with a bit size of either 1024/2048 bits

        Parameters:
        keyAlg - the key algorithm to use
        bits - the number of bits for the key algorithm
        Throws:
        java.security.NoSuchAlgorithmException - if the algorithm is not available
      • getSignatureAlgorithm

        public java.lang.String getSignatureAlgorithm()
        Return the signatureAlgorithm.
        Returns:
        the Signature Algorithm in its core form
      • getKeyAlgorithm

        public java.lang.String getKeyAlgorithm()
        Return the keyAlgorithm.
        Returns:
        the key Algorithm in its core form
      • getKeySize

        public int getKeySize()
        Return the key size.
        Returns:
        the key size
      • setSubjectInfo

        public void setSubjectInfo​(org.bouncycastle.asn1.x500.X500Name name)
        Set the subject of the certificate.
        Parameters:
        name - the subject info for a certificate
        See Also:
        X500Name
      • getSubjectInfo

        public org.bouncycastle.asn1.x500.X500Name getSubjectInfo()
        Return the subject.
        Returns:
        the Subject Info