Show / Hide Table of Contents

Interface ICryptoBackend<T>

Cryptography backend interface.

Namespace: Libplanet.Crypto
Assembly: Libplanet.Crypto.dll
Syntax
public interface ICryptoBackend<T>
    where T : HashAlgorithm
Type Parameters
Name Description
T

A HashAlgorithm which corresponds to a digest.

Methods

| Improve this Doc View Source

Sign(HashDigest<T>, PrivateKey)

Creates a signature from messageHash with the corresponding privateKey.

Declaration
byte[] Sign(HashDigest<T> messageHash, PrivateKey privateKey)
Parameters
Type Name Description
HashDigest<T> messageHash

A 32 bytes message hash digest hashed with SHA256 to sign.

PrivateKey privateKey

PrivateKey to sign messageHash.

Returns
Type Description
System.Byte[]

Created a signature from messageHash with the corresponding privateKey.

See Also
HashAlgorithm
| Improve this Doc View Source

Verify(HashDigest<T>, Byte[], PublicKey)

Verifies whether a signature was created from a messageHash with the corresponding PrivateKey.

Declaration
bool Verify(HashDigest<T> messageHash, byte[] signature, PublicKey publicKey)
Parameters
Type Name Description
HashDigest<T> messageHash

A 32 bytes message hash digest hashed with SHA256.

System.Byte[] signature

A signature that was created from the messageHash.

PublicKey publicKey

PublicKey used for verification.

Returns
Type Description
System.Boolean

true if the signature was created from the messageHash with the corresponding PrivateKey. Otherwise false.

Exceptions
Type Condition
Exception

If any exception is thrown, the given signature is considered as invalid.

See Also
HashAlgorithm

See Also

HashAlgorithm
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium