Class OpenPgpSession
- All Implemented Interfaces:
Closeable,AutoCloseable
Enables you to manage keys and data, as well as perform signing, decryption, and authentication operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for public key attestation.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for the "cached" UIF settings.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for private keys using Elliptic Curve cryptography.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for changing the number of PIN attempts allowed before becoming blocked.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for factory reset.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for generating RSA keys.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for 4096 (and 3072) bit RSA keys, in addition to 2048-bit.static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for the User Interaction Flag (touch requirement).static final com.yubico.yubikit.core.application.Feature<OpenPgpSession>Support for resetting the PIN verified state. -
Constructor Summary
ConstructorsConstructorDescriptionOpenPgpSession(com.yubico.yubikit.core.smartcard.SmartCardConnection connection) Create new instance ofOpenPgpSessionand selects the application for use.OpenPgpSession(com.yubico.yubikit.core.smartcard.SmartCardConnection connection, @Nullable com.yubico.yubikit.core.smartcard.scp.ScpKeyParams scpKeyParams) Create new instance ofOpenPgpSessionand selects the application for use. -
Method Summary
Modifier and TypeMethodDescriptionCreates an attestation certificate for a key.byte[]authenticate(byte[] payload) Authenticates a message using the AUT key.voidchangeAdminPin(char[] pin, char[] newPin) Change the Admin PIN.voidchangeUserPin(char[] pin, char[] newPin) Change the User PIN.voidclose()byte[]decrypt(byte[] payload) Decrypts a value using the DEC key.byte[]decrypt(com.yubico.yubikit.core.keys.PublicKeyValues peerPublicKey) Performs an ECDH key agreement using the DEC key.voiddeleteCertificate(KeyRef keyRef) Deletes a certificate in a slot.voidDeletes the key in a key slot.com.yubico.yubikit.core.keys.PublicKeyValuesgenerateEcKey(KeyRef keyRef, OpenPgpCurve curve) Generate an EC key in the given slot.com.yubico.yubikit.core.keys.PublicKeyValuesgenerateRsaKey(KeyRef keyRef, int keySize) Generate an RSA key in the given slot.getAid()Get the AID for the OpenPGP application.Get the supported key algorithms for each of the key slots.Read the Application Related Data from the YubiKey.@Nullable X509CertificategetCertificate(KeyRef keyRef) Get a certificate from a slot.byte[]getChallenge(int length) Generate random data on the YubiKey.byte[]getData(int doId) Read a Data Object from the YubiKey.Get the Extended Capabilities supported by the YubiKey.getKdf()Read the current KDF settings configured for the YubiKey.Get the current PIN configuration and status from the YubiKey.com.yubico.yubikit.core.keys.PublicKeyValuesgetPublicKey(KeyRef keyRef) Read the public key from a slot.intGets the number of signatures performed with the SIG key.Get the User Interaction Flag (touch requirement) for a key.com.yubico.yubikit.core.VersionvoidputCertificate(KeyRef keyRef, X509Certificate certificate) Imports a certificate into a slot.voidputData(int doId, byte[] data) Write a Data Object to the YubiKey.voidImport a private key into the give slot.voidreset()Performs a factory reset on the OpenPGP application.voidresetPin(char[] newPin, char @Nullable [] resetCode) Resets the User PIN in case it is lost or blocked.voidsetAlgorithmAttributes(KeyRef keyRef, AlgorithmAttributes attributes) Sets the algorithm attributes to use for a key slot.voidsetFingerprint(KeyRef keyRef, byte[] fingerprint) Set the fingerprint of a key, format specified in RFC 4880.voidsetGenerationTime(KeyRef keyRef, int timestamp) Set the generation timestamp of a key.voidSet up a PIN Key Derivation Function.voidsetPinAttempts(int userAttempts, int resetAttempts, int adminAttempts) Set the number of PIN attempts to allow before blocking.voidsetResetCode(char[] resetCode) Set the Reset Code for User PIN.voidsetSignaturePinPolicy(PinPolicy pinPolicy) Set the PIN policy for the signature key slot.voidSet the User Interaction Flag (touch requirement) for a key.byte[]sign(byte[] payload) Signs a message using the SIG key.voidResets the verification state of the Admin PIN to unverified.voidResets the verification state of the User PIN to unverified.voidverifyAdminPin(char[] pin) Verify the Admin PIN.voidverifyUserPin(char[] pin, boolean extended) Verify the User PIN.Methods inherited from class com.yubico.yubikit.core.application.ApplicationSession
require, supports
-
Field Details
-
FEATURE_RESET
Support for factory reset. -
FEATURE_UIF
Support for the User Interaction Flag (touch requirement). -
FEATURE_ATTESTATION
Support for public key attestation. -
FEATURE_CACHED
Support for the "cached" UIF settings. -
FEATURE_RSA4096_KEYS
public static final com.yubico.yubikit.core.application.Feature<OpenPgpSession> FEATURE_RSA4096_KEYSSupport for 4096 (and 3072) bit RSA keys, in addition to 2048-bit. -
FEATURE_EC_KEYS
Support for private keys using Elliptic Curve cryptography. -
FEATURE_UNVERIFY_PIN
public static final com.yubico.yubikit.core.application.Feature<OpenPgpSession> FEATURE_UNVERIFY_PINSupport for resetting the PIN verified state. -
FEATURE_PIN_ATTEMPTS
public static final com.yubico.yubikit.core.application.Feature<OpenPgpSession> FEATURE_PIN_ATTEMPTSSupport for changing the number of PIN attempts allowed before becoming blocked. -
FEATURE_RSA_GENERATION
public static final com.yubico.yubikit.core.application.Feature<OpenPgpSession> FEATURE_RSA_GENERATIONSupport for generating RSA keys.
-
-
Constructor Details
-
OpenPgpSession
public OpenPgpSession(com.yubico.yubikit.core.smartcard.SmartCardConnection connection) throws IOException, com.yubico.yubikit.core.application.ApplicationNotAvailableException, com.yubico.yubikit.core.smartcard.ApduException Create new instance ofOpenPgpSessionand selects the application for use.- Parameters:
connection- a smart card connection to a YubiKey- Throws:
IOException- in case of communication errorcom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeycom.yubico.yubikit.core.application.ApplicationNotAvailableException- if the application is missing or disabled
-
OpenPgpSession
public OpenPgpSession(com.yubico.yubikit.core.smartcard.SmartCardConnection connection, @Nullable com.yubico.yubikit.core.smartcard.scp.ScpKeyParams scpKeyParams) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.ApplicationNotAvailableException Create new instance ofOpenPgpSessionand selects the application for use.- Parameters:
connection- a smart card connection to a YubiKeyscpKeyParams- SCP key parameters to establish a secure connection- Throws:
IOException- in case of communication errorcom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeycom.yubico.yubikit.core.application.ApplicationNotAvailableException- if the application is missing or disabled
-
-
Method Details
-
getVersion
public com.yubico.yubikit.core.Version getVersion()- Specified by:
getVersionin classcom.yubico.yubikit.core.application.ApplicationSession<OpenPgpSession>
-
close
- Throws:
IOException
-
getData
Read a Data Object from the YubiKey.- Parameters:
doId- the ID of the Data Object to read- Returns:
- the value of the Data Object
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
putData
public void putData(int doId, byte[] data) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Write a Data Object to the YubiKey.- Parameters:
doId- the ID of the Data Object to readdata- the value to write to the Data Object- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getApplicationRelatedData
public ApplicationRelatedData getApplicationRelatedData() throws com.yubico.yubikit.core.smartcard.ApduException, IOExceptionRead the Application Related Data from the YubiKey.- Returns:
- the parsed Application Related Data
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getAid
Get the AID for the OpenPGP application.- Returns:
- the parsed OpenPgpAid
-
getExtendedCapabilities
Get the Extended Capabilities supported by the YubiKey.- Returns:
- the parsed ExtendedCapabilities
-
getPinStatus
Get the current PIN configuration and status from the YubiKey.- Returns:
- a PwStatus object with remaining attempts, maximum PIN lengths, and signature PIN policy
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getKdf
Read the current KDF settings configured for the YubiKey.- Returns:
- a Kdf object, capable of deriving a key from a PIN
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
setKdf
Set up a PIN Key Derivation Function.This enables (or disables) the use of a KDF for PIN verification, as well as resetting the User and Admin PINs to their default (initial) values.
If a Reset Code is present, it will be invalidated.
This command requires Admin PIN verification.
- Parameters:
kdf- the KDF configuration to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
verifyUserPin
public void verifyUserPin(char[] pin, boolean extended) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.InvalidPinException Verify the User PIN.This will unlock functionality that requires User PIN verification. Note that with extended=false only sign operations are allowed. Inversely, with extended=true sign operations are NOT allowed.
- Parameters:
pin- the User PIN to verifyextended- false to verify for signature use, true for other uses- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.InvalidPinException- in case of the wrong PIN
-
verifyAdminPin
public void verifyAdminPin(char[] pin) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.InvalidPinException Verify the Admin PIN.This will unlock functionality that requires Admin PIN verification.
- Parameters:
pin- the Admin PIN to verify- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.InvalidPinException- in case of the wrong PIN
-
unverifyUserPin
Resets the verification state of the User PIN to unverified.- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
unverifyAdminPin
Resets the verification state of the Admin PIN to unverified.- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getSignatureCounter
public int getSignatureCounter() throws com.yubico.yubikit.core.smartcard.ApduException, IOExceptionGets the number of signatures performed with the SIG key.- Returns:
- the number of signatures
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getChallenge
public byte[] getChallenge(int length) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Generate random data on the YubiKey.- Parameters:
length- the number of bytes to generate- Returns:
- random data of the given length
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
setSignaturePinPolicy
public void setSignaturePinPolicy(PinPolicy pinPolicy) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Set the PIN policy for the signature key slot.A PIN policy of ONCE (the default) requires the User PIN to be verified once per session prior to creating a signature. A policy of ALWAYS requires a new PIN verification prior to each signature made.
- Parameters:
pinPolicy- the PIN policy to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
reset
Performs a factory reset on the OpenPGP application.WARNING: This will delete all stored keys, certificates and other data.
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
setPinAttempts
public void setPinAttempts(int userAttempts, int resetAttempts, int adminAttempts) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Set the number of PIN attempts to allow before blocking.WARNING: On YubiKey NEO this will reset the PINs to their default values.
Requires Admin PIN verification.
- Parameters:
userAttempts- the number of attempts for the User PINresetAttempts- the number of attempts for the Reset CodeadminAttempts- the number of attempts for the Admin PIN- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
changeUserPin
public void changeUserPin(char[] pin, char[] newPin) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.InvalidPinException Change the User PIN.- Parameters:
pin- the current User PINnewPin- the new User PIN to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.InvalidPinException- in case of the wrong PIN in case of the wrong PIN
-
changeAdminPin
public void changeAdminPin(char[] pin, char[] newPin) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.InvalidPinException Change the Admin PIN.- Parameters:
pin- the current Admin PINnewPin- the new Admin PIN to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.InvalidPinException- in case of the wrong PIN
-
setResetCode
public void setResetCode(char[] resetCode) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Set the Reset Code for User PIN.The Reset Code can be used to set a new User PIN if it is lost or becomes blocked, using the reset_pin method.
This command requires Admin PIN verification.
- Parameters:
resetCode- the Reset Code to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
resetPin
public void resetPin(char[] newPin, char @Nullable [] resetCode) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.InvalidPinException Resets the User PIN in case it is lost or blocked.This can be done either after performing Admin PIN verification, or by providing the Reset Code.
This command requires Admin PIN verification, or the Reset Code.
- Parameters:
newPin- the new User PIN to setresetCode- the Reset Code, which is needed if the Admin pin has not been verified- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.InvalidPinException- in case of the wrong PIN
-
getUif
public Uif getUif(KeyRef keyRef) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Get the User Interaction Flag (touch requirement) for a key.- Parameters:
keyRef- the key slot to read UIF for- Returns:
- the User Interaction Flag for the given slot
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
setUif
public void setUif(KeyRef keyRef, Uif uif) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Set the User Interaction Flag (touch requirement) for a key.Requires Admin PIN verification.
- Parameters:
keyRef- the key slot to set UIF foruif- the UIF setting to use for the key in the given slot- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getAlgorithmInformation
public Map<KeyRef,List<AlgorithmAttributes>> getAlgorithmInformation() throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.BadResponseExceptionGet the supported key algorithms for each of the key slots.- Returns:
- a mapping from key ref to list of supported algorithms
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey response
-
setAlgorithmAttributes
public void setAlgorithmAttributes(KeyRef keyRef, AlgorithmAttributes attributes) throws com.yubico.yubikit.core.application.BadResponseException, com.yubico.yubikit.core.smartcard.ApduException, IOException Sets the algorithm attributes to use for a key slot.- Parameters:
keyRef- the key slot to set attributes forattributes- the algorithm attributes to set for the slot- Throws:
com.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey responsecom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
setGenerationTime
public void setGenerationTime(KeyRef keyRef, int timestamp) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Set the generation timestamp of a key.- Parameters:
keyRef- the key slot to set the timestamp fortimestamp- the timestamp to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
setFingerprint
public void setFingerprint(KeyRef keyRef, byte[] fingerprint) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Set the fingerprint of a key, format specified in RFC 4880.- Parameters:
keyRef- the slot of the key to set the fingerprint forfingerprint- the fingerprint to set- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getCertificate
public @Nullable X509Certificate getCertificate(KeyRef keyRef) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Get a certificate from a slot.- Parameters:
keyRef- the slot to get a certificate from- Returns:
- the certificate stored in the give slot
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
putCertificate
public void putCertificate(KeyRef keyRef, X509Certificate certificate) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Imports a certificate into a slot.Requires Admin PIN verification.
- Parameters:
keyRef- the slot to put the certificate incertificate- the certificate to import- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
deleteCertificate
public void deleteCertificate(KeyRef keyRef) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Deletes a certificate in a slot.Requires Admin PIN verification.
- Parameters:
keyRef- the slot in which to delete the certificate- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
generateRsaKey
public com.yubico.yubikit.core.keys.PublicKeyValues generateRsaKey(KeyRef keyRef, int keySize) throws com.yubico.yubikit.core.application.BadResponseException, com.yubico.yubikit.core.smartcard.ApduException, IOException Generate an RSA key in the given slot.Requires Admin PIN verification.
- Parameters:
keyRef- the slot to generate the key inkeySize- the bitlength of the key to generate- Returns:
- the public key of the generated key pair
- Throws:
com.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey responsecom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
generateEcKey
public com.yubico.yubikit.core.keys.PublicKeyValues generateEcKey(KeyRef keyRef, OpenPgpCurve curve) throws com.yubico.yubikit.core.application.BadResponseException, com.yubico.yubikit.core.smartcard.ApduException, IOException Generate an EC key in the given slot.Requires Admin PIN verification.
- Parameters:
keyRef- the key slot to generate a key incurve- the elliptic curve of the key to generate- Returns:
- the public key of the generated key pair
- Throws:
com.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey responsecom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
putKey
public void putKey(KeyRef keyRef, com.yubico.yubikit.core.keys.PrivateKeyValues privateKey) throws com.yubico.yubikit.core.application.BadResponseException, com.yubico.yubikit.core.smartcard.ApduException, IOException Import a private key into the give slot.Requires Admin PIN verification.
- Parameters:
keyRef- the slot to import the key intoprivateKey- the private key to import- Throws:
com.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey responsecom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
getPublicKey
public com.yubico.yubikit.core.keys.PublicKeyValues getPublicKey(KeyRef keyRef) throws com.yubico.yubikit.core.smartcard.ApduException, IOException, com.yubico.yubikit.core.application.BadResponseException Read the public key from a slot.- Parameters:
keyRef- the key slot to read from- Returns:
- the public key stored in the given slot
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection errorcom.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey response
-
deleteKey
public void deleteKey(KeyRef keyRef) throws com.yubico.yubikit.core.application.BadResponseException, com.yubico.yubikit.core.smartcard.ApduException, IOException Deletes the key in a key slot.- Parameters:
keyRef- the slot to delete- Throws:
com.yubico.yubikit.core.application.BadResponseException- in case of incorrect YubiKey responsecom.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
sign
public byte[] sign(byte[] payload) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Signs a message using the SIG key.NOTE: This performs a raw signature. Messages should be hashed and/or padded prior. Requires User PIN verification.
- Parameters:
payload- the message to sign- Returns:
- the generated signature
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
decrypt
public byte[] decrypt(byte[] payload) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Decrypts a value using the DEC key.This method should be used for RSA keys to perform an RSA decryption using PKCS#1 v1.5 padding. For RSA the `value` should be an encrypted block. For ECDH the `value` should be a peer public-key to perform the key exchange with, and the result will be the derived shared secret.
Requires (extended) User PIN verification.
- Parameters:
payload- the ciphertext to decrypt- Returns:
- the decrypted and unpadded plaintext
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
decrypt
public byte[] decrypt(com.yubico.yubikit.core.keys.PublicKeyValues peerPublicKey) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Performs an ECDH key agreement using the DEC key.This method should be used for EC keys where encryption is done using a shared secret.
- Parameters:
peerPublicKey- the public key to perform the agreement with- Returns:
- the key agreement shared secret
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
authenticate
public byte[] authenticate(byte[] payload) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Authenticates a message using the AUT key.Requires User PIN verification.
- Parameters:
payload- the message to authenticate- Returns:
- the generated signature
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-
attestKey
public X509Certificate attestKey(KeyRef keyRef) throws com.yubico.yubikit.core.smartcard.ApduException, IOException Creates an attestation certificate for a key.The certificate is written to the certificate slot for the key, and its content is returned.
Requires User PIN verification.
- Parameters:
keyRef- the slot to attest- Returns:
- the attestation certificate
- Throws:
com.yubico.yubikit.core.smartcard.ApduException- in case of an error response from the YubiKeyIOException- in case of connection error
-