Documentation ¶
Index ¶
- Variables
- type KeyPair
- func (r *KeyPair) Clone() bc.KeyPair
- func (r *KeyPair) DecryptMessage(data []byte) (bool, []byte, error)
- func (r *KeyPair) EncryptMessage(clear []byte, pubkey bc.PubKey) ([]byte, error)
- func (r *KeyPair) FromB64(s string) error
- func (r *KeyPair) GenerateKey()
- func (r *KeyPair) GetName() string
- func (r *KeyPair) GetPubKey() bc.PubKey
- func (r *KeyPair) Precompute()
- func (r *KeyPair) ToB64() string
- func (r *KeyPair) ValidatePubKey(s string) bool
- type PubKey
Constants ¶
This section is empty.
Variables ¶
var (
// NAME - human-readable name of this Crypto implementation
NAME = "RSA-4096,AES-CBC-256,HMAC-SHA-256"
)
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair for RSA : Bencrypt Implementation of a RSA-4096,AES-CBC-256,HMAC-SHA-256 system
func (*KeyPair) DecryptMessage ¶
DecryptMessage : Decrypts a message 1) PEM decode header and body 2) decrypt header 3) verify the header signature 4) verify the msg signature 5) decrypt the msg
func (*KeyPair) EncryptMessage ¶
EncryptMessage : Encrypts a message
- generate aes key (32 random bytes)
- encrypt the message with aes key
- sha256 the encrypted message
- sha256 the key and msg hash
- encrypt the header with rsa
- PEM encode encrypted header and encrypted message -> return
func (*KeyPair) FromB64 ¶
FromB64 : Sets the private portion of this keypair from a Base64-encoded string
func (*KeyPair) GenerateKey ¶
func (r *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 ¶
PubKey : Implements bc.PubKey interface
func (*PubKey) Nil ¶
func (e *PubKey) Nil() interface{}
Nil : Returns the interface-to-nil-pointer type for this PubKey