什么是确切的替代API,而不是openssl 1.1.0中的AES_ctr128_encrypt? [英] What is exact alternate API instead of AES_ctr128_encrypt from openssl 1.1.0?
问题描述
我需要在CTR模式下使用128位AES算法从openssl库进行加密. 但是似乎从openssl 1.1.0g中删除了相应的函数AES_ctr128_encrypt.因为出现以下错误:-
I need to use 128 bit AES algrothm in CTR mode for encryption from the openssl library. But it seems that the corresponding function AES_ctr128_encrypt is removed from openssl 1.1.0g. because I get below error:-
互联网上的文档或参考文献不建议使用AES CTR模式的替代功能. 带有openssl 1.1.0g的AES_ctr128_encrypt的确切替代方案是什么?
Documentation or references from internet does not suggest the alternate function for AES CTR mode. What is the exact alternate for AES_ctr128_encrypt with openssl 1.1.0g?
推荐答案
要想简单地回答问题,我只想补充一点:不要忘记包括以下标头:
To mnistic's answer, I would only add that you should not forget to include these headers:
- openssl/aes.h
- openssl/modes.h
那么这:
AES_ctr128_encrypt(
cipher_in,
plaintext_out,
bytes_length,
&cipher->aes_key->key,
cipher->aes_key->IV,
counter,
&offset);
将成为:
#include <openssl/aes.h>
#include <openssl/modes.h>
.
.
.
CRYPTO_ctr128_encrypt(
cipher_in,
plaintext_out,
bytes_length,
&cipher->aes_key->key,
cipher->aes_key->IV,
counter,
&offset,
(block128_f)AES_encrypt);
这篇关于什么是确切的替代API,而不是openssl 1.1.0中的AES_ctr128_encrypt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!