Class CrtToken


  • public class CrtToken
    extends java.lang.Object
    This class maps an external RSA Private Key Token containing a Token Header, a RSA Private Key Section, and a RSA Public Key Section. Refer to the section on RSA Key Token Formats in the Cryptographic Services ICSF System Programmer's Guide for more information on formatting of the token.
    • Constructor Summary

      Constructors 
      Constructor Description
      CrtToken​(byte[] externalToken, byte[] internalToken)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.security.PrivateKey generatePrivateCrtkey()
      Generates and returns a JCE private key object that is constructed from this token's field values.
      byte getKeyFormatSecurityFromToken()
      Returns the "Key format and security" field value, in the RSA private key section of this RSA external token.
      java.math.BigInteger getPublicExponentFromToken()
      Returns the public key exponent, e, in the RSA public key section of this RSA external token.
      • Methods inherited from class java.lang.Object

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

      • CrtToken

        public CrtToken​(byte[] externalToken,
                        byte[] internalToken)
        Constructor. Parse all fields of the RSA Private External Key Token.
        Parameters:
        externalToken - the RSA private external key token to parse
        internalToken - the internal token, not parsed and not required or supported
    • Method Detail

      • getKeyFormatSecurityFromToken

        public byte getKeyFormatSecurityFromToken()
        Returns the "Key format and security" field value, in the RSA private key section of this RSA external token. Field offset within section is 28. 1 byte long.
        Returns:
        the "Key format and security" field value.
      • getPublicExponentFromToken

        public java.math.BigInteger getPublicExponentFromToken()
        Returns the public key exponent, e, in the RSA public key section of this RSA external token.
        Returns:
        the public key exponent, e.
      • generatePrivateCrtkey

        public java.security.PrivateKey generatePrivateCrtkey()
                                                       throws java.lang.Exception
        Generates and returns a JCE private key object that is constructed from this token's field values.
        Returns:
        the generated JCE RSAPrivateCrtKey object, or null if the private key is encrypted.
        Throws:
        java.io.IOException - if this is not a RSA Private External Key Token
        java.security.ProviderException - if unable to construct a RSA key from this RSA external token
        java.lang.Exception