Search in sources :

Example 16 with AttestationCertificatePath

use of com.webauthn4j.data.attestation.statement.AttestationCertificatePath in project webauthn4j by webauthn4j.

the class PackedAttestationStatementValidatorTest method validate_with_RSAx5c_test.

@Test
void validate_with_RSAx5c_test() throws Exception {
    KeyPair keyPair = RSAUtil.createKeyPair();
    AuthenticatorData<RegistrationExtensionAuthenticatorOutput> authenticatorData = TestDataUtil.createAuthenticatorData();
    byte[] clientData = TestDataUtil.createClientDataJSON(ClientDataType.WEBAUTHN_CREATE);
    byte[] signature = generateSignature("SHA256withRSA", keyPair, authenticatorData, clientData);
    AttestationCertificatePath x5c = generateCertPath(keyPair, "SHA256withRSA");
    PackedAttestationStatement packedAttestationStatement = new PackedAttestationStatement(COSEAlgorithmIdentifier.RS256, signature, x5c);
    AttestationObject attestationObject = new AttestationObject(authenticatorData, packedAttestationStatement);
    validate(clientData, attestationObject);
}
Also used : PackedAttestationStatement(com.webauthn4j.data.attestation.statement.PackedAttestationStatement) AttestationCertificatePath(com.webauthn4j.data.attestation.statement.AttestationCertificatePath) AttestationObject(com.webauthn4j.data.attestation.AttestationObject) RegistrationExtensionAuthenticatorOutput(com.webauthn4j.data.extension.authenticator.RegistrationExtensionAuthenticatorOutput) Test(org.junit.jupiter.api.Test)

Example 17 with AttestationCertificatePath

use of com.webauthn4j.data.attestation.statement.AttestationCertificatePath in project webauthn4j by webauthn4j.

the class FIDOU2FAttestationStatementValidatorTest method validateAttestationStatementNotNull_test.

@Test
void validateAttestationStatementNotNull_test() {
    FIDOU2FAttestationStatement attestationStatement = new FIDOU2FAttestationStatement(new AttestationCertificatePath(), new byte[32]);
    target.validateAttestationStatementNotNull(attestationStatement);
}
Also used : AttestationCertificatePath(com.webauthn4j.data.attestation.statement.AttestationCertificatePath) FIDOU2FAttestationStatement(com.webauthn4j.data.attestation.statement.FIDOU2FAttestationStatement) Test(org.junit.jupiter.api.Test)

Aggregations

AttestationCertificatePath (com.webauthn4j.data.attestation.statement.AttestationCertificatePath)17 Test (org.junit.jupiter.api.Test)12 AndroidKeyAttestationStatement (com.webauthn4j.data.attestation.statement.AndroidKeyAttestationStatement)3 FIDOU2FAttestationStatement (com.webauthn4j.data.attestation.statement.FIDOU2FAttestationStatement)3 PackedAttestationStatement (com.webauthn4j.data.attestation.statement.PackedAttestationStatement)3 X509Certificate (java.security.cert.X509Certificate)3 AppleAppAttestAttestationStatement (com.webauthn4j.appattest.data.attestation.statement.AppleAppAttestAttestationStatement)2 AttestationObject (com.webauthn4j.data.attestation.AttestationObject)2 CertificateBaseAttestationStatement (com.webauthn4j.data.attestation.statement.CertificateBaseAttestationStatement)2 RegistrationExtensionAuthenticatorOutput (com.webauthn4j.data.extension.authenticator.RegistrationExtensionAuthenticatorOutput)2 TrustAnchor (java.security.cert.TrustAnchor)2 AAGUID (com.webauthn4j.data.attestation.authenticator.AAGUID)1 AttestedCredentialData (com.webauthn4j.data.attestation.authenticator.AttestedCredentialData)1 AuthenticatorData (com.webauthn4j.data.attestation.authenticator.AuthenticatorData)1 EC2COSEKey (com.webauthn4j.data.attestation.authenticator.EC2COSEKey)1 AttestationStatement (com.webauthn4j.data.attestation.statement.AttestationStatement)1 CredentialCreationResponse (com.webauthn4j.test.authenticator.CredentialCreationResponse)1 UnexpectedCheckedException (com.webauthn4j.util.exception.UnexpectedCheckedException)1 RegistrationObject (com.webauthn4j.validator.RegistrationObject)1 BigInteger (java.math.BigInteger)1