cryptography

package
v0.0.0-...-a5ce5ae Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPublicKey         = errors.New("invalid public key")
	ErrInvalidPublicKeyLength   = errors.New("invalid public key length")
	ErrInvalidPublicKeyType     = errors.New("invalid public key type")
	ErrUnsupportedPublicKeyType = errors.New("unsupported public key type")
)

Functions

func AggregateBls12381PublicKeys

func AggregateBls12381PublicKeys(pk ...*Bls12381PublicKey) kyber.Point

func AggregateBls12381Signatures

func AggregateBls12381Signatures(sigs ...[]byte) ([]byte, error)

func EncodeMultibase

func EncodeMultibase(publicKey crypto.PublicKey) (string, error)

func ValidateBls12381

func ValidateBls12381(vm VerificationMethod, signature []byte, msg []byte) (bool, error)

func ValidateEcdsaSecp256k1

func ValidateEcdsaSecp256k1(vm VerificationMethod, signature []byte, msg []byte) (bool, error)

func ValidateEd25519

func ValidateEd25519(vm VerificationMethod, sig []byte, msg []byte) (bool, error)

Types

type Bls12381PrivateKey

type Bls12381PrivateKey struct {
	// contains filtered or unexported fields
}

func NewBls12381PrivateKey

func NewBls12381PrivateKey() *Bls12381PrivateKey

func NewBls12391PrivateKeyFromBytes

func NewBls12391PrivateKeyFromBytes(b []byte) (*Bls12381PrivateKey, error)

func (*Bls12381PrivateKey) Bytes

func (b *Bls12381PrivateKey) Bytes() ([]byte, error)

func (*Bls12381PrivateKey) Equal

func (b *Bls12381PrivateKey) Equal(obls crypto.PrivateKey) bool

func (*Bls12381PrivateKey) Public

func (b *Bls12381PrivateKey) Public() crypto.PublicKey

func (*Bls12381PrivateKey) Sign

func (b *Bls12381PrivateKey) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) (signature []byte, err error)

type Bls12381PublicKey

type Bls12381PublicKey struct {
	kyber.Point
}

func NewBls12381PublicKey

func NewBls12381PublicKey(d []byte) (*Bls12381PublicKey, error)

func (*Bls12381PublicKey) Bytes

func (b *Bls12381PublicKey) Bytes() ([]byte, error)

func (*Bls12381PublicKey) Verify

func (b *Bls12381PublicKey) Verify(signature, msg []byte) (bool, error)

type JWK

type JWK = jose.JSONWebKey

type Secp256k1PrivateKey

type Secp256k1PrivateKey struct {
	*ecdsa.PrivateKey
}

func NewEcdsaSecp256k1PrivateKey

func NewEcdsaSecp256k1PrivateKey() (*Secp256k1PrivateKey, error)

func (*Secp256k1PrivateKey) Bytes

func (p *Secp256k1PrivateKey) Bytes() ([]byte, error)

func (*Secp256k1PrivateKey) Public

func (p *Secp256k1PrivateKey) Public() crypto.PublicKey

func (*Secp256k1PrivateKey) Sign

func (p *Secp256k1PrivateKey) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) ([]byte, error)

type Secp256k1PublicKey

type Secp256k1PublicKey struct {
	ecdsa.PublicKey
}

func NewSecp256k1PublicKey

func NewSecp256k1PublicKey(d []byte) (*Secp256k1PublicKey, error)

func (*Secp256k1PublicKey) Bytes

func (p *Secp256k1PublicKey) Bytes() ([]byte, error)

func (*Secp256k1PublicKey) Verify

func (p *Secp256k1PublicKey) Verify(sig, msg []byte) (bool, error)

type VerificationMethod

type VerificationMethod struct {
	ID                 string                 `json:"id"`
	Type               VerificationMethodType `json:"type"`
	Controller         string                 `json:"controller"`
	PublicKeyJwk       *JWK                   `json:"publicKeyJwk,omitempty"`
	PublicKeyMultibase string                 `json:"publicKeyMultibase,omitempty"`
}

type VerificationMethodType

type VerificationMethodType string
const (
	Bls12381G1Key2020                 VerificationMethodType = "Bls12381G1Key2020"
	Bls12381G2Key2020                 VerificationMethodType = "Bls12381G2Key2020"
	EcdsaSecp256k1RecoveryMethod2020  VerificationMethodType = "EcdsaSecp256k1RecoveryMethod2020"
	EcdsaSecp256k1VerificationKey2019 VerificationMethodType = "EcdsaSecp256k1VerificationKey2019"
	Ed25519VerificationKey2018        VerificationMethodType = "Ed25519VerificationKey2018"
	JsonWebKey2020                    VerificationMethodType = "JsonWebKey2020"
	PgpVerificationkey2021            VerificationMethodType = "PgpVerificationkey2021"
	RsaVerificationKey2018            VerificationMethodType = "RsaVerificationKey2018"
	Verificationcondition2021         VerificationMethodType = "Verificationcondition2021"
	X25519KeyAgreementKey2019         VerificationMethodType = "X25519KeyAgreementKey2019"
)

Jump to

Keyboard shortcuts

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