Пример #1
0
func boxSeal(cipherTextOut []byte, message []byte, pk []byte) int {
	support.CheckSize(cipherTextOut, BoxMacBytes()+len(message), "cypher text output")
	support.CheckSize(pk, BoxPublicKeyBytes(), "public key")

	return int(C.crypto_box_seal(
		(*C.uchar)(&cipherTextOut[0]),
		(*C.uchar)(&message[0]),
		(C.ulonglong)(len(message)),
		(*C.uchar)(&pk[0])))

}
Пример #2
0
func CryptoBoxSeal(m []byte, pk []byte) ([]byte, int) {
	support.CheckSize(pk, CryptoBoxPublicKeyBytes(), "public key")
	c := make([]byte, len(m)+CryptoBoxMacBytes())
	exit := int(C.crypto_box_seal(
		(*C.uchar)(&c[0]),
		(*C.uchar)(&m[0]),
		(C.ulonglong)(len(m)),
		(*C.uchar)(&pk[0])))

	return c, exit
}