Documentation
¶
Overview ¶
Package crypt is a wrapper around standard and 3rd party signature algorithms which adds a support of Tezos encodings of keys and signatures
Index ¶
- Variables
- func S256() *secp256k1.KoblitzCurve
- type BLSPrivateKey
- func (priv *BLSPrivateKey) Equal(other PrivateKey) bool
- func (priv *BLSPrivateKey) MarshalText() (text []byte, err error)
- func (priv *BLSPrivateKey) ProvePossession() *BLSSignature
- func (priv *BLSPrivateKey) Public() PublicKey
- func (priv *BLSPrivateKey) Sign(message []byte) (signature Signature, err error)
- func (priv *BLSPrivateKey) SignAugmented(message []byte) (signature Signature, err error)
- func (priv *BLSPrivateKey) ToBase58() []byte
- func (priv *BLSPrivateKey) ToProtocol() tz.PrivateKey
- func (priv *BLSPrivateKey) Unwrap() crypto.PrivateKey
- type BLSPublicKey
- func (pub *BLSPublicKey) Equal(other PublicKey) bool
- func (pub *BLSPublicKey) Hash() PublicKeyHash
- func (pub *BLSPublicKey) MarshalText() (text []byte, err error)
- func (pub *BLSPublicKey) String() string
- func (pub *BLSPublicKey) ToBase58() []byte
- func (pub *BLSPublicKey) ToProtocol() tz.PublicKey
- func (pub *BLSPublicKey) Unwrap() crypto.PublicKey
- func (pub *BLSPublicKey) VerifySignature(sig Signature, message []byte) bool
- func (pub *BLSPublicKey) VerifySignatureAugmented(sig Signature, message []byte) bool
- type BLSSignature
- func (sig *BLSSignature) MarshalText() (text []byte, err error)
- func (sig *BLSSignature) String() string
- func (sig *BLSSignature) ToBase58() []byte
- func (sig *BLSSignature) ToProtocol() tz.Signature
- func (sig *BLSSignature) Verify(pub PublicKey, message []byte) bool
- func (sig *BLSSignature) VerifyAugmented(pub PublicKey, message []byte) bool
- type Digest
- type ECDSAPrivateKey
- func (priv *ECDSAPrivateKey) Equal(other PrivateKey) bool
- func (priv *ECDSAPrivateKey) MarshalText() (text []byte, err error)
- func (priv *ECDSAPrivateKey) Public() PublicKey
- func (priv *ECDSAPrivateKey) Sign(message []byte) (signature Signature, err error)
- func (priv *ECDSAPrivateKey) ToBase58() []byte
- func (priv *ECDSAPrivateKey) ToProtocol() tz.PrivateKey
- func (priv *ECDSAPrivateKey) Unwrap() crypto.PrivateKey
- type ECDSAPublicKey
- func (pub *ECDSAPublicKey) Equal(other PublicKey) bool
- func (pub *ECDSAPublicKey) Hash() PublicKeyHash
- func (pub *ECDSAPublicKey) MarshalText() (text []byte, err error)
- func (pub *ECDSAPublicKey) String() string
- func (pub *ECDSAPublicKey) ToBase58() []byte
- func (pub *ECDSAPublicKey) ToProtocol() tz.PublicKey
- func (pub *ECDSAPublicKey) Unwrap() crypto.PublicKey
- func (pub *ECDSAPublicKey) VerifySignature(sig Signature, message []byte) bool
- type ECDSASignature
- type Ed25519PrivateKey
- func (priv Ed25519PrivateKey) Equal(other PrivateKey) bool
- func (priv Ed25519PrivateKey) MarshalText() (text []byte, err error)
- func (priv Ed25519PrivateKey) Public() PublicKey
- func (priv Ed25519PrivateKey) Seed() []byte
- func (priv Ed25519PrivateKey) Sign(message []byte) (signature Signature, err error)
- func (priv Ed25519PrivateKey) ToBase58() []byte
- func (priv Ed25519PrivateKey) ToProtocol() tz.PrivateKey
- func (priv Ed25519PrivateKey) Unwrap() crypto.PrivateKey
- type Ed25519PublicKey
- func (pub Ed25519PublicKey) Equal(other PublicKey) bool
- func (pub Ed25519PublicKey) Hash() PublicKeyHash
- func (pub Ed25519PublicKey) MarshalText() (text []byte, err error)
- func (pub Ed25519PublicKey) String() string
- func (pub Ed25519PublicKey) ToBase58() []byte
- func (pub Ed25519PublicKey) ToProtocol() tz.PublicKey
- func (pub Ed25519PublicKey) Unwrap() crypto.PublicKey
- func (pub Ed25519PublicKey) VerifySignature(sig Signature, message []byte) bool
- type Ed25519Signature
- type GenericSignature
- type MLDSA44PrivateKey
- func (priv *MLDSA44PrivateKey) Equal(other PrivateKey) bool
- func (priv *MLDSA44PrivateKey) MarshalText() (text []byte, err error)
- func (priv *MLDSA44PrivateKey) Public() PublicKey
- func (priv *MLDSA44PrivateKey) Sign(message []byte) (signature Signature, err error)
- func (priv *MLDSA44PrivateKey) ToBase58() []byte
- func (priv *MLDSA44PrivateKey) ToProtocol() tz.PrivateKey
- func (priv *MLDSA44PrivateKey) Unwrap() crypto.PrivateKey
- type MLDSA44PublicKey
- func (pub *MLDSA44PublicKey) Equal(other PublicKey) bool
- func (pub *MLDSA44PublicKey) Hash() PublicKeyHash
- func (pub *MLDSA44PublicKey) MarshalText() (text []byte, err error)
- func (pub *MLDSA44PublicKey) String() string
- func (pub *MLDSA44PublicKey) ToBase58() []byte
- func (pub *MLDSA44PublicKey) ToProtocol() tz.PublicKey
- func (pub *MLDSA44PublicKey) Unwrap() crypto.PublicKey
- func (pub *MLDSA44PublicKey) VerifySignature(sig Signature, message []byte) bool
- type MLDSA44Signature
- type PrivateKey
- type PublicKey
- type PublicKeyHash
- type Signature
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func S256 ¶ added in v2.2.3
func S256() *secp256k1.KoblitzCurve
Types ¶
type BLSPrivateKey ¶
type BLSPrivateKey minpk.PrivateKey
func (*BLSPrivateKey) Equal ¶
func (priv *BLSPrivateKey) Equal(other PrivateKey) bool
func (*BLSPrivateKey) MarshalText ¶
func (priv *BLSPrivateKey) MarshalText() (text []byte, err error)
func (*BLSPrivateKey) ProvePossession ¶ added in v2.3.4
func (priv *BLSPrivateKey) ProvePossession() *BLSSignature
func (*BLSPrivateKey) Public ¶
func (priv *BLSPrivateKey) Public() PublicKey
func (*BLSPrivateKey) Sign ¶
func (priv *BLSPrivateKey) Sign(message []byte) (signature Signature, err error)
func (*BLSPrivateKey) SignAugmented ¶ added in v2.3.13
func (priv *BLSPrivateKey) SignAugmented(message []byte) (signature Signature, err error)
func (*BLSPrivateKey) ToBase58 ¶
func (priv *BLSPrivateKey) ToBase58() []byte
func (*BLSPrivateKey) ToProtocol ¶
func (priv *BLSPrivateKey) ToProtocol() tz.PrivateKey
func (*BLSPrivateKey) Unwrap ¶
func (priv *BLSPrivateKey) Unwrap() crypto.PrivateKey
type BLSPublicKey ¶
func (*BLSPublicKey) Equal ¶
func (pub *BLSPublicKey) Equal(other PublicKey) bool
func (*BLSPublicKey) Hash ¶
func (pub *BLSPublicKey) Hash() PublicKeyHash
func (*BLSPublicKey) MarshalText ¶
func (pub *BLSPublicKey) MarshalText() (text []byte, err error)
func (*BLSPublicKey) String ¶
func (pub *BLSPublicKey) String() string
func (*BLSPublicKey) ToBase58 ¶
func (pub *BLSPublicKey) ToBase58() []byte
func (*BLSPublicKey) ToProtocol ¶
func (pub *BLSPublicKey) ToProtocol() tz.PublicKey
func (*BLSPublicKey) Unwrap ¶
func (pub *BLSPublicKey) Unwrap() crypto.PublicKey
func (*BLSPublicKey) VerifySignature ¶
func (pub *BLSPublicKey) VerifySignature(sig Signature, message []byte) bool
func (*BLSPublicKey) VerifySignatureAugmented ¶ added in v2.3.13
func (pub *BLSPublicKey) VerifySignatureAugmented(sig Signature, message []byte) bool
type BLSSignature ¶
func (*BLSSignature) MarshalText ¶
func (sig *BLSSignature) MarshalText() (text []byte, err error)
func (*BLSSignature) String ¶
func (sig *BLSSignature) String() string
func (*BLSSignature) ToBase58 ¶
func (sig *BLSSignature) ToBase58() []byte
func (*BLSSignature) ToProtocol ¶
func (sig *BLSSignature) ToProtocol() tz.Signature
func (*BLSSignature) VerifyAugmented ¶ added in v2.3.13
func (sig *BLSSignature) VerifyAugmented(pub PublicKey, message []byte) bool
type ECDSAPrivateKey ¶
type ECDSAPrivateKey ecdsa.PrivateKey
func (*ECDSAPrivateKey) Equal ¶
func (priv *ECDSAPrivateKey) Equal(other PrivateKey) bool
func (*ECDSAPrivateKey) MarshalText ¶
func (priv *ECDSAPrivateKey) MarshalText() (text []byte, err error)
func (*ECDSAPrivateKey) Public ¶
func (priv *ECDSAPrivateKey) Public() PublicKey
func (*ECDSAPrivateKey) Sign ¶
func (priv *ECDSAPrivateKey) Sign(message []byte) (signature Signature, err error)
func (*ECDSAPrivateKey) ToBase58 ¶
func (priv *ECDSAPrivateKey) ToBase58() []byte
func (*ECDSAPrivateKey) ToProtocol ¶
func (priv *ECDSAPrivateKey) ToProtocol() tz.PrivateKey
func (*ECDSAPrivateKey) Unwrap ¶
func (priv *ECDSAPrivateKey) Unwrap() crypto.PrivateKey
type ECDSAPublicKey ¶
func UnmarshalECDSAPublicKey ¶ added in v2.2.2
func UnmarshalECDSAPublicKey(data []byte, curve elliptic.Curve) (*ECDSAPublicKey, error)
func (*ECDSAPublicKey) Equal ¶
func (pub *ECDSAPublicKey) Equal(other PublicKey) bool
func (*ECDSAPublicKey) Hash ¶
func (pub *ECDSAPublicKey) Hash() PublicKeyHash
func (*ECDSAPublicKey) MarshalText ¶
func (pub *ECDSAPublicKey) MarshalText() (text []byte, err error)
func (*ECDSAPublicKey) String ¶
func (pub *ECDSAPublicKey) String() string
func (*ECDSAPublicKey) ToBase58 ¶
func (pub *ECDSAPublicKey) ToBase58() []byte
func (*ECDSAPublicKey) ToProtocol ¶
func (pub *ECDSAPublicKey) ToProtocol() tz.PublicKey
func (*ECDSAPublicKey) Unwrap ¶
func (pub *ECDSAPublicKey) Unwrap() crypto.PublicKey
func (*ECDSAPublicKey) VerifySignature ¶
func (pub *ECDSAPublicKey) VerifySignature(sig Signature, message []byte) bool
type ECDSASignature ¶
func NewECDSASignature ¶ added in v2.3.18
func NewECDSASignature(r, s *big.Int, curve elliptic.Curve) *ECDSASignature
NewECDSASignature creates an ECDSA signature from R, S values and curve. Use this instead of directly constructing ECDSASignature when receiving signatures from external sources (e.g., cloud KMS providers).
func (*ECDSASignature) MarshalText ¶
func (sig *ECDSASignature) MarshalText() (text []byte, err error)
func (*ECDSASignature) String ¶
func (sig *ECDSASignature) String() string
func (*ECDSASignature) ToBase58 ¶
func (sig *ECDSASignature) ToBase58() []byte
func (*ECDSASignature) ToProtocol ¶
func (sig *ECDSASignature) ToProtocol() tz.Signature
type Ed25519PrivateKey ¶
type Ed25519PrivateKey ed25519.PrivateKey
func (Ed25519PrivateKey) Equal ¶
func (priv Ed25519PrivateKey) Equal(other PrivateKey) bool
func (Ed25519PrivateKey) MarshalText ¶
func (priv Ed25519PrivateKey) MarshalText() (text []byte, err error)
func (Ed25519PrivateKey) Public ¶
func (priv Ed25519PrivateKey) Public() PublicKey
func (Ed25519PrivateKey) Seed ¶
func (priv Ed25519PrivateKey) Seed() []byte
func (Ed25519PrivateKey) Sign ¶
func (priv Ed25519PrivateKey) Sign(message []byte) (signature Signature, err error)
func (Ed25519PrivateKey) ToBase58 ¶
func (priv Ed25519PrivateKey) ToBase58() []byte
func (Ed25519PrivateKey) ToProtocol ¶
func (priv Ed25519PrivateKey) ToProtocol() tz.PrivateKey
func (Ed25519PrivateKey) Unwrap ¶
func (priv Ed25519PrivateKey) Unwrap() crypto.PrivateKey
type Ed25519PublicKey ¶
func (Ed25519PublicKey) Equal ¶
func (pub Ed25519PublicKey) Equal(other PublicKey) bool
func (Ed25519PublicKey) Hash ¶
func (pub Ed25519PublicKey) Hash() PublicKeyHash
func (Ed25519PublicKey) MarshalText ¶
func (pub Ed25519PublicKey) MarshalText() (text []byte, err error)
func (Ed25519PublicKey) String ¶
func (pub Ed25519PublicKey) String() string
func (Ed25519PublicKey) ToBase58 ¶
func (pub Ed25519PublicKey) ToBase58() []byte
func (Ed25519PublicKey) ToProtocol ¶
func (pub Ed25519PublicKey) ToProtocol() tz.PublicKey
func (Ed25519PublicKey) Unwrap ¶
func (pub Ed25519PublicKey) Unwrap() crypto.PublicKey
func (Ed25519PublicKey) VerifySignature ¶
func (pub Ed25519PublicKey) VerifySignature(sig Signature, message []byte) bool
type Ed25519Signature ¶
type Ed25519Signature []byte
func NewEd25519Signature ¶
func NewEd25519Signature(sig *tz.Ed25519Signature) Ed25519Signature
func (Ed25519Signature) MarshalText ¶
func (sig Ed25519Signature) MarshalText() (text []byte, err error)
func (Ed25519Signature) String ¶
func (sig Ed25519Signature) String() string
func (Ed25519Signature) ToBase58 ¶
func (sig Ed25519Signature) ToBase58() []byte
func (Ed25519Signature) ToProtocol ¶
func (sig Ed25519Signature) ToProtocol() tz.Signature
type GenericSignature ¶
type GenericSignature tz.GenericSignature
func (*GenericSignature) String ¶
func (sig *GenericSignature) String() string
func (*GenericSignature) ToBase58 ¶
func (sig *GenericSignature) ToBase58() []byte
func (*GenericSignature) ToProtocol ¶
func (sig *GenericSignature) ToProtocol() tz.Signature
type MLDSA44PrivateKey ¶ added in v2.4.0
type MLDSA44PrivateKey mldsa44.PrivateKey
func (*MLDSA44PrivateKey) Equal ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) Equal(other PrivateKey) bool
func (*MLDSA44PrivateKey) MarshalText ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) MarshalText() (text []byte, err error)
func (*MLDSA44PrivateKey) Public ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) Public() PublicKey
func (*MLDSA44PrivateKey) Sign ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) Sign(message []byte) (signature Signature, err error)
func (*MLDSA44PrivateKey) ToBase58 ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) ToBase58() []byte
func (*MLDSA44PrivateKey) ToProtocol ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) ToProtocol() tz.PrivateKey
func (*MLDSA44PrivateKey) Unwrap ¶ added in v2.4.0
func (priv *MLDSA44PrivateKey) Unwrap() crypto.PrivateKey
type MLDSA44PublicKey ¶ added in v2.4.0
func (*MLDSA44PublicKey) Equal ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) Equal(other PublicKey) bool
func (*MLDSA44PublicKey) Hash ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) Hash() PublicKeyHash
func (*MLDSA44PublicKey) MarshalText ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) MarshalText() (text []byte, err error)
func (*MLDSA44PublicKey) String ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) String() string
func (*MLDSA44PublicKey) ToBase58 ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) ToBase58() []byte
func (*MLDSA44PublicKey) ToProtocol ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) ToProtocol() tz.PublicKey
func (*MLDSA44PublicKey) Unwrap ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) Unwrap() crypto.PublicKey
func (*MLDSA44PublicKey) VerifySignature ¶ added in v2.4.0
func (pub *MLDSA44PublicKey) VerifySignature(sig Signature, message []byte) bool
type MLDSA44Signature ¶ added in v2.4.0
type MLDSA44Signature []byte
func (MLDSA44Signature) MarshalText ¶ added in v2.4.0
func (sig MLDSA44Signature) MarshalText() (text []byte, err error)
func (MLDSA44Signature) String ¶ added in v2.4.0
func (sig MLDSA44Signature) String() string
func (MLDSA44Signature) ToBase58 ¶ added in v2.4.0
func (sig MLDSA44Signature) ToBase58() []byte
func (MLDSA44Signature) ToProtocol ¶ added in v2.4.0
func (sig MLDSA44Signature) ToProtocol() tz.Signature
type PrivateKey ¶
type PrivateKey interface {
tz.Base58Encoder
ToProtocol() tz.PrivateKey
Sign(message []byte) (signature Signature, err error)
Public() PublicKey
Equal(PrivateKey) bool
Unwrap() crypto.PrivateKey
}
func NewPrivateKey ¶
func NewPrivateKey(priv tz.PrivateKey) (PrivateKey, error)
func NewPrivateKeyFrom ¶
func NewPrivateKeyFrom(priv crypto.PrivateKey) (PrivateKey, error)
NewPrivateKeyFrom tries to make PrivateKey from a raw one. It returns ErrUnsupportedKeyType if the key is of unsupported type
func ParsePrivateKey ¶
func ParsePrivateKey(src []byte) (PrivateKey, error)
type PublicKey ¶
type PublicKey interface {
tz.Base58Encoder
String() string
ToProtocol() tz.PublicKey
VerifySignature(sig Signature, message []byte) bool
Hash() PublicKeyHash
Equal(PublicKey) bool
Unwrap() crypto.PublicKey
}
func NewPublicKeyFrom ¶
NewPublicKeyFrom tries to make PublicKey from a raw one. It returns ErrUnsupportedKeyType if the key is of unsupported type
func ParsePublicKey ¶
type PublicKeyHash ¶
type PublicKeyHash = tz.PublicKeyHash
type Signature ¶
type Signature interface {
tz.Base58Encoder
String() string
ToProtocol() tz.Signature
Verify(pub PublicKey, message []byte) bool
}
func NewSignatureFromBytes ¶
NewSignatureFromBytes tries to parse signature coming from a third party. It makes an assumption about signature type base on the public key. For ECDSA it expects the signature to be serialized to ASN.1