Documentation ¶
Index ¶
- func Decrypt(data *EncryptedData, key []byte) ([]byte, error)
- func DeriveKey(publicKey *ecdsa.PublicKey, privateKey *ecdsa.PrivateKey) []byte
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func Hash(data []byte) []byte
- func LoadPrivateKey(privateKey []byte) (*ecdsa.PrivateKey, error)
- func LoadPublicKey(publicKey []byte) (*ecdsa.PublicKey, error)
- func RandomBytes(n int) ([]byte, error)
- func Verify(message []byte, signatureBytes []byte, publicKey *ecdsa.PublicKey) (bool, error)
- func VerifyWithBytes(message, signature, publicKeyData []byte) (bool, error)
- type Actor
- type ECDHEncryptedData
- type ECDSASignature
- type EncryptedData
- type JWKPrivateKey
- type Key
- func (k *Key) Encrypt(data []byte, recipient *Key) (*ECDHEncryptedData, error)
- func (k *Key) Sign(data []byte) (*SignedData, error)
- func (k *Key) SignString(data string) (*SignedStringData, error)
- func (k *Key) Verify(data *SignedData) (bool, error)
- func (k *Key) VerifyString(data *SignedStringData) (bool, error)
- type KeyPair
- type SignedData
- type SignedStringData
- type StringKeyPair
- type WebKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveKey ¶
func DeriveKey(publicKey *ecdsa.PublicKey, privateKey *ecdsa.PrivateKey) []byte
Derives a key from a public and private ECDSA key pair. The derived key is compatible to the one generated by the subtle crypto API
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
func LoadPrivateKey ¶
func LoadPrivateKey(privateKey []byte) (*ecdsa.PrivateKey, error)
func RandomBytes ¶
func VerifyWithBytes ¶
Types ¶
type ECDHEncryptedData ¶
type ECDSASignature ¶
func Sign ¶
func Sign(message []byte, privateKey *ecdsa.PrivateKey) (*ECDSASignature, error)
func (*ECDSASignature) Serialize ¶
func (e *ECDSASignature) Serialize() []byte
type EncryptedData ¶
func Encrypt ¶
func Encrypt(data, key []byte) (*EncryptedData, error)
type JWKPrivateKey ¶
type Key ¶
type Key struct { Name string `json:"name"` Type string `json:"type"` Format string `json:"format"` Params map[string]interface{} `json:"params"` PublicKey []byte `json:"public_key"` Purposes []string `json:"purposes"` // only defined for local signing operations PrivateKey []byte `json:"private_key,omitempty"` }
func AsSettingsKey ¶
func AsSettingsKey(key *ecdsa.PrivateKey, name, keyType string) (*Key, error)
func GenerateWebKey ¶
func (*Key) Encrypt ¶
func (k *Key) Encrypt(data []byte, recipient *Key) (*ECDHEncryptedData, error)
func (*Key) SignString ¶
func (k *Key) SignString(data string) (*SignedStringData, error)
func (*Key) VerifyString ¶
func (k *Key) VerifyString(data *SignedStringData) (bool, error)
type KeyPair ¶
type KeyPair struct { PrivateKeyBytes []byte `json:"privateKeyBytes"` PublicKeyBytes []byte `json:"publicKeyBytes"` PrivateKey *ecdsa.PrivateKey `json:"-"` PublicKey *ecdsa.PublicKey `json:"-"` }
func KeyPairFromStrings ¶
func KeyPairFromStrings(keyPair *StringKeyPair) (*KeyPair, error)
type SignedData ¶
type SignedData struct { Data []byte `json:"data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
func (*SignedData) AsMap ¶
func (s *SignedData) AsMap() map[string]interface{}
type SignedStringData ¶
type SignedStringData struct { Data string `json:"data"` Signature []byte `json:"signature"` PublicKey []byte `json:"publicKey"` }
func (*SignedStringData) AsMap ¶
func (s *SignedStringData) AsMap() map[string]interface{}
type StringKeyPair ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.