Exemple #1
0
func Decrypt(prv *dhkam.PrivateKey, kek *dhkam.KEK, pub *dhkam.PublicKey, m []byte) (out []byte, err error) {
	key, err := prv.CEK(kek)
	if err != nil {
		return
	}
	out, err = authsym.Decrypt(key[:authsym.SymKeyLen], key[authsym.SymKeyLen:], m)
	return
}
Exemple #2
0
func Decrypt(prv *dhkam.PrivateKey, pub *dhkam.PublicKey, m []byte) (out []byte, err error) {
	key, err := prv.SharedKey(rand.Reader, pub, keyMaterialSize)
	if err != nil {
		return
	}

	out, err = authsym.Decrypt(key[:authsym.SymKeyLen], key[authsym.SymKeyLen:], m)
	return
}