Documentation ¶
Overview ¶
Package neofsecdsa collects ECDSA primitives for NeoFS 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 neofscrypto package.
Package import causes registration of next signature schemes via neofscrypto.RegisterScheme:
- neofscrypto.ECDSA_SHA512
- neofscrypto.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 NeoFS needs. Provides neofscrypto.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 NeoFS needs. Provides neofscrypto.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 NeoFS needs. Provides neofscrypto.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 neofscrypto.Signer interface.
Instances MUST be initialized from ecdsa.PrivateKey using type conversion.
func (Signer) Public ¶
func (x Signer) Public() neofscrypto.PublicKey
Public initializes PublicKey and returns it as neofscrypto.PublicKey. Implements neofscrypto.Signer.
func (Signer) Scheme ¶
func (x Signer) Scheme() neofscrypto.Scheme
Scheme returns neofscrypto.ECDSA_SHA512. Implements neofscrypto.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 neofscrypto.Signer interface.
Instances SHOULD be initialized from ecdsa.PrivateKey using type conversion.
func (SignerRFC6979) Public ¶
func (x SignerRFC6979) Public() neofscrypto.PublicKey
Public initializes PublicKeyRFC6979 and returns it as neofscrypto.PublicKey. Implements neofscrypto.Signer.
func (SignerRFC6979) Scheme ¶
func (x SignerRFC6979) Scheme() neofscrypto.Scheme
Scheme returns neofscrypto.ECDSA_DETERMINISTIC_SHA256. Implements neofscrypto.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() neofscrypto.PublicKey
Public initializes PublicKey and returns it as neofscrypto.PublicKey. Implements neofscrypto.Signer.
func (SignerWalletConnect) Scheme ¶
func (x SignerWalletConnect) Scheme() neofscrypto.Scheme
Scheme returns neofscrypto.ECDSA_WALLETCONNECT. Implements neofscrypto.Signer.