Package es.gob.jmulticard.card.dnie
Class DnieNfc
- java.lang.Object
-
- All Implemented Interfaces:
Card,CryptoCard,Cwa14890Card,Dni,MrtdLds1
- Direct Known Subclasses:
IcaoMrtdWithPace
public class DnieNfc extends Dnie3
DNIe 3 accedido mediante PACE por NFC.
-
-
Field Summary
Fields Modifier and Type Field Description private static MseSetPaceAlgorithmApduCommand.PacePasswordTypepaceInitTypeprivate static java.lang.StringpaceInitValue-
Fields inherited from class es.gob.jmulticard.card.dnie.Dnie
rawConnection
-
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_DIR_LOCATION, FILE_SOD_LOCATION
-
-
Constructor Summary
Constructors Constructor Description DnieNfc(ApduConnection conn, javax.security.auth.callback.PasswordCallback pwc, CryptoHelper cryptoHlpr, javax.security.auth.callback.CallbackHandler ch)Construte un DNIe 3 accedido mediante PACE por NFC.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCardName()Obtiene el nombre de la tarjeta.private ApduConnectiongetPaceConnection(ApduConnection con, CryptoHelper.PaceChannelHelper pch)private static ApduConnectiongetPaceConnection(ApduConnection con, javax.security.auth.callback.CallbackHandler ch, CryptoHelper cryptoHelper)private static MseSetPaceAlgorithmApduCommand.PacePasswordTypegetPasswordType(java.lang.String paceInitializationValue)private static booleanisNumeric(java.lang.CharSequence cs)Indica si un texto es numérico.voidopenSecureChannelIfNotAlreadyOpened()Establece y abre el canal seguro CWA-14890 si no lo estaba ya.voidopenSecureChannelIfNotAlreadyOpened(boolean doChv)Establece y abre el canal seguro CWA-14890 si no lo estaba ya.private voidresetCard()byte[]sign(byte[] data, java.lang.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, getDir, getPinRetriesLeft, getSod, needsPinForLoadingCerts, openPinChannel, openUserChannel
-
Methods inherited from class es.gob.jmulticard.card.dnie.Dnie
changePIN, cipherData, connect, externalAuthentication, getAliases, getCertificate, getChrCCvIfd, getCryptoHelper, getCwa14890PrivateConstants, getCwa14890PublicConstants, getIccCertPublicKey, getIdesp, getIfdKeyLength, getIfdPrivateKey, getInternalAuthenticateMessage, getInternalPasswordCallback, getPasswordCallback, getPinMessage, getPrivateKey, getRefIccPrivateKey, getSerialNumber, isSecurityChannelOpen, selectMasterFile, setCallbackHandler, setKeysToAuthentication, setPasswordCallback, signInternal, 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, 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 Detail
-
paceInitType
private static MseSetPaceAlgorithmApduCommand.PacePasswordType paceInitType
-
paceInitValue
private static java.lang.String paceInitValue
-
-
Constructor Detail
-
DnieNfc
public DnieNfc(ApduConnection conn, javax.security.auth.callback.PasswordCallback pwc, CryptoHelper cryptoHlpr, javax.security.auth.callback.CallbackHandler ch) throws IcaoException, ApduConnectionException
Construte un DNIe 3 accedido mediante PACE por NFC.- Parameters:
conn- Conexión NFC.pwc-PasswordCallbackpara obtener el PIN.cryptoHlpr- Clase de utiildades criptográficas.ch-CallbackHandlerpara obtener el PIN y el CAN o la MRZ.- Throws:
IcaoException- Si no se puede establecer en canal PACE.ApduConnectionException- Si hay problemas en el envío de las APDU.
-
-
Method Detail
-
getCardName
public java.lang.String getCardName()
Description copied from class:AbstractSmartCardObtiene el nombre de la tarjeta.- Overrides:
getCardNamein classDnie3- Returns:
- Nombre de la tarjeta.
-
getPaceConnection
private static ApduConnection getPaceConnection(ApduConnection con, javax.security.auth.callback.CallbackHandler ch, CryptoHelper cryptoHelper) throws ApduConnectionException, IcaoException
- Throws:
ApduConnectionExceptionIcaoException
-
getPaceConnection
private ApduConnection getPaceConnection(ApduConnection con, CryptoHelper.PaceChannelHelper pch) throws ApduConnectionException, IcaoException
- Throws:
ApduConnectionExceptionIcaoException
-
openSecureChannelIfNotAlreadyOpened
public void openSecureChannelIfNotAlreadyOpened() throws CryptoCardException, PinExceptionDescription copied from class:DnieEstablece y abre el canal seguro CWA-14890 si no lo estaba ya.- Overrides:
openSecureChannelIfNotAlreadyOpenedin classDnie3- Throws:
CryptoCardException- Si hay problemas en el proceso.PinException- Si el PIN usado para la apertura de canal no es válido o la tarjeta tiene el PIN bloqueado.PasswordCallbackNotFoundException- Si no se ha proporcionado una forma de obtener el PIN.
-
openSecureChannelIfNotAlreadyOpened
public void openSecureChannelIfNotAlreadyOpened(boolean doChv) throws CryptoCardException, PinExceptionDescription copied from class:DnieEstablece y abre el canal seguro CWA-14890 si no lo estaba ya.- Overrides:
openSecureChannelIfNotAlreadyOpenedin classDnie3- Parameters:
doChv-truesi la apertura de canal seguro debe incluir la verificación de PIN,falsesi debe abrirse canal seguro sin verificar PIN.- Throws:
CryptoCardException- Si hay problemas en el proceso.PinException- Si el PIN usado para la apertura de canal no es válido o la tarjeta tiene el PIN bloqueado.PasswordCallbackNotFoundException- Si no se ha proporcionado una forma de obtener el PIN.
-
sign
public byte[] sign(byte[] data, java.lang.String signAlgorithm, PrivateKeyReference privateKeyReference) throws CryptoCardException, PinExceptionDescription copied from interface:CryptoCardRealiza una firma electrónica.- Specified by:
signin interfaceCryptoCard- Overrides:
signin classDnie- Parameters:
data- Datos a firmar.signAlgorithm- Algoritmo de firma.privateKeyReference- Referencia a la clave privada de firma.- Returns:
- Datos firmados (en el algoritmo y formato que determine la tarjeta).
- Throws:
CryptoCardException- Si ocurre algún problema durante la firma.AuthenticationModeLockedException- Cuando la tarjeta está bloqueada.PinException- Si el PIN proporcionado es incorrecto o no es posible obtenerlo.
-
resetCard
private void resetCard()
-
getPasswordType
private static MseSetPaceAlgorithmApduCommand.PacePasswordType getPasswordType(java.lang.String paceInitializationValue)
-
isNumeric
private static boolean isNumeric(java.lang.CharSequence cs)
Indica si un texto es numérico.- Parameters:
cs- Texto a analizar.- Returns:
truesi el texto es numérico,falseen caso contrario.
-
-