Documentation ¶
Overview ¶
Package cipher provides the methods and structs to do encryptions for olm/megolm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESSha512BlockSize ¶
func AESSha512BlockSize() int
AESSha512BlockSize resturns the blocksize of the cipher AESSHA256.
func Pickle ¶
Pickle encrypts the input with the key and the cipher AESSHA256. The result is then encoded in base64.
func PickleBlockSize ¶
func PickleBlockSize() int
PickleBlockSize returns the blocksize of the used cipher.
Types ¶
type AESSHA256 ¶
type AESSHA256 struct {
// contains filtered or unexported fields
}
AESSHA256 is a valid cipher using AES with CBC and HKDFSha256.
func NewAESSHA256 ¶
NewAESSHA256 returns a new AESSHA256 cipher with the key derive function info (kdfInfo).
func (AESSHA256) Decrypt ¶
Decrypt decrypts the ciphertext with the key. The key is used to derive the actual encryption key (32 bytes) as well as the iv (16 bytes).
func (AESSHA256) Encrypt ¶
Encrypt encrypts the plaintext with the key. The key is used to derive the actual encryption key (32 bytes) as well as the iv (16 bytes).
type Cipher ¶
type Cipher interface { // Encrypt encrypts the plaintext. Encrypt(key, plaintext []byte) (ciphertext []byte, err error) // Decrypt decrypts the ciphertext. Decrypt(key, ciphertext []byte) (plaintext []byte, err error) //MAC returns the MAC of the message calculated with the key. MAC(key, message []byte) ([]byte, error) //Verify checks the MAC of the message calculated with the key against the givenMAC. Verify(key, message, givenMAC []byte) (bool, error) }
Cipher defines a valid cipher.