Example #1
0
func GetCipherByName(name string) (*Cipher, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	p := C.EVP_get_cipherbyname(cname)
	if p == nil {
		return nil, fmt.Errorf("Cipher %v not found", name)
	}
	// we can consider ciphers to use static mem; don't need to free
	return &Cipher{ptr: p}, nil
}
Example #2
0
func CipherByNid(nid int) *Cipher {
	return newCipher(C.EVP_get_cipherbyname(C.OBJ_nid2sn(C.int(nid))))
}
Example #3
0
func CipherByName(name string) *Cipher {
	name_p := C.CString(name)
	defer C.free(unsafe.Pointer(name_p))
	return newCipher(C.EVP_get_cipherbyname(name_p))
}