Documentation ¶
Index ¶
- Constants
- func RecoverSecp256PublicKey(cert *x509.Certificate) ([]byte, error)
- func RsaPrivateKeyToSecp256PrivateKey(rPrivKey *rsa.PrivateKey) *secp256k1.PrivateKey
- func SignRsaPublicKey(privKey *secp256k1.PrivateKey, pubKey *rsa.PublicKey) *pkix.Extension
- type Factory
- func (*Factory) NewPrivateKey() (*PrivateKey, error)
- func (f *Factory) RecoverHashPublicKey(hash, sig []byte) (*PublicKey, error)
- func (f *Factory) RecoverPublicKey(msg, sig []byte) (*PublicKey, error)
- func (*Factory) ToPrivateKey(b []byte) (*PrivateKey, error)
- func (*Factory) ToPublicKey(b []byte) (*PublicKey, error)
- type PrivateKey
- func (k *PrivateKey) Address() ids.ShortID
- func (k *PrivateKey) Bytes() []byte
- func (k *PrivateKey) IsZero() bool
- func (k *PrivateKey) MarshalJSON() ([]byte, error)
- func (k *PrivateKey) MarshalText() ([]byte, error)
- func (k *PrivateKey) PublicKey() *PublicKey
- func (k *PrivateKey) Sign(msg []byte) ([]byte, error)
- func (k *PrivateKey) SignHash(hash []byte) ([]byte, error)
- func (k *PrivateKey) String() string
- func (k *PrivateKey) ToECDSA() *stdecdsa.PrivateKey
- func (k *PrivateKey) UnmarshalJSON(b []byte) error
- func (k *PrivateKey) UnmarshalText(text []byte) error
- type PublicKey
Constants ¶
View Source
const ( // SignatureLen is the number of bytes in a secp2561k recoverable signature SignatureLen = 65 // PrivateKeyLen is the number of bytes in a secp2561k recoverable private // key PrivateKeyLen = 32 // PublicKeyLen is the number of bytes in a secp2561k recoverable public key PublicKeyLen = 33 PrivateKeyPrefix = "PrivateKey-" )
Variables ¶
This section is empty.
Functions ¶
func RecoverSecp256PublicKey ¶
func RecoverSecp256PublicKey(cert *x509.Certificate) ([]byte, error)
Recover the secp256k1 public key using RSA public key and the signature This is the reverse what has been done in RsaPrivateKeyToSecp256PrivateKey It returns the marshalled public key
func RsaPrivateKeyToSecp256PrivateKey ¶
func RsaPrivateKeyToSecp256PrivateKey(rPrivKey *rsa.PrivateKey) *secp256k1.PrivateKey
Takes a RSA privateKey and builds using it's hash an secp256k1 private key.
func SignRsaPublicKey ¶
Sign a rsa public key with the given secp256k1 private key and return a x509 Extension. The secp256k1 public key can be recovered for e.g. nodeId
Types ¶
type Factory ¶
func (*Factory) NewPrivateKey ¶
func (*Factory) NewPrivateKey() (*PrivateKey, error)
func (*Factory) RecoverHashPublicKey ¶
func (*Factory) RecoverPublicKey ¶
func (*Factory) ToPrivateKey ¶
func (*Factory) ToPrivateKey(b []byte) (*PrivateKey, error)
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func FakePrivateKey ¶
func FakePrivateKey(addr ids.ShortID) *PrivateKey
func TestKeys ¶
func TestKeys() []*PrivateKey
func (*PrivateKey) Address ¶
func (k *PrivateKey) Address() ids.ShortID
func (*PrivateKey) Bytes ¶
func (k *PrivateKey) Bytes() []byte
func (*PrivateKey) IsZero ¶
func (k *PrivateKey) IsZero() bool
IsFakeKey returns true if sk's key is zero
func (*PrivateKey) MarshalJSON ¶
func (k *PrivateKey) MarshalJSON() ([]byte, error)
func (*PrivateKey) MarshalText ¶
func (k *PrivateKey) MarshalText() ([]byte, error)
func (*PrivateKey) PublicKey ¶
func (k *PrivateKey) PublicKey() *PublicKey
func (*PrivateKey) String ¶
func (k *PrivateKey) String() string
func (*PrivateKey) ToECDSA ¶
func (k *PrivateKey) ToECDSA() *stdecdsa.PrivateKey
ToECDSA returns the ecdsa representation of this private key
func (*PrivateKey) UnmarshalJSON ¶
func (k *PrivateKey) UnmarshalJSON(b []byte) error
func (*PrivateKey) UnmarshalText ¶
func (k *PrivateKey) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.