EncodeAsPiv Method
EncodeAsPiv(IPublicKey)
Encodes a public key into the PIV format.
C#
public static Memory<byte> EncodeAsPiv(this IPublicKey parameters)
Parameters
Type | Name | Description |
---|---|---|
IPublicKey | parameters | The public key parameters to encode. |
Returns
Memory<byte>
A BER encoded byte array containing the encoded public key.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the key type is not supported. |
EncodeAsPiv(IPrivateKey)
Encodes a private key into the PIV format.
C#
public static Memory<byte> EncodeAsPiv(this IPrivateKey parameters)
Parameters
Type | Name | Description |
---|---|---|
IPrivateKey | parameters | The private key parameters to encode. |
Returns
Memory<byte>
A BER encoded byte array containing the encoded private key.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the key type is not supported or when RSA key components have invalid lengths. |