Package org.jmrtd.lds

Class ChipAuthenticationInfo

  • All Implemented Interfaces:
    Serializable, LDSElement

    public class ChipAuthenticationInfo
    extends SecurityInfo
    A concrete SecurityInfo structure that stores chip authentication info, see EAC 1.11 specification. This data structure provides detailed information on an implementation of Chip Authentication.
    • The object identifier protocol SHALL identify the algorithms to be used (i.e. key agreement, symmetric cipher and MAC).
    • The integer version SHALL identify the version of the protocol. Currently, versions 1 and 2 are supported.
    • The integer keyId MAY be used to indicate the local key identifier. It MUST be used if the MRTD chip provides multiple public keys for Chip Authentication.
    Version:
    $Revision: 1799 $
    Author:
    The JMRTD team ([email protected])
    See Also:
    Serialized Form
    • Field Detail

      • VERSION_1

        public static final int VERSION_1
        Chip Authentication version 1.
        See Also:
        Constant Field Values
      • VERSION_2

        public static final int VERSION_2
        Chip Authentication version 2.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ChipAuthenticationInfo

        public ChipAuthenticationInfo​(String oid,
                                      int version)
        Constructs a new object.
        Parameters:
        oid - a proper EAC identifier
        version - has to be 1 or 2
      • ChipAuthenticationInfo

        public ChipAuthenticationInfo​(String oid,
                                      int version,
                                      BigInteger keyId)
        Constructs a new object.
        Parameters:
        oid - a proper EAC identifier
        version - has to be 1 or 2
        keyId - the key identifier
    • Method Detail

      • getDERObject

        @Deprecated
        public ASN1Primitive getDERObject()
        Deprecated.
        Remove this method from visible interface (because of dependency on BC API)
        Returns a DER object with this SecurityInfo data (DER sequence).
        Specified by:
        getDERObject in class SecurityInfo
        Returns:
        a DER object with this SecurityInfo data
      • getObjectIdentifier

        public String getObjectIdentifier()
        Gets the protocol object identifier.
        Specified by:
        getObjectIdentifier in class SecurityInfo
        Returns:
        the ID_CA_ object identifier indicating the Chip Authentication protocol
      • getVersion

        public int getVersion()
        Returns the Chip Authentication version (either 1 or 2).
        Returns:
        the Chip Authentication version
      • getProtocolOIDString

        public String getProtocolOIDString()
        Gets the protocol object identifier as a human readable string.
        Specified by:
        getProtocolOIDString in class SecurityInfo
        Returns:
        a string
      • getKeyId

        public BigInteger getKeyId()
        Returns a key identifier stored in this ChipAuthenticationInfo structure, null if not present.
        Returns:
        key identifier stored in this ChipAuthenticationInfo structure
      • checkFields

        protected void checkFields()
        Checks the correctness of the data for this instance of SecurityInfo. Throws an IllegalArgumentException when not correct.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toKeyAgreementAlgorithm

        public static String toKeyAgreementAlgorithm​(String oid)
        Returns the key agreement algorithm ("DH" or "ECDH" for the given Chip Authentication info object identifier.
        Parameters:
        oid - a EAC-CA protocol object identifier
        Returns:
        the key agreement algorithm
      • toCipherAlgorithm

        public static String toCipherAlgorithm​(String oid)
        Returns the encryption algorithm ("DESede" or "AES") for the given EAC-CA info object identifier.
        Parameters:
        oid - a EAC-CA protocol object identifier
        Returns:
        a JCE mnemonic cipher algorithm string
      • toDigestAlgorithm

        public static String toDigestAlgorithm​(String oid)
        Returns the digest algorithm ("SHA-1" or "SHA-256") for the given EAC-CA protocol object identifier.
        Parameters:
        oid - a EAC-CA protocol object identifier
        Returns:
        a JCE mnemonic digest algorithm string
      • toKeyLength

        public static int toKeyLength​(String oid)
        Returns the key length in bits (128, 192, or 256) for the given EAC-CA protocol object identifier.
        Parameters:
        oid - a EAC-CA protocol object identifier
        Returns:
        a key length in bits