Search in sources :

Example 1 with AttestationCertificateBuilder

use of com.webauthn4j.test.AttestationCertificateBuilder in project webauthn4j by webauthn4j.

the class AndroidSafetyNetAuthenticator method createAttestationCertificate.

@Override
X509Certificate createAttestationCertificate(AttestationStatementRequest attestationStatementRequest, AttestationOption attestationOption) {
    AttestationCertificateBuilder builder = new AttestationCertificateBuilder(getAttestationIssuerCertificate(), new X500Principal(attestationOption.getSubjectDN()), this.getAttestationKeyPair().getPublic());
    builder.addBasicConstraintsExtension();
    builder.addKeyUsageExtension();
    return builder.build(this.getAttestationIssuerPrivateKey());
}
Also used : X500Principal(javax.security.auth.x500.X500Principal) AttestationCertificateBuilder(com.webauthn4j.test.AttestationCertificateBuilder)

Example 2 with AttestationCertificateBuilder

use of com.webauthn4j.test.AttestationCertificateBuilder in project webauthn4j by webauthn4j.

the class TPMAuthenticator method createAttestationCertificate.

@Override
public X509Certificate createAttestationCertificate(AttestationStatementRequest attestationStatementRequest, AttestationOption attestationOption) {
    AttestationCertificateBuilder builder = new AttestationCertificateBuilder(getAttestationIssuerCertificate(), new X500Principal(attestationOption.getSubjectDN()), this.getAttestationKeyPair().getPublic());
    builder.addSubjectAlternativeNamesExtension("2.23.133.2.3=#0c0b69643a3030303230303030,2.23.133.2.2=#0c03535054,2.23.133.2.1=#0c0b69643a3439344535343433");
    if (attestationOption.isCAFlagInBasicConstraints()) {
        builder.addBasicConstraintsExtension();
    }
    if (attestationOption instanceof TPMAttestationOption) {
        TPMAttestationOption tpmAttestationOption = (TPMAttestationOption) attestationOption;
        if (tpmAttestationOption.isTcgKpAIKCertificateFlagInExtendedKeyUsage()) {
            builder.addExtendedKeyUsageExtension(KeyPurposeId.getInstance(new ASN1ObjectIdentifier("2.23.133.8.3")));
        }
    }
    return builder.build(this.getAttestationIssuerPrivateKey());
}
Also used : X500Principal(javax.security.auth.x500.X500Principal) AttestationCertificateBuilder(com.webauthn4j.test.AttestationCertificateBuilder) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 3 with AttestationCertificateBuilder

use of com.webauthn4j.test.AttestationCertificateBuilder in project webauthn4j by webauthn4j.

the class AndroidKeyAuthenticator method createAttestationCertificate.

@Override
protected X509Certificate createAttestationCertificate(AttestationStatementRequest attestationStatementRequest, AttestationOption attestationOption) {
    AttestationCertificateBuilder builder = new AttestationCertificateBuilder(getAttestationIssuerCertificate(), new X500Principal(attestationOption.getSubjectDN()), attestationStatementRequest.getCredentialKeyPair().getPublic());
    builder.addExtension(new ASN1ObjectIdentifier("1.3.6.1.4.1.11129.2.1.17"), false, createKeyDescriptor(attestationStatementRequest.getClientDataHash()));
    builder.addBasicConstraintsExtension();
    builder.addKeyUsageExtension();
    return builder.build(this.getAttestationIssuerPrivateKey());
}
Also used : X500Principal(javax.security.auth.x500.X500Principal) AttestationCertificateBuilder(com.webauthn4j.test.AttestationCertificateBuilder)

Aggregations

AttestationCertificateBuilder (com.webauthn4j.test.AttestationCertificateBuilder)3 X500Principal (javax.security.auth.x500.X500Principal)3 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1