Class KeyPairGenerator


  • public class KeyPairGenerator
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int KEY_SIZE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.security.cert.X509Certificate generateCertificate​(java.security.KeyPair keyPair, java.lang.String subjectDN, java.lang.String signatureAlgorithm)  
      static java.security.KeyPair generateECCKeyPair()  
      static java.security.KeyPair generateECCKeyPair​(java.lang.String spec)  
      static java.security.KeyPair generateRSAKeyPair()  
      static java.security.cert.X509Certificate selfSign​(java.security.KeyPair keyPair, java.lang.String subjectDN, java.lang.String signatureAlgorithm)  
      • Methods inherited from class java.lang.Object

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

      • KeyPairGenerator

        public KeyPairGenerator()
    • Method Detail

      • generateRSAKeyPair

        public static java.security.KeyPair generateRSAKeyPair()
                                                        throws java.security.NoSuchAlgorithmException,
                                                               java.security.NoSuchProviderException
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
      • generateECCKeyPair

        public static java.security.KeyPair generateECCKeyPair​(java.lang.String spec)
                                                        throws java.security.InvalidAlgorithmParameterException,
                                                               java.security.NoSuchProviderException,
                                                               java.security.NoSuchAlgorithmException
        Throws:
        java.security.InvalidAlgorithmParameterException
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
      • generateECCKeyPair

        public static java.security.KeyPair generateECCKeyPair()
                                                        throws java.security.InvalidAlgorithmParameterException,
                                                               java.security.NoSuchAlgorithmException,
                                                               java.security.NoSuchProviderException
        Throws:
        java.security.InvalidAlgorithmParameterException
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
      • selfSign

        public static java.security.cert.X509Certificate selfSign​(java.security.KeyPair keyPair,
                                                                  java.lang.String subjectDN,
                                                                  java.lang.String signatureAlgorithm)
                                                           throws org.bouncycastle.operator.OperatorCreationException,
                                                                  java.security.cert.CertificateException,
                                                                  java.io.IOException,
                                                                  java.security.NoSuchProviderException
        Throws:
        org.bouncycastle.operator.OperatorCreationException
        java.security.cert.CertificateException
        java.io.IOException
        java.security.NoSuchProviderException
      • generateCertificate

        public static java.security.cert.X509Certificate generateCertificate​(java.security.KeyPair keyPair,
                                                                             java.lang.String subjectDN,
                                                                             java.lang.String signatureAlgorithm)
                                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception