Class RSAPrivateKeyPKCS8

  • All Implemented Interfaces:
    java.io.Serializable, java.security.interfaces.RSAKey, java.security.interfaces.RSAPrivateKey, java.security.Key, java.security.PrivateKey, javax.security.auth.Destroyable

    public class RSAPrivateKeyPKCS8
    extends java.lang.Object
    implements java.security.interfaces.RSAPrivateKey
    This class implements the encoding of a RSA private key
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      RSAPrivateKeyPKCS8​(byte[] encoded)
      Default constructor for RSAPrivateKeyPKCS8
      RSAPrivateKeyPKCS8​(java.security.spec.RSAPrivateCrtKeySpec keyspec)
      Copy constructor for RSAPrivateKeyPKCS8
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkEncoding()
      Check the encoding
      java.lang.String getAlgorithm()  
      byte[] getEncoded()  
      java.lang.String getFormat()  
      java.security.spec.RSAPrivateKeySpec getKeySpec()
      Gets the key specification
      java.math.BigInteger getModulus()  
      java.math.BigInteger getPrivateExponent()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.security.auth.Destroyable

        destroy, isDestroyed
      • Methods inherited from interface java.security.interfaces.RSAKey

        getParams
    • Constructor Detail

      • RSAPrivateKeyPKCS8

        public RSAPrivateKeyPKCS8​(byte[] encoded)
        Default constructor for RSAPrivateKeyPKCS8
        Parameters:
        encoded - the private key as byte array
      • RSAPrivateKeyPKCS8

        public RSAPrivateKeyPKCS8​(java.security.spec.RSAPrivateCrtKeySpec keyspec)
        Copy constructor for RSAPrivateKeyPKCS8
        Parameters:
        keyspec - the class
    • Method Detail

      • getAlgorithm

        public java.lang.String getAlgorithm()
        Specified by:
        getAlgorithm in interface java.security.Key
        See Also:
        Key.getAlgorithm()
      • getFormat

        public java.lang.String getFormat()
        Specified by:
        getFormat in interface java.security.Key
        See Also:
        Key.getFormat()
      • checkEncoding

        public void checkEncoding()
                           throws java.security.spec.InvalidKeySpecException
        Check the encoding
        Throws:
        java.security.spec.InvalidKeySpecException - in case of error
      • getEncoded

        public byte[] getEncoded()
        Specified by:
        getEncoded in interface java.security.Key
        See Also:
        Key.getEncoded()
      • getKeySpec

        public java.security.spec.RSAPrivateKeySpec getKeySpec()
        Gets the key specification
        Returns:
        the key spec
      • getPrivateExponent

        public java.math.BigInteger getPrivateExponent()
        Specified by:
        getPrivateExponent in interface java.security.interfaces.RSAPrivateKey
        See Also:
        RSAPrivateKey.getPrivateExponent()
      • getModulus

        public java.math.BigInteger getModulus()
        Specified by:
        getModulus in interface java.security.interfaces.RSAKey
        See Also:
        RSAKey.getModulus()