Show / Hide Table of Contents

Interface ICipher

An interface to define symmetric cipher algorithm.

Namespace: Libplanet.KeyStore.Ciphers
Assembly: Libplanet.dll
Syntax
public interface ICipher

Methods

| Improve this Doc View Source

Decrypt(in ImmutableArray<Byte>, in ImmutableArray<Byte>)

Decrypts the given ciphertext using the given key.

Declaration
[Pure]
ImmutableArray<byte> Decrypt(in ImmutableArray<byte> key, in ImmutableArray<byte> ciphertext)
Parameters
Type Name Description
ImmutableArray<Byte> key

A symmetric key.

ImmutableArray<Byte> ciphertext

An immutable Byte array to decrypt.

Returns
Type Description
ImmutableArray<Byte>

The plain text decrypted from the ciphertext using the key.

| Improve this Doc View Source

Encrypt(in ImmutableArray<Byte>, in ImmutableArray<Byte>)

Encrypts the given plaintext using the given key.

Declaration
[Pure]
ImmutableArray<byte> Encrypt(in ImmutableArray<byte> key, in ImmutableArray<byte> plaintext)
Parameters
Type Name Description
ImmutableArray<Byte> key

A symmetric key.

ImmutableArray<Byte> plaintext

An immutable Byte array to encrypt.

Returns
Type Description
ImmutableArray<Byte>

The ciphertext made from the plaintext using the key.

| Improve this Doc View Source

WriteJson(Utf8JsonWriter)

Dumps the cipher parameters as a JSON representation according to Ethereum's Web3 Secret Storage Definition.

Declaration
string WriteJson(Utf8JsonWriter writer)
Parameters
Type Name Description
Utf8JsonWriter writer

A JSON writer which has not begun object nor array.

Returns
Type Description
String

A unique identifier of the cipher algorithm. This is going to be the crypto.cipher field in the key JSON file.

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