Class AESSecureMessagingWrapper

    • Constructor Detail

      • AESSecureMessagingWrapper

        public AESSecureMessagingWrapper​(SecretKey ksEnc,
                                         SecretKey ksMac,
                                         long ssc)
                                  throws GeneralSecurityException
        Constructs a secure messaging wrapper based on the secure messaging session keys and the initial value of the send sequence counter. Used in BAC and EAC 1.
        Parameters:
        ksEnc - the session key for encryption
        ksMac - the session key for macs
        ssc - the initial value of the send sequence counter
        Throws:
        GeneralSecurityException - when the available JCE providers cannot provide the necessary cryptographic primitives
      • AESSecureMessagingWrapper

        public AESSecureMessagingWrapper​(SecretKey ksEnc,
                                         SecretKey ksMac,
                                         int maxTranceiveLength,
                                         boolean shouldCheckMAC,
                                         long ssc)
                                  throws GeneralSecurityException
        Constructs a secure messaging wrapper based on the secure messaging session keys and the initial value of the send sequence counter. Used in BAC and EAC 1.
        Parameters:
        ksEnc - the session key for encryption
        ksMac - the session key for macs
        maxTranceiveLength - the maximum tranceive length, typical values are 256 or 65536
        shouldCheckMAC - a boolean indicating whether this wrapper will check the MAC in wrapped response APDUs
        ssc - the initial value of the send sequence counter
        Throws:
        GeneralSecurityException - when the available JCE providers cannot provide the necessary cryptographic primitives
    • Method Detail

      • getType

        public String getType()
        Returns the type of secure messaging wrapper (in this case "AES").
        Specified by:
        getType in interface net.sf.scuba.smartcards.APDUWrapper
        Returns:
        the type of secure messaging wrapper
      • getSendSequenceCounter

        public long getSendSequenceCounter()
        Returns the current value of the send sequence counter.
        Specified by:
        getSendSequenceCounter in class SecureMessagingWrapper
        Returns:
        the current value of the send sequence counter.
      • wrap

        public net.sf.scuba.smartcards.CommandAPDU wrap​(net.sf.scuba.smartcards.CommandAPDU commandAPDU)
        Wraps the APDU buffer of a command apdu. As a side effect, this method increments the internal send sequence counter maintained by this wrapper.
        Specified by:
        wrap in interface net.sf.scuba.smartcards.APDUWrapper
        Parameters:
        commandAPDU - buffer containing the command apdu.
        Returns:
        length of the command apdu after wrapping.
      • unwrap

        public net.sf.scuba.smartcards.ResponseAPDU unwrap​(net.sf.scuba.smartcards.ResponseAPDU responseAPDU)
        Unwraps the buffer of a response APDU.
        Specified by:
        unwrap in interface net.sf.scuba.smartcards.APDUWrapper
        Parameters:
        responseAPDU - the response APDU
        Returns:
        a new byte array containing the unwrapped buffer
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object