Class AuthenticatorData

java.lang.Object
com.iizix.server.user.passkey.AuthenticatorData

public final class AuthenticatorData extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.
    static final int
    The flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.
    static final int
    The flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.
    static final int
    The flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.
    static final int
    The flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.
    static final int
    The flags: user present, user verified, backup eligible, backup state, attested credential data included, extension data included.
    final int
    The flags.
    static final int
    The longest credential ID of WebAuthn, in bytes.
    final CoseKey
    The credential public key, null without attested credential data.
    final long
    The signature counter, 0 to 2^32-1.
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(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.
    boolean
    Checks if the data carries attested credential data.
    boolean
    Checks if the credential is backed up (synchronized) now.
    boolean
    Checks if the credential may be backed up (synchronized).
    boolean
    Checks if the user was present.
    boolean
    Checks if the user was verified by the authenticator.
  • Field Details

    • FLAG_UP

      public static final int FLAG_UP
      The 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_UV
      The 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_BE
      The 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_BS
      The 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_AT
      The 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_ED
      The 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_ID
      The longest credential ID of WebAuthn, in bytes.
      See Also:
    • flags

      public final int flags
      The flags.
    • signCount

      public final long signCount
      The signature counter, 0 to 2^32-1.
    • publicKey

      public final CoseKey publicKey
      The credential public key, null without attested credential data.
  • Method Details

    • decode

      public static AuthenticatorData decode(byte[] data) throws PasskeyException
      Decodes authenticator data.
      Parameters:
      data - The bytes.
      Returns:
      The authenticator data.
      Throws:
      NullPointerException - If data is 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

      public String 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.