Documentation
¶
Overview ¶
Package crypto is a generated protocol buffer package.
It is generated from these files:
encode.proto
It has these top-level messages:
PBPublicKey PBPrivateKey
Index ¶
- Constants
- Variables
- func GenerateKeyPair(typ, bits int) (PrivKey, PubKey, error)
- func KeyEqual(k1, k2 Key) bool
- func KeyStretcher(cmp int, cipherType string, hashType string, secret []byte) ([]byte, []byte, []byte, []byte, []byte, []byte)
- type GenSharedKey
- type Key
- type KeyType
- type PBPrivateKey
- type PBPublicKey
- type PrivKey
- type PubKey
- type RsaPrivateKey
- type RsaPublicKey
Constants ¶
View Source
const (
RSA = iota
)
Variables ¶
View Source
var ErrBadKeyType = errors.New("invalid or unsupported key type")
View Source
var KeyType_name = map[int32]string{
0: "RSA",
}
View Source
var KeyType_value = map[string]int32{
"RSA": 0,
}
Functions ¶
Types ¶
type GenSharedKey ¶
Given a public key, generates the shared key.
func GenerateEKeyPair ¶
func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error)
Generates an ephemeral public key and returns a function that will compute the shared secret key. Used in the identify module.
Focuses only on ECDH now, but can be made more general in the future.
type PBPrivateKey ¶
type PBPrivateKey struct { Type *KeyType `protobuf:"varint,1,req,enum=crypto.KeyType" json:"Type,omitempty"` Data []byte `protobuf:"bytes,2,req" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*PBPrivateKey) GetData ¶
func (m *PBPrivateKey) GetData() []byte
func (*PBPrivateKey) GetType ¶
func (m *PBPrivateKey) GetType() KeyType
func (*PBPrivateKey) ProtoMessage ¶
func (*PBPrivateKey) ProtoMessage()
func (*PBPrivateKey) Reset ¶
func (m *PBPrivateKey) Reset()
func (*PBPrivateKey) String ¶
func (m *PBPrivateKey) String() string
type PBPublicKey ¶
type PBPublicKey struct { Type *KeyType `protobuf:"varint,1,req,enum=crypto.KeyType" json:"Type,omitempty"` Data []byte `protobuf:"bytes,2,req" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*PBPublicKey) GetData ¶
func (m *PBPublicKey) GetData() []byte
func (*PBPublicKey) GetType ¶
func (m *PBPublicKey) GetType() KeyType
func (*PBPublicKey) ProtoMessage ¶
func (*PBPublicKey) ProtoMessage()
func (*PBPublicKey) Reset ¶
func (m *PBPublicKey) Reset()
func (*PBPublicKey) String ¶
func (m *PBPublicKey) String() string
type PrivKey ¶
type PrivKey interface { Key // Cryptographically sign the given bytes Sign([]byte) ([]byte, error) // Return a public key paired with this private key GetPublic() PubKey // Generate a secret string of bytes GenSecret() []byte }
func UnmarshalPrivateKey ¶
type PubKey ¶
type PubKey interface { Key // Verify that 'sig' is the signed hash of 'data' Verify(data []byte, sig []byte) (bool, error) }
func UnmarshalPublicKey ¶
type RsaPrivateKey ¶
type RsaPrivateKey struct {
// contains filtered or unexported fields
}
func UnmarshalRsaPrivateKey ¶
func UnmarshalRsaPrivateKey(b []byte) (*RsaPrivateKey, error)
func (*RsaPrivateKey) Bytes ¶
func (sk *RsaPrivateKey) Bytes() ([]byte, error)
func (*RsaPrivateKey) Equals ¶
func (sk *RsaPrivateKey) Equals(k Key) bool
Equals checks whether this key is equal to another
func (*RsaPrivateKey) GenSecret ¶
func (sk *RsaPrivateKey) GenSecret() []byte
func (*RsaPrivateKey) GetPublic ¶
func (sk *RsaPrivateKey) GetPublic() PubKey
type RsaPublicKey ¶
type RsaPublicKey struct {
// contains filtered or unexported fields
}
func UnmarshalRsaPublicKey ¶
func UnmarshalRsaPublicKey(b []byte) (*RsaPublicKey, error)
func (*RsaPublicKey) Bytes ¶
func (pk *RsaPublicKey) Bytes() ([]byte, error)
func (*RsaPublicKey) Equals ¶
func (pk *RsaPublicKey) Equals(k Key) bool
Equals checks whether this key is equal to another
Click to show internal directories.
Click to hide internal directories.