Search in sources :

Example 1 with JWSFactory

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

the class CachingMetadataBLOBProviderTest method createMetadataBLOB.

private MetadataBLOB createMetadataBLOB(LocalDate nextUpdate) {
    JWSFactory factory = new JWSFactory(new ObjectConverter());
    JWSHeader header = new JWSHeader(JWAIdentifier.ES256, null);
    MetadataBLOBPayload payload = new MetadataBLOBPayload("", 0, nextUpdate, Collections.emptyList());
    JWS<MetadataBLOBPayload> jws = factory.create(header, payload, new byte[32]);
    return new MetadataBLOB(jws);
}
Also used : ObjectConverter(com.webauthn4j.converter.util.ObjectConverter) MetadataBLOB(com.webauthn4j.metadata.data.MetadataBLOB) JWSFactory(com.webauthn4j.data.jws.JWSFactory) JWSHeader(com.webauthn4j.data.jws.JWSHeader) MetadataBLOBPayload(com.webauthn4j.metadata.data.MetadataBLOBPayload)

Example 2 with JWSFactory

use of com.webauthn4j.data.jws.JWSFactory 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

JWSFactory (com.webauthn4j.data.jws.JWSFactory)2 JWSHeader (com.webauthn4j.data.jws.JWSHeader)2 ObjectConverter (com.webauthn4j.converter.util.ObjectConverter)1 AndroidSafetyNetAttestationStatement (com.webauthn4j.data.attestation.statement.AndroidSafetyNetAttestationStatement)1 Response (com.webauthn4j.data.attestation.statement.Response)1 MetadataBLOB (com.webauthn4j.metadata.data.MetadataBLOB)1 MetadataBLOBPayload (com.webauthn4j.metadata.data.MetadataBLOBPayload)1 Test (org.junit.jupiter.api.Test)1