Search in sources :

Example 6 with JWSHeader

use of com.webauthn4j.data.jws.JWSHeader in project webauthn4j by webauthn4j.

the class AndroidSafetyNetAttestationStatementValidatorTest method validateAttestationStatementNotNull_test.

@Test
void validateAttestationStatementNotNull_test() {
    String ver = "12685023";
    String nonce = "nonce";
    long timestampMs = Instant.now().toEpochMilli();
    String apkPackageName = "com.android.keystore.androidkeystoredemo";
    String[] apkCertificateDigestSha256 = new String[] { "bsb4/WQdaaOWYCd/j9OJiQpg7b0iwFgAc/zzA1tCfwE=" };
    String apkDigestSha256 = "dM/LUHSI9SkQhZHHpQWRnzJ3MvvB2ANSauqYAAbS2Jg=";
    boolean ctsProfileMatch = true;
    boolean basicIntegrity = true;
    String advice = null;
    Response response = new Response(nonce, timestampMs, apkPackageName, apkCertificateDigestSha256, apkDigestSha256, ctsProfileMatch, basicIntegrity, advice);
    JWS<Response> jws = new JWSFactory().create(new JWSHeader(JWAIdentifier.ES256, CertificateUtil.generateCertPath(Collections.emptyList())), response, new byte[32]);
    AndroidSafetyNetAttestationStatement attestationStatement = new AndroidSafetyNetAttestationStatement(ver, jws);
    target.validateAttestationStatementNotNull(attestationStatement);
}
Also used : Response(com.webauthn4j.data.attestation.statement.Response) AndroidSafetyNetAttestationStatement(com.webauthn4j.data.attestation.statement.AndroidSafetyNetAttestationStatement) JWSFactory(com.webauthn4j.data.jws.JWSFactory) JWSHeader(com.webauthn4j.data.jws.JWSHeader) Test(org.junit.jupiter.api.Test)

Aggregations

JWSHeader (com.webauthn4j.data.jws.JWSHeader)6 Test (org.junit.jupiter.api.Test)3 AndroidSafetyNetAttestationStatement (com.webauthn4j.data.attestation.statement.AndroidSafetyNetAttestationStatement)2 Response (com.webauthn4j.data.attestation.statement.Response)2 JWSFactory (com.webauthn4j.data.jws.JWSFactory)2 CertPath (java.security.cert.CertPath)2 X509Certificate (java.security.cert.X509Certificate)2 ArrayList (java.util.ArrayList)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectConverter (com.webauthn4j.converter.util.ObjectConverter)1 JWAIdentifier (com.webauthn4j.data.jws.JWAIdentifier)1 MetadataBLOB (com.webauthn4j.metadata.data.MetadataBLOB)1 MetadataBLOBPayload (com.webauthn4j.metadata.data.MetadataBLOBPayload)1