Class Signature

Definition

Namespace:
Tizen.Security.SecureRepository.Crypto
Assembly:
Tizen.Security.SecureRepository.dll

Provides the methods for creating and verifying a signature.

C#
Copy
public class Signature
Inheritance
object
Signature

Constructors

View Source

Signature(SignatureParameters)

Initializes an instance of Signature class with SignatureParameters.

Declaration
C#
Copy
public Signature(SignatureParameters parameters)
Parameters
Type Name Description
SignatureParameters parameters

The algorithm specific parameters.

Properties

View Source

Parameters

Gets algorithm specific parameters.

Declaration
C#
Copy
public SignatureParameters Parameters { get; }
Property Value
Type Description
SignatureParameters

Algorithm specific parameters.

Methods

View Source

Sign(string, string, byte[])

Creates a signature on a given message using a private key and returns the signature.

Declaration
C#
Copy
public byte[] Sign(string privateKeyAlias, string password, byte[] message)
Parameters
Type Name Description
string privateKeyAlias

Name of a private key.

string password

Password used in decrypting a private key value.

byte[] message

Message signed with a private key.

Returns
Type Description
byte[]

Newly created signature.

Remarks

Key type specified by the privateKeyAlias should be compatible with the algorithm specified in Parameters.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when privateKeyAlias or message is null.

System.ArgumentException

Thrown when privateKeyAlias has invalid format.

System.InvalidOperationException

Thrown when key-protecting password does not match. Thrown when key does not exist with given privateKeyAlias.

View Source

Verify(string, string, byte[], byte[])

Verifies a given signature on a given message using a public key and returns the signature status.

Declaration
C#
Copy
public bool Verify(string publicKeyAlias, string password, byte[] message, byte[] signature)
Parameters
Type Name Description
string publicKeyAlias

Name of a public key.

string password

Password used in decrypting a public key value.

byte[] message

Input message on which the signature is created.

byte[] signature

Signature that is verified with public key.

Returns
Type Description
bool

Signature status. True if the signature is valid.

Remarks

Key type specified by publicKeyAlias should be compatible with the algorithm specified in Parameters.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when publicKeyAlias, message or signature is null.

System.ArgumentException

Thrown when publicKeyAlias has invalid format.

System.InvalidOperationException

Thrown when key-protecting password does not match. Thrown when key does not exist with given publicKeyAlias.