Documentation ¶
Index ¶
- func AggregatePublicKeys(keys []*runtime.PublicKey) (*runtime.PublicKey, error)
- func AggregateSignatures(sigs [][]byte) (crypto.Signature, error)
- func CryptoToRuntimeHashingAlgorithm(h hash.HashingAlgorithm) runtime.HashAlgorithm
- func CryptoToRuntimeSigningAlgorithm(s crypto.SigningAlgorithm) runtime.SignatureAlgorithm
- func HashWithTag(hashAlgo hash.HashingAlgorithm, tag string, data []byte) ([]byte, error)
- func NewPrefixedHashing(algo hash.HashingAlgorithm, tag string) (hash.Hasher, error)
- func RuntimeToCryptoHashingAlgorithm(s runtime.HashAlgorithm) hash.HashingAlgorithm
- func RuntimeToCryptoSigningAlgorithm(s runtime.SignatureAlgorithm) crypto.SigningAlgorithm
- func ValidatePublicKey(signAlgo runtime.SignatureAlgorithm, pk []byte) error
- func VerifyPOP(pk *runtime.PublicKey, s crypto.Signature) (bool, error)
- func VerifySignatureFromRuntime(signature []byte, tag string, message []byte, rawPublicKey []byte, ...) (bool, error)
- func VerifySignatureFromTransaction(signature []byte, message []byte, pk crypto.PublicKey, ...) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregatePublicKeys ¶ added in v0.25.0
AggregatePublicKeys aggregate multiple public keys into one; currently only works for BLS
func AggregateSignatures ¶ added in v0.25.0
AggregateSignatures aggregate multiple signatures into one; currently only works for BLS
func CryptoToRuntimeHashingAlgorithm ¶
func CryptoToRuntimeHashingAlgorithm(h hash.HashingAlgorithm) runtime.HashAlgorithm
CryptoToRuntimeHashingAlgorithm converts a crypto hashing algorithm to a runtime hash algorithm.
func CryptoToRuntimeSigningAlgorithm ¶
func CryptoToRuntimeSigningAlgorithm(s crypto.SigningAlgorithm) runtime.SignatureAlgorithm
CryptoToRuntimeSigningAlgorithm converts a crypto signature algorithm to a runtime signature algorithm.
func HashWithTag ¶ added in v0.18.0
func NewPrefixedHashing ¶ added in v0.18.0
NewPrefixedHashing returns a new hasher that prefixes the tag for all hash computations (only when tag is not empty).
Supported algorithms are SHA2-256, SHA2-384, SHA3-256, SHA3-384 and Keccak256.
func RuntimeToCryptoHashingAlgorithm ¶
func RuntimeToCryptoHashingAlgorithm(s runtime.HashAlgorithm) hash.HashingAlgorithm
RuntimeToCryptoHashingAlgorithm converts a runtime hash algorithm to a crypto hashing algorithm.
func RuntimeToCryptoSigningAlgorithm ¶
func RuntimeToCryptoSigningAlgorithm(s runtime.SignatureAlgorithm) crypto.SigningAlgorithm
RuntimeToCryptoSigningAlgorithm converts a runtime signature algorithm to a crypto signature algorithm.
func ValidatePublicKey ¶ added in v0.18.0
func ValidatePublicKey(signAlgo runtime.SignatureAlgorithm, pk []byte) error
ValidatePublicKey returns : - nil if key is valid and no exception occurred. - crypto.invalidInputsError if key is invalid and no exception occurred. - panics if an exception occurred.
func VerifyPOP ¶ added in v0.25.0
VerifyPOP verifies a proof of possession (PoP) for the receiver public key; currently only works for BLS
func VerifySignatureFromRuntime ¶
func VerifySignatureFromRuntime( signature []byte, tag string, message []byte, rawPublicKey []byte, signatureAlgorithm runtime.SignatureAlgorithm, hashAlgorithm runtime.HashAlgorithm, ) (bool, error)
VerifySignatureFromRuntime performs signature verification using raw values provided by the Cadence runtime.
The signature/hash function combinations accepted are:
- ECDSA (on both curves P-256 and secp256k1) with any of SHA2-256/SHA3-256/Keccak256.
- BLS (on BLS12-381 curve) with the specific KMAC128 for BLS.
The tag is applied to the message depending on the hash function used.
The function errors:
- NewValueErrorf for any user error
- panic for any other unexpected error
func VerifySignatureFromTransaction ¶ added in v0.26.0
func VerifySignatureFromTransaction( signature []byte, message []byte, pk crypto.PublicKey, hashAlgo hash.HashingAlgorithm, ) (bool, error)
VerifySignatureFromRuntime performs signature verification using raw values provided by the Cadence runtime.
The signature/hash function combinations accepted are:
- ECDSA (on both curves P-256 and secp256k1) with any of SHA2-256/SHA3-256.
The tag is applied to the message as a constant length prefix.
The function errors:
- NewValueErrorf for any user error
- panic for any other unexpected error
Types ¶
This section is empty.