Documentation ¶
Overview ¶
Package encryption contains the encryption API.
Index ¶
- func VerifyECDSAKey(v *ECDSAKey) error
- func VerifyEd25519Key(v *Ed25519Key) error
- func VerifyRSAKey(v *RSAKey) error
- type ECDSAKey
- type Ed25519Key
- func (k *Ed25519Key) MarshalAllData() (*data.Key, error)
- func (k *Ed25519Key) MarshalPublicData() (*data.Key, error)
- func (k *Ed25519Key) Public() string
- func (k *Ed25519Key) SignMessage(message []byte) ([]byte, error)
- func (k *Ed25519Key) Type() data.KeyType
- func (k *Ed25519Key) Verify(msg, sig []byte) error
- type Key
- type RSAKey
- type Signer
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyECDSAKey ¶
VerifyECDSAKey is a helper function to verify an ecdsa key.
func VerifyEd25519Key ¶
func VerifyEd25519Key(v *Ed25519Key) error
VerifyEd25519Key is a helper function to verify an ed25519 key.
func VerifyRSAKey ¶
VerifyRSAKey is a helper function to verify a rsa key.
Types ¶
type ECDSAKey ¶
type ECDSAKey struct { Key Verifier Signer PublicKey *ecdsa.PublicKey PrivateKey *ecdsa.PrivateKey // contains filtered or unexported fields }
ECDSAKey is a verifier for ecdsa keys
func GenerateECDSAKey ¶
GenerateECDSAKey generates a new ecdsa private key and returns it
func UnmarshalECDSAKey ¶
UnmarshalECDSAKey is a helper function to unmarshal an ecdsa key from a data.Key.
func (*ECDSAKey) MarshalAllData ¶
MarshalAllData returns the data.Key object associated with the verifier contains public and private keys.
func (*ECDSAKey) MarshalPublicData ¶
MarshalPublicData returns the data.Key object associated with the verifier contains only public key.
func (*ECDSAKey) Public ¶
Public this is the public string used as a unique identifier for the verifier instance.
func (*ECDSAKey) SignMessage ¶
SignMessage signs a message with the private key.
type Ed25519Key ¶
type Ed25519Key struct { Key Verifier Signer ed25519.PrivateKey PublicKey ed25519.PublicKey // contains filtered or unexported fields }
Ed25519Key is a verifier for ed25519 keys
func GenerateEd25519Key ¶
func GenerateEd25519Key() (*Ed25519Key, error)
GenerateEd25519Key generates a new ed25519 private key and returns it
func UnmarshalEd25519Key ¶
func UnmarshalEd25519Key(key *data.Key) (*Ed25519Key, error)
UnmarshalEd25519Key is a helper function to unmarshal an ed25519 key from a data.Key.
func (*Ed25519Key) MarshalAllData ¶
func (k *Ed25519Key) MarshalAllData() (*data.Key, error)
MarshalAllData returns the data.Key object associated with the verifier contains public and private keys.
func (*Ed25519Key) MarshalPublicData ¶
func (k *Ed25519Key) MarshalPublicData() (*data.Key, error)
MarshalPublicData returns the data.PublicKey object associated with the verifier.
func (*Ed25519Key) Public ¶
func (k *Ed25519Key) Public() string
Public this is the public string used as a unique identifier for the verifier instance.
func (*Ed25519Key) SignMessage ¶
func (k *Ed25519Key) SignMessage(message []byte) ([]byte, error)
SignMessage signs a message with the private key.
func (*Ed25519Key) Type ¶
func (k *Ed25519Key) Type() data.KeyType
Type returns the type of the signature scheme.
func (*Ed25519Key) Verify ¶
func (k *Ed25519Key) Verify(msg, sig []byte) error
Verify takes a message and signature, all as byte slices, and determines whether the signature is valid for the given key and message.
type Key ¶
type Key interface { // Type returns the type of key. Type() data.KeyType // MarshalAllData returns the data.Key object associated with the verifier contains public and private keys. MarshalAllData() (*data.Key, error) }
Key represents a common methods of different keys.
type RSAKey ¶
type RSAKey struct { Key Verifier Signer PublicKey *rsa.PublicKey PrivateKey *rsa.PrivateKey // contains filtered or unexported fields }
RSAKey is
func GenerateRSAKey ¶
GenerateRSAKey generates a new rsa private key and returns it
func UnmarshalRSAKey ¶
UnmarshalRSAKey is a helper function to unmarshal an RSA key from a data.Key.
func (*RSAKey) MarshalAllData ¶
MarshalAllData returns the data.Key object associated with the verifier contains public and private keys.
func (*RSAKey) MarshalPublicData ¶
MarshalPublicData returns the data.Key object associated with the verifier contains only public key.
func (*RSAKey) Public ¶
Public this is the public string used as a unique identifier for the verifier instance.
func (*RSAKey) SignMessage ¶
SignMessage signs a message with the private key.
type Signer ¶
type Signer interface { // SignMessage signs a message with the private key. SignMessage(message []byte) ([]byte, error) }
Signer is an interface for an opaque private key that can be used for signing operations.
type Verifier ¶
type Verifier interface { // MarshalPublicData returns the data.Key object associated with the verifier contains only public key. MarshalPublicData() (*data.Key, error) // Public this is the public string used as a unique identifier for the verifier instance. Public() string // Verify takes a message and signature, all as byte slices, // and determines whether the signature is valid for the given // key and message. Verify(msg, sig []byte) error }
A Verifier verifies public key signatures.