DigitalSignatureProvider

Namespace: ASPSecurityKit
Assembly: ASPSecurityKit.dll

Summary

Provides methods to sign and verify public key cryptography based digital signatures using any of the hashing algorithms as defined by HashAlgorithmName.

Methods

NewKeyPair(keySize)

Summary

Creates a new public/private key pair.

Returns

A new public/private key pair.

Parameters
Name Type Description
keySize System.Int32 Size of the key.

CreateSignature(data,privateKey,algorithm)

Summary

Creates a signature for the given data using the specified private key and hash algorithm. Use one of the algorithms as defined by HashAlgorithmName.

Returns

The signature hash as base64 encoded string.

Parameters
Name Type Description
data System.String The data for which signature is to be computed.
privateKey System.String The private key.
algorithm ASPSecurityKit.HashAlgorithmName The algorithm.
Exceptions
Type Description
System.ArgumentNullException when data/privateKey is null or whitespace.

VerifySignature(data,base64Signature,publicKey,algorithm)

Summary

Verifies whether the given signature is valid for the given data using the specified public key and hash algorithm. You must specify the same algorithm used while computing the signature.

Returns

true if the signature is valid; otherwise, false.

Parameters
Name Type Description
data System.String The data for which signature is to be verified.
base64Signature System.String The base64 signature.
publicKey System.String The public key.
algorithm ASPSecurityKit.HashAlgorithmName The algorithm.
Exceptions
Type Description
System.ArgumentNullException when data, base64Signature or publicKey is null or whitespace.