Class AuthenticatorData
java.lang.Object
com.iizix.server.user.passkey.AuthenticatorData
The authenticator data of WebAuthn (section 6.1 of the specification), decoded from the bytes the authenticator signed (CC-LOGIN-L8-PASSKEYS): the hash of the relying party ID, the flags, the signature counter, and - in a registration - the attested credential data with the new credential's ID and public key. The data is a peer's: every length is checked, and nothing may follow what the flags announce.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.static final intThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.static final intThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.static final intThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.static final intThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.static final intThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.final intThe flags.static final intThe longest credential ID of WebAuthn, in bytes.final CoseKeyThe credential public key, null without attested credential data.final longThe signature counter, 0 to 2^32-1.Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticatorDatadecode(byte[] data) Decodes authenticator data.Gets the AAGUID of the authenticator in its text form.byte[]Gets the credential ID of the attested credential data.byte[]Gets the SHA-256 hash of the relying party ID.booleanChecks if the data carries attested credential data.booleanChecks if the credential is backed up (synchronized) now.booleanChecks if the credential may be backed up (synchronized).booleanChecks if the user was present.booleanChecks if the user was verified by the authenticator.
Field Details
FLAG_UP
public static final int FLAG_UPThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.- See Also:
FLAG_UV
public static final int FLAG_UVThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.- See Also:
FLAG_BE
public static final int FLAG_BEThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.- See Also:
FLAG_BS
public static final int FLAG_BSThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.- See Also:
FLAG_AT
public static final int FLAG_ATThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.- See Also:
FLAG_ED
public static final int FLAG_EDThe flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.- See Also:
MAX_CREDENTIAL_ID
public static final int MAX_CREDENTIAL_IDThe longest credential ID of WebAuthn, in bytes.- See Also:
flags
public final int flagsThe flags.signCount
public final long signCountThe signature counter, 0 to 2^32-1.publicKey
The credential public key, null without attested credential data.
Method Details
decode
Decodes authenticator data.- Parameters:
data- The bytes.- Returns:
- The authenticator data.
- Throws:
NullPointerException- Ifdatais null.PasskeyException- If the bytes are not well-formed authenticator data.
getRpIdHash
public byte[] getRpIdHash()Gets the SHA-256 hash of the relying party ID.- Returns:
- A copy of the 32 bytes.
getCredentialId
public byte[] getCredentialId()Gets the credential ID of the attested credential data.- Returns:
- A copy of the bytes, null without attested credential data.
getAaguid
Gets the AAGUID of the authenticator in its text form.- Returns:
- The 36 characters, e.g.
01020304-0506-0708-0102-030405060708; null without attested credential data.
isUserPresent
public boolean isUserPresent()Checks if the user was present.- Returns:
- The UP flag.
isUserVerified
public boolean isUserVerified()Checks if the user was verified by the authenticator.- Returns:
- The UV flag.
isBackupEligible
public boolean isBackupEligible()Checks if the credential may be backed up (synchronized).- Returns:
- The BE flag.
isBackedUp
public boolean isBackedUp()Checks if the credential is backed up (synchronized) now.- Returns:
- The BS flag.
hasAttestedCredentialData
public boolean hasAttestedCredentialData()Checks if the data carries attested credential data.- Returns:
- The AT flag.