frostfsecdsa

package
v0.0.0-...-42a0fc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Overview

Package frostfsecdsa collects ECDSA primitives for FrostFS cryptography.

Signer and PublicKey support ECDSA signature algorithm with SHA-512 hashing. SignerRFC6979 and PublicKeyRFC6979 implement signature algorithm described in RFC 6979. All these types provide corresponding interfaces from frostfscrypto package.

Package import causes registration of next signature schemes via frostfscrypto.RegisterScheme:

  • frostfscrypto.ECDSA_SHA512
  • frostfscrypto.ECDSA_DETERMINISTIC_SHA256

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PublicKey

type PublicKey ecdsa.PublicKey

PublicKey is a wrapper over ecdsa.PublicKey used for FrostFS needs. Provides frostfscrypto.PublicKey interface.

Instances MUST be initialized from ecdsa.PublicKey using type conversion.

func (*PublicKey) Decode

func (x *PublicKey) Decode(data []byte) error

Decode decodes compressed binary representation of the PublicKey.

See also Encode.

func (PublicKey) Encode

func (x PublicKey) Encode(buf []byte) int

Encode encodes ECDSA public key in compressed form into buf. Uses exactly MaxEncodedSize bytes of the buf.

Encode panics if buf length is less than MaxEncodedSize.

See also Decode.

func (PublicKey) MaxEncodedSize

func (x PublicKey) MaxEncodedSize() int

MaxEncodedSize returns size of the compressed ECDSA public key.

func (PublicKey) Verify

func (x PublicKey) Verify(data, signature []byte) bool

Verify verifies data signature calculated by ECDSA algorithm with SHA-512 hashing.

type PublicKeyRFC6979

type PublicKeyRFC6979 ecdsa.PublicKey

PublicKeyRFC6979 is a wrapper over ecdsa.PublicKey used for FrostFS needs. Provides frostfscrypto.PublicKey interface.

Instances MUST be initialized from ecdsa.PublicKey using type conversion.

func (*PublicKeyRFC6979) Decode

func (x *PublicKeyRFC6979) Decode(data []byte) error

Decode decodes binary representation of the ECDSA public key.

See also Encode.

func (PublicKeyRFC6979) Encode

func (x PublicKeyRFC6979) Encode(buf []byte) int

Encode encodes ECDSA public key in compressed form into buf. Uses exactly MaxEncodedSize bytes of the buf.

Encode panics if buf length is less than MaxEncodedSize.

See also Decode.

func (PublicKeyRFC6979) MaxEncodedSize

func (x PublicKeyRFC6979) MaxEncodedSize() int

MaxEncodedSize returns size of the compressed ECDSA public key.

func (PublicKeyRFC6979) Verify

func (x PublicKeyRFC6979) Verify(data, signature []byte) bool

Verify verifies data signature calculated by deterministic ECDSA algorithm with SHA-256 hashing.

See also RFC 6979.

type PublicKeyWalletConnect

type PublicKeyWalletConnect ecdsa.PublicKey

PublicKeyWalletConnect is a wrapper over ecdsa.PublicKey used for FrostFS needs. Provides frostfscrypto.PublicKey interface.

Instances MUST be initialized from ecdsa.PublicKey using type conversion.

func (*PublicKeyWalletConnect) Decode

func (x *PublicKeyWalletConnect) Decode(data []byte) error

Decode decodes compressed binary representation of the PublicKeyWalletConnect.

See also Encode.

func (PublicKeyWalletConnect) Encode

func (x PublicKeyWalletConnect) Encode(buf []byte) int

Encode encodes ECDSA public key in compressed form into buf. Uses exactly MaxEncodedSize bytes of the buf.

Encode panics if buf length is less than MaxEncodedSize.

See also Decode.

func (PublicKeyWalletConnect) MaxEncodedSize

func (x PublicKeyWalletConnect) MaxEncodedSize() int

MaxEncodedSize returns size of the compressed ECDSA public key.

func (PublicKeyWalletConnect) Verify

func (x PublicKeyWalletConnect) Verify(data, signature []byte) bool

Verify verifies data signature calculated by ECDSA algorithm with SHA-512 hashing.

type Signer

type Signer ecdsa.PrivateKey

Signer wraps ecdsa.PrivateKey and represents signer based on ECDSA with SHA-512 hashing. Provides frostfscrypto.Signer interface.

Instances MUST be initialized from ecdsa.PrivateKey using type conversion.

func (Signer) Public

func (x Signer) Public() frostfscrypto.PublicKey

Public initializes PublicKey and returns it as frostfscrypto.PublicKey. Implements frostfscrypto.Signer.

func (Signer) Scheme

func (x Signer) Scheme() frostfscrypto.Scheme

Scheme returns frostfscrypto.ECDSA_SHA512. Implements frostfscrypto.Signer.

func (Signer) Sign

func (x Signer) Sign(data []byte) ([]byte, error)

Sign signs data using ECDSA algorithm with SHA-512 hashing. Implements frostfscrypto.Signer.

type SignerRFC6979

type SignerRFC6979 ecdsa.PrivateKey

SignerRFC6979 wraps ecdsa.PrivateKey and represents signer based on deterministic ECDSA with SHA-256 hashing (RFC 6979). Provides frostfscrypto.Signer interface.

Instances SHOULD be initialized from ecdsa.PrivateKey using type conversion.

func (SignerRFC6979) Public

Public initializes PublicKeyRFC6979 and returns it as frostfscrypto.PublicKey. Implements frostfscrypto.Signer.

func (SignerRFC6979) Scheme

func (x SignerRFC6979) Scheme() frostfscrypto.Scheme

Scheme returns frostfscrypto.ECDSA_DETERMINISTIC_SHA256. Implements frostfscrypto.Signer.

func (SignerRFC6979) Sign

func (x SignerRFC6979) Sign(data []byte) ([]byte, error)

Sign signs data using deterministic ECDSA algorithm with SHA-256 hashing. Implements frostfscrypto.Signer.

See also RFC 6979.

type SignerWalletConnect

type SignerWalletConnect ecdsa.PrivateKey

SignerWalletConnect is similar to SignerRFC6979 with 2 changes: 1. The data is base64 encoded before signing/verifying. 2. The signature is a concatenation of the signature itself and 16-byte salt.

Instances MUST be initialized from ecdsa.PrivateKey using type conversion.

func (SignerWalletConnect) Public

Public initializes PublicKey and returns it as frostfscrypto.PublicKey. Implements frostfscrypto.Signer.

func (SignerWalletConnect) Scheme

Scheme returns frostfscrypto.ECDSA_WALLETCONNECT. Implements frostfscrypto.Signer.

func (SignerWalletConnect) Sign

func (x SignerWalletConnect) Sign(data []byte) ([]byte, error)

Sign signs data using ECDSA algorithm with SHA-512 hashing. Implements frostfscrypto.Signer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL