Package es.gob.jmulticard.card.dnie
Class DnieNfc
- All Implemented Interfaces:
Card
,CryptoCard
,Cwa14890Card
,Dni
,MrtdLds1
- Direct Known Subclasses:
IcaoMrtdWithPace
DNIe 3 accedido mediante PACE por NFC.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static MseSetPaceAlgorithmApduCommand.PacePasswordType
private static String
Fields inherited from class es.gob.jmulticard.card.dnie.Dnie
CDF_LOCATION, CERT_ALIAS_AUTH, CERT_ALIAS_CYPHER, CERT_ALIAS_INTERMEDIATE_CA, CERT_ALIAS_SIGN, CERT_ALIAS_SIGNALIAS, certAuth, certCyph, certIcc, certSign, certSignAlias, cryptoHelper, IDESP_LOCATION, intermediateCaCert, LOGGER, PRKDF_LOCATION, rawConnection
Fields inherited from class es.gob.jmulticard.card.AbstractSmartCard
DEBUG
Fields inherited from interface es.gob.jmulticard.card.icao.MrtdLds1
FILE_ATR_INFO_LOCATION, FILE_CARD_ACCESS_LOCATION, FILE_CARD_SECURITY_LOCATION, FILE_COM_LOCATION, FILE_DG01_LOCATION, FILE_DG02_LOCATION, FILE_DG03_LOCATION, FILE_DG04_LOCATION, FILE_DG05_LOCATION, FILE_DG06_LOCATION, FILE_DG07_LOCATION, FILE_DG08_LOCATION, FILE_DG09_LOCATION, FILE_DG10_LOCATION, FILE_DG11_LOCATION, FILE_DG12_LOCATION, FILE_DG13_LOCATION, FILE_DG14_LOCATION, FILE_DG15_LOCATION, FILE_DG16_LOCATION, FILE_SOD_LOCATION
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDnieNfc
(ApduConnection conn, PasswordCallback pwc, CryptoHelper cryptoHlpr, CallbackHandler ch) Crea un DNIe 3 o 4 accedido mediante PACE por NFC.protected
DnieNfc
(ApduConnection conn, PasswordCallback pwc, CryptoHelper cryptoHlpr, CallbackHandler ch, boolean loadCertsAndKeys) Construte un DNIe 3 accedido mediante PACE por NFC. -
Method Summary
Modifier and TypeMethodDescriptionObtiene el nombre de la tarjeta.private ApduConnection
private static ApduConnection
getPaceConnection
(ApduConnection con, CallbackHandler ch, CryptoHelper cryptoHelper) private static MseSetPaceAlgorithmApduCommand.PacePasswordType
getPasswordType
(String paceInitializationValue) private static boolean
Indica si un texto es numérico.void
Si no se había hecho anteriormente, establece y abre el canal seguro de PIN CWA-14890, solicita y comprueba el PIN e inmediatamente después y, si la verificación es correcta, establece el canal de usuario CWA-14890.private void
byte[]
sign
(byte[] data, String signAlgorithm, PrivateKeyReference privateKeyReference) Realiza una firma electrónica.Methods inherited from class es.gob.jmulticard.card.dnie.Dnie3
checkSecurityObjects, getAtrInfo, getCardAccess, getCardSecurity, getCom, getDg1, getDg10, getDg11, getDg12, getDg13, getDg14, getDg15, getDg16, getDg2, getDg3, getDg4, getDg5, getDg6, getDg7, getDg8, getDg9, getSod, needsPinForLoadingCerts, openSecureChannelIfNotAlreadyOpened, openUserChannel, signInternal
Methods inherited from class es.gob.jmulticard.card.dnie.Dnie
changePIN, cipherData, connect, externalAuthentication, getAliases, getCdf, getCertificate, getChrCCvIfd, getCryptoHelper, getCwa14890PrivateConstants, getCwa14890PublicConstants, getIccCertPublicKey, getIdesp, getIfdKeyLength, getIfdPrivateKey, getInternalAuthenticateMessage, getInternalPasswordCallback, getInternalPasswordCallback, getPasswordCallback, getPinMessage, getPinRetriesLeft, getPrivateKey, getRefIccPrivateKey, getSerialNumber, isSecurityChannelOpen, loadCertificates, loadCertificatesPaths, loadKeyReferences, needAuthorizationToSign, selectMasterFile, setCallbackHandler, setKeysToAuthentication, setPasswordCallback, signOperation, toString, verifyIcc, verifyIfdCertificateChain, verifyPin
Methods inherited from class es.gob.jmulticard.card.iso7816eight.AbstractIso7816EightCard
verifyCertificate
Methods inherited from class es.gob.jmulticard.card.iso7816four.AbstractIso7816FourCard
getChallenge, readAllRecords, readBinaryComplete, selectFileById, selectFileByIdAndRead, selectFileByLocation, selectFileByLocationAndRead, selectFileByName, selectFileByName, setPublicKeyToVerification
Methods inherited from class es.gob.jmulticard.card.AbstractSmartCard
getCla, getConnection, sendArbitraryApdu, setConnection
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface es.gob.jmulticard.card.cwa14890.Cwa14890Card
getChallenge
-
Field Details
-
MAX_PACE_RETRIES
private static final int MAX_PACE_RETRIES- See Also:
-
paceInitType
-
paceInitValue
-
-
Constructor Details
-
DnieNfc
public DnieNfc(ApduConnection conn, PasswordCallback pwc, CryptoHelper cryptoHlpr, CallbackHandler ch) throws IcaoException, ApduConnectionException Crea un DNIe 3 o 4 accedido mediante PACE por NFC.- Parameters:
conn
- Conexión (debe ser NFC).pwc
- PasswordCallback.cryptoHlpr
- Utilidad de funciones criptográficas.ch
- CallbackHandler.- Throws:
IcaoException
- Si hay erorres relacionados con ICAO 9303.ApduConnectionException
- Si hay errores en la transmisión de APDU.
-
DnieNfc
protected DnieNfc(ApduConnection conn, PasswordCallback pwc, CryptoHelper cryptoHlpr, CallbackHandler ch, boolean loadCertsAndKeys) throws IcaoException, ApduConnectionException Construte un DNIe 3 accedido mediante PACE por NFC.- Parameters:
conn
- Conexión NFC.pwc
-PasswordCallback
para obtener el PIN.cryptoHlpr
- Clase de utiildades criptográficas.ch
-CallbackHandler
para obtener el PIN y el CAN o la MRZ.loadCertsAndKeys
-true
si se ha de hacer una carga de claves y certificados en el momento de la construcción.- Throws:
IcaoException
- Si no se puede establecer en canal PACE.ApduConnectionException
- Si hay problemas en el envío de las APDU.
-
-
Method Details
-
getCardName
Description copied from class:AbstractSmartCard
Obtiene el nombre de la tarjeta.- Overrides:
getCardName
in classDnie3
- Returns:
- Nombre de la tarjeta
-
getPaceConnection
private static ApduConnection getPaceConnection(ApduConnection con, CallbackHandler ch, CryptoHelper cryptoHelper) throws ApduConnectionException, IcaoException - Throws:
ApduConnectionException
IcaoException
-
getPaceConnection
private ApduConnection getPaceConnection(ApduConnection con, CryptoHelper.PaceChannelHelper pch) throws ApduConnectionException, IcaoException - Throws:
ApduConnectionException
IcaoException
-
openSecureChannelIfNotAlreadyOpened
Description copied from class:Dnie3
Si no se había hecho anteriormente, establece y abre el canal seguro de PIN CWA-14890, solicita y comprueba el PIN e inmediatamente después y, si la verificación es correcta, establece el canal de usuario CWA-14890. Si falla algún punto del proceso, vuelve al modo inicial de conexión (sin canal seguro).- Overrides:
openSecureChannelIfNotAlreadyOpened
in classDnie3
- Throws:
CryptoCardException
- Si hay problemas en el proceso.PinException
- Si el PIN usado para la apertura de canal no es válido.
-
sign
public byte[] sign(byte[] data, String signAlgorithm, PrivateKeyReference privateKeyReference) throws CryptoCardException, PinException Description copied from interface:CryptoCard
Realiza una firma electrónica.- Specified by:
sign
in interfaceCryptoCard
- Overrides:
sign
in classDnie
- Parameters:
data
- Datos a firmar.signAlgorithm
- Algoritmo de firma.privateKeyReference
- Referencia a la clave privada de firma.- Returns:
- Datos firmados (PKCS#1 v1.5).
- Throws:
CryptoCardException
- Si ocurre algún problema durante la firma.PinException
- Si el PIN proporcionado es incorrecto o no es posible obtenerlo.
-
resetCard
private void resetCard() -
getPasswordType
private static MseSetPaceAlgorithmApduCommand.PacePasswordType getPasswordType(String paceInitializationValue) -
isNumeric
Indica si un texto es numérico.- Parameters:
cs
- Texto a analizar.- Returns:
true
si el texto es numérico,false
en caso contrario.
-