Documentation ¶
Index ¶
- Constants
- Variables
- func IsSortedAndUniqueSECP2561RSigs(sigs [][SECP256K1RSigLen]byte) bool
- func SortSECP2561RSigs(lst [][SECP256K1RSigLen]byte)
- type Factory
- type FactoryED25519
- type FactoryRSA
- type FactoryRSAPSS
- type FactorySECP256K1R
- func (*FactorySECP256K1R) NewPrivateKey() (PrivateKey, error)
- func (f *FactorySECP256K1R) RecoverHashPublicKey(hash, sig []byte) (PublicKey, error)
- func (f *FactorySECP256K1R) RecoverPublicKey(msg, sig []byte) (PublicKey, error)
- func (*FactorySECP256K1R) ToPrivateKey(b []byte) (PrivateKey, error)
- func (*FactorySECP256K1R) ToPublicKey(b []byte) (PublicKey, error)
- type PrivateKey
- type PrivateKeyED25519
- type PrivateKeyRSA
- type PrivateKeyRSAPSS
- type PrivateKeySECP256K1R
- type PublicKey
- type PublicKeyED25519
- type PublicKeyRSA
- type PublicKeyRSAPSS
- type PublicKeySECP256K1R
- type RecoverableFactory
Constants ¶
const ( // SECP256K1RSigLen is the number of bytes in a secp2561k recoverable // signature SECP256K1RSigLen = 65 // SECP256K1RSKLen is the number of bytes in a secp2561k recoverable private // key SECP256K1RSKLen = 32 // SECP256K1RPKLen is the number of bytes in a secp2561k recoverable public // key SECP256K1RPKLen = 33 )
Variables ¶
var EnableCrypto = true
EnableCrypto ... TODO: Remove this from this package, this should be in a config file
Functions ¶
func IsSortedAndUniqueSECP2561RSigs ¶
func IsSortedAndUniqueSECP2561RSigs(sigs [][SECP256K1RSigLen]byte) bool
IsSortedAndUniqueSECP2561RSigs returns true if [sigs] is sorted
func SortSECP2561RSigs ¶
func SortSECP2561RSigs(lst [][SECP256K1RSigLen]byte)
SortSECP2561RSigs sorts a slice of SECP2561R signatures
Types ¶
type Factory ¶
type Factory interface { NewPrivateKey() (PrivateKey, error) ToPublicKey([]byte) (PublicKey, error) ToPrivateKey([]byte) (PrivateKey, error) }
Factory ...
type FactoryED25519 ¶
type FactoryED25519 struct{}
FactoryED25519 ...
func (*FactoryED25519) NewPrivateKey ¶
func (*FactoryED25519) NewPrivateKey() (PrivateKey, error)
NewPrivateKey implements the Factory interface
func (*FactoryED25519) ToPrivateKey ¶
func (*FactoryED25519) ToPrivateKey(b []byte) (PrivateKey, error)
ToPrivateKey implements the Factory interface
func (*FactoryED25519) ToPublicKey ¶
func (*FactoryED25519) ToPublicKey(b []byte) (PublicKey, error)
ToPublicKey implements the Factory interface
type FactoryRSA ¶
type FactoryRSA struct{}
FactoryRSA ...
func (*FactoryRSA) NewPrivateKey ¶
func (*FactoryRSA) NewPrivateKey() (PrivateKey, error)
NewPrivateKey implements the Factory interface
func (*FactoryRSA) ToPrivateKey ¶
func (*FactoryRSA) ToPrivateKey(b []byte) (PrivateKey, error)
ToPrivateKey implements the Factory interface
func (*FactoryRSA) ToPublicKey ¶
func (*FactoryRSA) ToPublicKey(b []byte) (PublicKey, error)
ToPublicKey implements the Factory interface
type FactoryRSAPSS ¶
type FactoryRSAPSS struct{}
FactoryRSAPSS ...
func (*FactoryRSAPSS) NewPrivateKey ¶
func (*FactoryRSAPSS) NewPrivateKey() (PrivateKey, error)
NewPrivateKey implements the Factory interface
func (*FactoryRSAPSS) ToPrivateKey ¶
func (*FactoryRSAPSS) ToPrivateKey(b []byte) (PrivateKey, error)
ToPrivateKey implements the Factory interface
func (*FactoryRSAPSS) ToPublicKey ¶
func (*FactoryRSAPSS) ToPublicKey(b []byte) (PublicKey, error)
ToPublicKey implements the Factory interface
type FactorySECP256K1R ¶
FactorySECP256K1R ...
func (*FactorySECP256K1R) NewPrivateKey ¶
func (*FactorySECP256K1R) NewPrivateKey() (PrivateKey, error)
NewPrivateKey implements the Factory interface
func (*FactorySECP256K1R) RecoverHashPublicKey ¶
func (f *FactorySECP256K1R) RecoverHashPublicKey(hash, sig []byte) (PublicKey, error)
RecoverHashPublicKey returns the public key from a 65 byte signature
func (*FactorySECP256K1R) RecoverPublicKey ¶
func (f *FactorySECP256K1R) RecoverPublicKey(msg, sig []byte) (PublicKey, error)
RecoverPublicKey returns the public key from a 65 byte signature
func (*FactorySECP256K1R) ToPrivateKey ¶
func (*FactorySECP256K1R) ToPrivateKey(b []byte) (PrivateKey, error)
ToPrivateKey implements the Factory interface
func (*FactorySECP256K1R) ToPublicKey ¶
func (*FactorySECP256K1R) ToPublicKey(b []byte) (PublicKey, error)
ToPublicKey implements the Factory interface
type PrivateKey ¶
type PrivateKey interface { PublicKey() PublicKey Sign(message []byte) ([]byte, error) SignHash(hash []byte) ([]byte, error) Bytes() []byte }
PrivateKey ...
type PrivateKeyED25519 ¶
type PrivateKeyED25519 struct {
// contains filtered or unexported fields
}
PrivateKeyED25519 ...
func (PrivateKeyED25519) Bytes ¶
func (k PrivateKeyED25519) Bytes() []byte
Bytes implements the PrivateKey interface
func (*PrivateKeyED25519) PublicKey ¶
func (k *PrivateKeyED25519) PublicKey() PublicKey
PublicKey implements the PrivateKey interface
type PrivateKeyRSA ¶
type PrivateKeyRSA struct {
// contains filtered or unexported fields
}
PrivateKeyRSA ...
func (*PrivateKeyRSA) Bytes ¶
func (k *PrivateKeyRSA) Bytes() []byte
Bytes implements the PrivateKey interface
func (*PrivateKeyRSA) PublicKey ¶
func (k *PrivateKeyRSA) PublicKey() PublicKey
PublicKey implements the PrivateKey interface
type PrivateKeyRSAPSS ¶
type PrivateKeyRSAPSS struct {
// contains filtered or unexported fields
}
PrivateKeyRSAPSS ...
func (*PrivateKeyRSAPSS) Bytes ¶
func (k *PrivateKeyRSAPSS) Bytes() []byte
Bytes implements the PrivateKey interface
func (*PrivateKeyRSAPSS) PublicKey ¶
func (k *PrivateKeyRSAPSS) PublicKey() PublicKey
PublicKey implements the PrivateKey interface
type PrivateKeySECP256K1R ¶
type PrivateKeySECP256K1R struct {
// contains filtered or unexported fields
}
PrivateKeySECP256K1R ...
func (*PrivateKeySECP256K1R) Bytes ¶
func (k *PrivateKeySECP256K1R) Bytes() []byte
Bytes implements the PrivateKey interface
func (*PrivateKeySECP256K1R) PublicKey ¶
func (k *PrivateKeySECP256K1R) PublicKey() PublicKey
PublicKey implements the PrivateKey interface
func (*PrivateKeySECP256K1R) Sign ¶
func (k *PrivateKeySECP256K1R) Sign(msg []byte) ([]byte, error)
Sign implements the PrivateKey interface
func (*PrivateKeySECP256K1R) SignHash ¶
func (k *PrivateKeySECP256K1R) SignHash(hash []byte) ([]byte, error)
SignHash implements the PrivateKey interface
func (*PrivateKeySECP256K1R) ToECDSA ¶
func (k *PrivateKeySECP256K1R) ToECDSA() *stdecdsa.PrivateKey
ToECDSA returns the ecdsa representation of this private key
type PublicKey ¶
type PublicKey interface { Verify(message, signature []byte) bool VerifyHash(hash, signature []byte) bool Address() ids.ShortID Bytes() []byte }
PublicKey ...
type PublicKeyED25519 ¶
type PublicKeyED25519 struct {
// contains filtered or unexported fields
}
PublicKeyED25519 ...
func (*PublicKeyED25519) Address ¶
func (k *PublicKeyED25519) Address() ids.ShortID
Address implements the PublicKey interface
func (*PublicKeyED25519) Bytes ¶
func (k *PublicKeyED25519) Bytes() []byte
Bytes implements the PublicKey interface
func (*PublicKeyED25519) Verify ¶
func (k *PublicKeyED25519) Verify(msg, sig []byte) bool
Verify implements the PublicKey interface
func (*PublicKeyED25519) VerifyHash ¶
func (k *PublicKeyED25519) VerifyHash(hash, sig []byte) bool
VerifyHash implements the PublicKey interface
type PublicKeyRSA ¶
type PublicKeyRSA struct {
// contains filtered or unexported fields
}
PublicKeyRSA ...
func (*PublicKeyRSA) Address ¶
func (k *PublicKeyRSA) Address() ids.ShortID
Address implements the PublicKey interface
func (*PublicKeyRSA) Bytes ¶
func (k *PublicKeyRSA) Bytes() []byte
Bytes implements the PublicKey interface
func (*PublicKeyRSA) Verify ¶
func (k *PublicKeyRSA) Verify(msg, sig []byte) bool
Verify implements the PublicKey interface
func (*PublicKeyRSA) VerifyHash ¶
func (k *PublicKeyRSA) VerifyHash(hash, sig []byte) bool
VerifyHash implements the PublicKey interface
type PublicKeyRSAPSS ¶
type PublicKeyRSAPSS struct {
// contains filtered or unexported fields
}
PublicKeyRSAPSS ...
func (*PublicKeyRSAPSS) Address ¶
func (k *PublicKeyRSAPSS) Address() ids.ShortID
Address implements the PublicKey interface
func (*PublicKeyRSAPSS) Bytes ¶
func (k *PublicKeyRSAPSS) Bytes() []byte
Bytes implements the PublicKey interface
func (*PublicKeyRSAPSS) Verify ¶
func (k *PublicKeyRSAPSS) Verify(msg, sig []byte) bool
Verify implements the PublicKey interface
func (*PublicKeyRSAPSS) VerifyHash ¶
func (k *PublicKeyRSAPSS) VerifyHash(hash, sig []byte) bool
VerifyHash implements the PublicKey interface
type PublicKeySECP256K1R ¶
type PublicKeySECP256K1R struct {
// contains filtered or unexported fields
}
PublicKeySECP256K1R ...
func (*PublicKeySECP256K1R) Address ¶
func (k *PublicKeySECP256K1R) Address() ids.ShortID
Address implements the PublicKey interface
func (*PublicKeySECP256K1R) Bytes ¶
func (k *PublicKeySECP256K1R) Bytes() []byte
Bytes implements the PublicKey interface
func (*PublicKeySECP256K1R) ToECDSA ¶
func (k *PublicKeySECP256K1R) ToECDSA() *stdecdsa.PublicKey
ToECDSA returns the ecdsa representation of this public key
func (*PublicKeySECP256K1R) Verify ¶
func (k *PublicKeySECP256K1R) Verify(msg, sig []byte) bool
Verify implements the PublicKey interface
func (*PublicKeySECP256K1R) VerifyHash ¶
func (k *PublicKeySECP256K1R) VerifyHash(hash, sig []byte) bool
VerifyHash implements the PublicKey interface