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 ¶
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 ¶
Decode decodes compressed binary representation of the PublicKey.
See also Encode.
func (PublicKey) Encode ¶
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 ¶
MaxEncodedSize returns size of the compressed ECDSA public key.
type PublicKeyRFC6979 ¶
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.
type PublicKeyWalletConnect ¶
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.
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 ¶
func (x SignerRFC6979) Public() frostfscrypto.PublicKey
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.
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 ¶
func (x SignerWalletConnect) Public() frostfscrypto.PublicKey
Public initializes PublicKey and returns it as frostfscrypto.PublicKey. Implements frostfscrypto.Signer.
func (SignerWalletConnect) Scheme ¶
func (x SignerWalletConnect) Scheme() frostfscrypto.Scheme
Scheme returns frostfscrypto.ECDSA_WALLETCONNECT. Implements frostfscrypto.Signer.