internal OpenSslBulkCipherKey(EVP_BulkCipher_Type type, OwnedMemory <byte> keyStore, int keySize, int ivSize, int tagSize) { _tagSize = tagSize; _keyStore = keyStore; _key = _keyStore.Memory.Slice(0, keySize); _iv = _keyStore.Memory.Slice(keySize, ivSize); _type = type; _ctx = EVP_CIPHER_CTX_new(); }
public static unsafe void EVP_CipherInit_ex(EVP_CIPHER_CTX ctx, EVP_BulkCipher_Type type, Span <byte> key, Span <byte> iv, KeyMode mode) { fixed(void *keyPtr = &key.DangerousGetPinnableReference()) fixed(void *ivPtr = &iv.DangerousGetPinnableReference()) { var result = EVP_CipherInit_ex(ctx, type, null, keyPtr, ivPtr, (int)mode); ThrowOnErrorReturnCode(result); } }
private static extern unsafe int EVP_CipherInit_ex(EVP_CIPHER_CTX ctx, EVP_BulkCipher_Type type, void *impl, void *key, void *iv, int enc);