public class BACProtocol extends Object
Constructor and Description |
---|
BACProtocol(APDULevelBACCapable service,
int maxTranceiveLength,
boolean shouldCheckMAC)
Constructs a BAC protocol instance.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
computeKeySeedForBAC(BACKeySpec bacKey)
Computes the key seed based on the given (MRZ based) BAC key.
|
static long |
computeSendSequenceCounter(byte[] rndICC,
byte[] rndIFD)
Computes the initial send sequence counter to use,
given the randoms generated by PICC and PCD.
|
BACResult |
doBAC(AccessKeySpec bacKey)
Performs the Basic Access Control protocol.
|
BACResult |
doBAC(SecretKey kEnc,
SecretKey kMac)
Performs the Basic Access Control protocol.
|
public BACProtocol(APDULevelBACCapable service, int maxTranceiveLength, boolean shouldCheckMAC)
service
- the service to send APDUsmaxTranceiveLength
- the maximal tranceive length (on responses to READ BINARY
)
to use in the resulting secure messaging channelshouldCheckMAC
- whether the resulting secure messaging channel should apply strict MAC
checking on response APDUspublic BACResult doBAC(AccessKeySpec bacKey) throws net.sf.scuba.smartcards.CardServiceException
bacKey
- the key based on the document number,
the card holder's birth date,
and the document's expiry datenet.sf.scuba.smartcards.CardServiceException
- if authentication failedpublic BACResult doBAC(SecretKey kEnc, SecretKey kMac) throws net.sf.scuba.smartcards.CardServiceException, GeneralSecurityException
kEnc
- the static 3DES key required for BACkMac
- the static 3DES key required for BACnet.sf.scuba.smartcards.CardServiceException
- if authentication failedGeneralSecurityException
- on security primitives related problemspublic static byte[] computeKeySeedForBAC(BACKeySpec bacKey) throws GeneralSecurityException
bacKey
- the BAC keyGeneralSecurityException
- on error applying the low level cryptographic primitivespublic static long computeSendSequenceCounter(byte[] rndICC, byte[] rndIFD)
rndICC
- the PICC's randomrndIFD
- the PCD's randomCopyright © 2021. All rights reserved.