Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Curve = elliptic.P521() ErrUnexpectedMAC = errors.New("Computed and expected MAC tags do not match.") )
View Source
var ( // ErrInvalidBlockSize indicates hash blocksize <= 0. ErrInvalidBlockSize = errors.New("invalid blocksize") // ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad. ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)") // ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input. ErrInvalidPKCS7Padding = errors.New("invalid padding on input") )
PKCS7 errors.
Functions ¶
func ECDH ¶
ECDH Performs combines public and private ECDH parameters and derives an AES key from the shared secret.
Types ¶
type EncryptedMessage ¶
type EncryptedMessage struct { Sid int // The index of this sender's key to use in this diffie-hellman Rid int // The index of the receiver's key to use in this diffie-hellman Nxt []byte // Elliptic-Curve public data for the next message (encrypted) IV []byte // AES IV used to encrypt the message and HMAC key Msg []byte // AES encrypted message data Key []byte // AES encrypted HMAC key Tag []byte // HMAC integrity tag }
func EncryptMessage ¶
func EncryptMessage(clearText, aesKey, nxt []byte, sid, rid int) (msg *EncryptedMessage, err error)
Encrypt encrypts clearText aesKey, and advertises the next key nxt in the resulting message structure. sid and rid indicate to the receiver which keys should be used to decrypt the message.
Click to show internal directories.
Click to hide internal directories.