Example #1
0
func (self *CipherCtx) EncryptFinal(out []byte) (int, error) {
	outbuf := (*C.uchar)(unsafe.Pointer(&out[0]))
	var outlen C.int
	ret := C.EVP_EncryptFinal(self.evp_cipher_ctx, outbuf, &outlen)
	if int(ret) != 1 {
		return int(outlen), errors.New("problem encrypting")
	}
	return int(outlen), nil
}
Example #2
0
func (ctx *CipherCtx) EncryptFinal(out []byte) (int, error) {
	outbuf := (*C.uchar)(unsafe.Pointer(&out[0]))
	var outlen C.int
	ret := C.EVP_EncryptFinal(ctx.evp_cipher_ctx, outbuf, &outlen)
	if int(ret) != 1 {
		//return int(outlen), ErrProblemEncrypting
		return int(outlen), sslerr.Error()
	}
	return int(outlen), nil
}