Documentation ¶
Index ¶
- Variables
- type KeyPair
- func (e *KeyPair) Clone() bc.KeyPair
- func (e *KeyPair) DecryptMessage(data []byte) (bool, []byte, error)
- func (e *KeyPair) EncryptMessage(clear []byte, pubkey bc.PubKey) ([]byte, error)
- func (e *KeyPair) FromB64(s string) error
- func (e *KeyPair) GenerateKey()
- func (e *KeyPair) GetName() string
- func (e *KeyPair) GetPubKey() bc.PubKey
- func (e *KeyPair) Precompute()
- func (e *KeyPair) ToB64() string
- func (e *KeyPair) ValidatePubKey(s string) bool
- type PubKey
Constants ¶
This section is empty.
Variables ¶
var (
// NAME - human-readable name of this Crypto implementation
NAME = "Curve25519,AES-CBC-256,HMAC-SHA-256"
)
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair for ECC : Bencrypt Implementation of a Curve25519,AES-CBC-256,HMAC-SHA-256 system
func (*KeyPair) DecryptMessage ¶
DecryptMessage : Decrypts a message 1) derives the shared secret: S = P_x, where P = (P_x, P_y) = k_B R (it is the same as the one Alice derived because P = k_B R = k_B r G = r k_B G = r K_B), or outputs failed if P=O; 2) checks the luggage tag 3) derives keys the same way as Alice did: k_E \| k_M = \textrm{KDF}(S\|S_1); 4) uses MAC to check the tag and outputs failed if d \ne \textrm{MAC}(k_M; c \| S_2); 5) uses symmetric encryption scheme to decrypt the message m = E^{-1}(k_E; c).
Returns: bool - Luggage Tag check passed []byte - decrypted data, if tag check passed error - what you would expect
func (*KeyPair) EncryptMessage ¶
EncryptMessage : Encrypts a message 1) generates a random number r in [1, n-1] and calculates R = r G; 2) derives a shared secret: S = P_x, where P = (P_x, P_y) = r K_B (and P ne O); 3) uses KDF to derive a symmetric encryption and a MAC key: k_E | k_M = textrm{KDF}(S|S_1); 4) encrypts the message: c = E(k_E; m); 5) computes luggage tag so recipient can quickly see if this is for them 6) computes the tag of encrypted message and S_2: d = textrm{MAC}(k_M; c | S_2); 7) outputs R | luggageTag | c | d.
func (*KeyPair) FromB64 ¶
FromB64 : Sets the private portion of this keypair from a Base64-encoded string
func (*KeyPair) GenerateKey ¶
func (e *KeyPair) GenerateKey()
GenerateKey : Generates a new keypair inside this KeyPair object
func (*KeyPair) ToB64 ¶
ToB64 : Returns the private portion of this keypair as a Base64-encoded string
func (*KeyPair) ValidatePubKey ¶
ValidatePubKey : Returns true if and only if the argument is a valid PubKey to this KeyPair
type PubKey ¶
type PubKey struct {
Pubkey []byte //len=32
}
PubKey : Implements bc.PubKey interface
func (*PubKey) Nil ¶
func (e *PubKey) Nil() interface{}
Nil : Returns the interface-to-nil-pointer type for this PubKey