Documentation ¶
Overview ¶
Package neofscrypto collects common cryptographic primitives used in NeoFS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sign ¶
Sign reads signed data from source (SRC), calculates signature (S) via Signer, and passes (S) into parameterized (SH).
If (KH) is proved, signer's public key is marshaled and passed into it. If MarshalBinary returns an error, it is ignored w/o handler call.
Panics if SRC is nil. Panics if SH is nil.
Types ¶
type PublicKey ¶
type PublicKey interface { // Verify checks if signature calculated from // the data via corresponding Signer is correct. Verify(data, signature []byte) bool // Binary format for network transmission. encoding.BinaryMarshaler encoding.BinaryUnmarshaler }
PublicKey represents a public key using a particular algorithm.
type SignPrm ¶
type SignPrm struct {
// contains filtered or unexported fields
}
SignPrm groups the parameters of Sign operation.
Required parameters:
- data source (SRC);
- signature handler (SH).
func (*SignPrm) SetDataSource ¶
func (x *SignPrm) SetDataSource(f DataSource)
SetDataSource sets signed data source (SRC).
The parameter is required and should not be nil.
func (*SignPrm) SetSignatureHandler ¶
func (x *SignPrm) SetSignatureHandler(f BytesHandler)
SetSignatureHandler sets handler of the calculated signature (SH).
The parameter is required and should not be nil.
func (*SignPrm) WrapSignedDataHandler ¶
func (x *SignPrm) WrapSignedDataHandler(f BytesHandler)
WrapSignedDataHandler wraps handler of the signed data buffer. If some handler is already wrapped, it will be called before f.
If provided, all wrapped handlers are called right after the signature is calculated.
type Signer ¶
type Signer interface { // Sign signs data with the private key. Sign(data []byte) ([]byte, error) // Public returns the public key corresponding to the Signer. Public() PublicKey }
Signer is an interface for an opaque private key that can be used for signing operations. It is an adaptation of crypto.Signer to the needs of NeoFS.
type VerifyPrm ¶
type VerifyPrm struct {
// contains filtered or unexported fields
}
VerifyPrm groups the parameters of Verify operation.
Required parameters:
- data source (SRC);
- signature (S).
func (*VerifyPrm) SetDataSource ¶
func (x *VerifyPrm) SetDataSource(f DataSource)
SetDataSource sets signed data source (SRC).
The parameter is required and should not be nil.
func (*VerifyPrm) SetSignature ¶
SetSignature sets signature to check (S).
(S) should not be modified before the end of the Verify call.
func (*VerifyPrm) WrapSignedDataHandler ¶
func (x *VerifyPrm) WrapSignedDataHandler(f BytesHandler)
WrapSignedDataHandler wraps handler of the signed data buffer. If some handler is already wrapped, it will be called before f.
If provided, all wrapped handlers are called right after the signature is calculated.
Directories ¶
Path | Synopsis |
---|---|
Package cryptoalgo provides functionality for working with various cryptographic signature algorithms.
|
Package cryptoalgo provides functionality for working with various cryptographic signature algorithms. |
Package neofsecdsa provides ECDSA implementations of neofscrypto elements.
|
Package neofsecdsa provides ECDSA implementations of neofscrypto elements. |
Package cryprotobuf provides elements for working with Protocol Buffers format data.
|
Package cryprotobuf provides elements for working with Protocol Buffers format data. |
Package neofsrfc6979 provides RFC 6979's deterministic DSA implementations of neofscrypto elements.
|
Package neofsrfc6979 provides RFC 6979's deterministic DSA implementations of neofscrypto elements. |
Package neofscryptotest provides a set of helper functions that can make testing easier.
|
Package neofscryptotest provides a set of helper functions that can make testing easier. |
Package cryptoutil provides the utilities abstract utilities that can be used in NeoFS cryptography.
|
Package cryptoutil provides the utilities abstract utilities that can be used in NeoFS cryptography. |