com.ibm.crypto.pkcs11impl.provider

Class RSAPKCS11KeyPairGenerator

  • java.lang.Object
    • java.security.KeyPairGeneratorSpi
      • com.ibm.crypto.pkcs11impl.provider.RSAPKCS11KeyPairGenerator


  • public final class RSAPKCS11KeyPairGenerator
    extends java.security.KeyPairGeneratorSpi
    This class generates RSA public/private key pairs. Note: There is a very small chance that an ArithmeticException being thrown during generateKeyPair().
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.security.KeyPair generateKeyPair()
      Generates a Key Pair
      void initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
      RSAPKCS11KeyPairGenerator requires Algorithm Parameters of type PKCS11RSAKeyPairParameter
      void initialize(int strength)
      Initializes this KeyPairGenerator for given modulus.
      void initialize(int strength, java.security.SecureRandom random)
      Initializes this KeyPairGenerator for given modulus and random source.
      • Methods inherited from class java.lang.Object

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

      • RSAPKCS11KeyPairGenerator

        public RSAPKCS11KeyPairGenerator(java.security.Provider provider)
        Creates a new instance of this class.
      • RSAPKCS11KeyPairGenerator

        public RSAPKCS11KeyPairGenerator()
        Creates a new instance of this class.
    • Method Detail

      • initialize

        public void initialize(java.security.spec.AlgorithmParameterSpec params,
                               java.security.SecureRandom random)
                        throws java.security.InvalidAlgorithmParameterException
        RSAPKCS11KeyPairGenerator requires Algorithm Parameters of type PKCS11RSAKeyPairParameter
        Overrides:
        initialize in class java.security.KeyPairGeneratorSpi
        Parameters:
        params - Algorithm Parameters of type PKCS11RSAKeyPairParameter
        random - which is not used and can be set to null.
        Throws:
        java.security.InvalidAlgorithmParameterException - is thrown if params is null or not an instance of PKCS11RSAKeyPairParameter
      • initialize

        public void initialize(int strength,
                               java.security.SecureRandom random)
        Initializes this KeyPairGenerator for given modulus and random source.
        Specified by:
        initialize in class java.security.KeyPairGeneratorSpi
        Parameters:
        strength - is the size of the modulu.
        random - which is not used and can be set to null.
        Throws:
        java.security.InvalidParameterException - if strength is invalid
      • initialize

        public void initialize(int strength)
        Initializes this KeyPairGenerator for given modulus.
        Parameters:
        strength - is the size of the modulu.
        Throws:
        java.security.InvalidParameterException - if strength is invalid
      • generateKeyPair

        public java.security.KeyPair generateKeyPair()
        Generates a Key Pair
        Specified by:
        generateKeyPair in class java.security.KeyPairGeneratorSpi
        Returns:
        a KeyPair contains a pair of generated RSA keys Note: There is a very small chance (1/1000) that an ArithmeticException being thrown during generateKeyPair(). In that case, calling generateKeyPair() again will give a new pair of keys.

© Portions Copyright 2003, 2017 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2017, Oracle and/or its affiliates. All rights reserved.