public class CAProtocol extends Object
Constructor and Description |
---|
CAProtocol(PassportService service,
SecureMessagingWrapper wrapper)
Constructs a protocol instance.
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
computeSharedSecret(String agreementAlg,
PublicKey piccPublicKey,
PrivateKey pcdPrivateKey)
Does the key agreement step.
|
CAResult |
doCA(BigInteger keyId,
String oid,
String publicKeyOID,
PublicKey piccPublicKey)
Perform CA (Chip Authentication) part of EAC (version 1).
|
SecureMessagingWrapper |
getWrapper()
Gets the secure messaging wrapper currently in use.
|
static SecureMessagingWrapper |
restartSecureMessaging(String oid,
byte[] sharedSecret)
Restarts secure messaging based on the shared secret.
|
static void |
sendPublicKey(PassportService service,
SecureMessagingWrapper wrapper,
String oid,
BigInteger keyId,
PublicKey pcdPublicKey)
Sends the PCD's public key to the PICC.
|
public CAProtocol(PassportService service, SecureMessagingWrapper wrapper)
service
- the card servicewrapper
- the existing secure messaging wrapperpublic CAResult doCA(BigInteger keyId, String oid, String publicKeyOID, PublicKey piccPublicKey) throws net.sf.scuba.smartcards.CardServiceException
keyId
- passport's public key id (stored in DG14), null
if noneoid
- the object identifier indicating the Chip Authentication protocolpublicKeyOID
- the OID indicating the type of public keypiccPublicKey
- PICC's public key (stored in DG14)net.sf.scuba.smartcards.CardServiceException
- if CA failed or some error occurredpublic static void sendPublicKey(PassportService service, SecureMessagingWrapper wrapper, String oid, BigInteger keyId, PublicKey pcdPublicKey) throws net.sf.scuba.smartcards.CardServiceException
service
- the card servicewrapper
- the existing secure messaging wrapperoid
- the Chip Authentication object identifierkeyId
- a key identifier or null
pcdPublicKey
- the public key to sendnet.sf.scuba.smartcards.CardServiceException
- on errorpublic static byte[] computeSharedSecret(String agreementAlg, PublicKey piccPublicKey, PrivateKey pcdPrivateKey) throws NoSuchAlgorithmException, InvalidKeyException
agreementAlg
- the agreement algorithmpiccPublicKey
- the PICC's public keypcdPrivateKey
- the PCD's private keyNoSuchAlgorithmException
- if the agreement algorithm is unsupportedInvalidKeyException
- if one of the keys is invalidpublic static SecureMessagingWrapper restartSecureMessaging(String oid, byte[] sharedSecret) throws GeneralSecurityException
oid
- the Chip Authentication object identifiersharedSecret
- the shared secretGeneralSecurityException
- on errorpublic SecureMessagingWrapper getWrapper()
Copyright © 2017. All rights reserved.