use of com.webauthn4j.util.exception.NotImplementedException in project webauthn4j by webauthn4j.
the class TPMTPublicDeserializer method extractTPMUPublicId.
@NonNull
private TPMUPublicId extractTPMUPublicId(@NonNull TPMIAlgPublic type, @NonNull ByteBuffer buffer) {
if (type == TPMIAlgPublic.TPM_ALG_RSA) {
int nSize = UnsignedNumberUtil.getUnsignedShort(buffer);
byte[] n = new byte[nSize];
buffer.get(n);
return new RSAUnique(n);
} else if (type == TPMIAlgPublic.TPM_ALG_ECDSA) {
int xSize = UnsignedNumberUtil.getUnsignedShort(buffer);
byte[] x = new byte[xSize];
buffer.get(x);
int ySize = UnsignedNumberUtil.getUnsignedShort(buffer);
byte[] y = new byte[ySize];
buffer.get(y);
return new ECCUnique(x, y);
} else {
throw new NotImplementedException();
}
}
use of com.webauthn4j.util.exception.NotImplementedException in project webauthn4j by webauthn4j.
the class ClientPlatform method create.
public PublicKeyCredential<AuthenticatorAttestationResponse, RegistrationExtensionClientOutput> create(PublicKeyCredentialCreationOptions publicKeyCredentialCreationOptions, RegistrationEmulationOption registrationEmulationOption, AttestationOption attestationOption) {
CollectedClientData collectedClientData;
if (registrationEmulationOption.isCollectedClientDataOverrideEnabled()) {
collectedClientData = registrationEmulationOption.getCollectedClientData();
} else {
collectedClientData = createCollectedClientData(ClientDataType.WEBAUTHN_CREATE, publicKeyCredentialCreationOptions.getChallenge());
}
if (authenticatorAdaptor == null) {
throw new NoAuthenticatorSuccessException();
}
CredentialCreationResponse credentialCreationResponse = authenticatorAdaptor.register(publicKeyCredentialCreationOptions, collectedClientData, registrationEmulationOption, attestationOption);
AttestationObject attestationObject = credentialCreationResponse.getAttestationObject();
AttestationStatement attestationStatement = credentialCreationResponse.getAttestationObject().getAttestationStatement();
AttestationConveyancePreference attestationConveyancePreference = publicKeyCredentialCreationOptions.getAttestation();
if (attestationConveyancePreference == null) {
attestationConveyancePreference = AttestationConveyancePreference.NONE;
}
if (AttestationConveyancePreference.DIRECT.equals(attestationConveyancePreference)) {
// nop
} else if (AttestationConveyancePreference.INDIRECT.equals(attestationConveyancePreference)) {
throw new NotImplementedException();
} else if (AttestationConveyancePreference.NONE.equals(attestationConveyancePreference)) {
attestationStatement = new NoneAttestationStatement();
} else {
throw new NotImplementedException();
}
attestationObject = new AttestationObject(attestationObject.getAuthenticatorData(), attestationStatement);
byte[] attestationObjectBytes = attestationObjectConverter.convertToBytes(attestationObject);
byte[] credentialId = credentialCreationResponse.getAttestationObject().getAuthenticatorData().getAttestedCredentialData().getCredentialId();
byte[] collectedClientDataBytes = collectedClientDataConverter.convertToBytes(collectedClientData);
AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> clientExtensions = processRegistrationExtensions(publicKeyCredentialCreationOptions.getExtensions());
return new PublicKeyCredential<>(credentialId, new AuthenticatorAttestationResponse(collectedClientDataBytes, attestationObjectBytes), clientExtensions);
}
Aggregations