PublicKey
Namespace: Wisej.Ext.WebAuthn
Assembly: Wisej.Ext.WebAuthn (4.1.0.0)
Represents information about a public key retrieved from the client.
- C#
- VB.NET
public class PublicKey
Public Class PublicKey
Constructors
PublicKey()
Creates a new instance of PublicKey.
Example:
var publicKey = new PublicKey
{
CredentialID = storedCredentialID,
Data = storedKeyData
};
PublicKey(credentialID, data)
Creates a new instance of PublicKey with the given configuration.
| Name | Type | Description |
|---|---|---|
| credentialID | String | The base64 credential ID received upon registration. |
| data | Object | The dynamic COSE public key object received upon registration. |
Example:
CredentialsResponse response = await WebAuthn.CreateAsync(
challenge, rp, user, parameters, selection, 60000, AttestationConveyancePreference.None);
PublicKey registered = response.AuthenticatorData.PublicKey;
var copy = new PublicKey(registered.CredentialID, registered.Data);
PublicKey(json)
Creates a new instance of PublicKey with the given JSON configuration.
The JSON must contain the CredentialID and Data members. Use this overload to restore a public key saved in a database after registration.
Example:
// Restore the public key saved when the user registered.
string json = LoadPublicKeyJson(userId);
var publicKey = new PublicKey(json);
bool valid = WebAuthn.Validate(
publicKey,
response.AuthenticatorData.Base64,
response.ClientData.Base64,
response.Signature);
Properties
Algorithm
COSEAlgorithmIdentifier: The public key algorithm used.
CredentialID
String: The credential ID returned from the client.
Data
Object: The public key data returned from the client.