crypto

package
v0.17.6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: AGPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 NewAccountPublicKey

func NewAccountPublicKey(publicKey *runtime.PublicKey,
	hashAlgo sema.HashAlgorithm,
	keyIndex int,
	weight int,
) (*flow.AccountPublicKey, error)

NewAccountPublicKey construct an account public key given a runtime public key.

func NewHasher

func NewHasher(hashAlgo hash.HashingAlgorithm) hash.Hasher

NewHasher returns a crypto hasher supported by runtime.

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 VerifySignatureFromRuntime

func VerifySignatureFromRuntime(
	verifier SignatureVerifier,
	signature []byte,
	rawTag string,
	message []byte,
	rawPublicKey []byte,
	signatureAlgorithm runtime.SignatureAlgorithm,
	hashAlgorithm runtime.HashAlgorithm,
) (bool, error)

VerifySignatureFromRuntime is an adapter that performs signature verification using raw values provided by the Cadence runtime.

Types

type DefaultSignatureVerifier

type DefaultSignatureVerifier struct{}

func NewDefaultSignatureVerifier

func NewDefaultSignatureVerifier() DefaultSignatureVerifier

func (DefaultSignatureVerifier) Verify

func (DefaultSignatureVerifier) Verify(
	signature []byte,
	tag []byte,
	message []byte,
	publicKey crypto.PublicKey,
	hashAlgo hash.HashingAlgorithm,
) (bool, error)

type SignatureVerifier

type SignatureVerifier interface {
	Verify(
		signature []byte,
		tag []byte,
		message []byte,
		publicKey crypto.PublicKey,
		hashAlgo hash.HashingAlgorithm,
	) (bool, error)
}

Jump to

Keyboard shortcuts

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