openssl3.2 - exp - 可以在命令行使用的口令算法名称列表
文章目录
- openssl3.2 - exp - 可以在命令行使用的口令算法名称列表
- 概述
- 笔记
- 测试工程实现
- 备注
- 整理 - 总共有126种加密算法可用于命令行参数的密码加密算法
- 备注
- END
openssl3.2 - exp - 可以在命令行使用的口令算法名称列表
概述
上一个笔记openssl3.2 - exp - PEM <==> DER, 还有个疑问.
openssl pkey -in app_key3.pem -out app_key5_pwd.pem -outform PEM -passout pass:111111 -算法名称
如果PEM/DER互转时, 要想转换后的文件带口令保护 就需要指定用哪种算法来执行口令加密算法.
并不是随便哪一种可见的算法名称就能用的.
算法有限制
算法不能有 EVP_CIPH_FLAG_AEAD_CIPHER 标记
模式不能是 EVP_CIPH_XTS_MODE
如果想确定哪些是不支持的口令加密算法, 必须要自己写个程序, 将不支持的算法过滤掉.
参照openssl源码, 写了一个测试程序, 可以将全部算法都列出来, 不支持的算法加上标记.
运行效果如下, 只要算法后边有标记 " !!! ---------- ", 都是不支持的命令行口令加密算法.
Legacy:
AES-128-CBC // ok
AES-128-CBC-HMAC-SHA1 : !!! ---------- cipher has no object identifier
AES-128-CBC-HMAC-SHA256 : !!! ---------- cipher has no object identifier
id-aes128-CCM : !!! ---------- AEAD ciphers not supported
AES-128-CFB // ok
AES-128-CFB1 // ok
AES-128-CFB8 // ok
AES-128-CTR : !!! ---------- cipher has no object identifier
AES-128-ECB // ok
id-aes128-GCM : !!! ---------- AEAD ciphers not supported
AES-128-OCB : !!! ---------- cipher has no object identifier
AES-128-OFB // ok
AES-128-XTS : !!! ---------- XTS ciphers not supported
AES-192-CBC
id-aes192-CCM : !!! ---------- AEAD ciphers not supported
AES-192-CFB // ok
AES-192-CFB1 // ok
AES-192-CFB8 // ok
AES-192-CTR : !!! ---------- cipher has no object identifier
AES-192-ECB // ok
id-aes192-GCM : !!! ---------- AEAD ciphers not supported
AES-192-OCB : !!! ---------- cipher has no object identifier
AES-192-OFB // ok
AES-256-CBC // ok
AES-256-CBC-HMAC-SHA1 : !!! ---------- cipher has no object identifier
AES-256-CBC-HMAC-SHA256 : !!! ---------- cipher has no object identifier
id-aes256-CCM : !!! ---------- AEAD ciphers not supported
AES-256-CFB // ok
AES-256-CFB1 // ok
AES-256-CFB8 // ok
AES-256-CTR : !!! ---------- cipher has no object identifier
AES-256-ECB // ok
id-aes256-GCM : !!! ---------- AEAD ciphers not supported
AES-256-OCB : !!! ---------- cipher has no object identifier
AES-256-OFB // ok
AES-256-XTS : !!! ---------- XTS ciphers not supported
ARIA-128-CBC // ok
ARIA-128-CCM : !!! ---------- AEAD ciphers not supported
ARIA-128-CFB // ok
ARIA-128-CFB1 : !!! ---------- cipher has no object identifier
ARIA-128-CFB8 : !!! ---------- cipher has no object identifier
ARIA-128-CTR // ok
ARIA-128-ECB // ok
ARIA-128-GCM : !!! ---------- AEAD ciphers not supported
ARIA-128-OFB // ok
ARIA-192-CBC // ok
ARIA-192-CCM : !!! ---------- AEAD ciphers not supported
ARIA-192-CFB // ok
ARIA-192-CFB1 : !!! ---------- cipher has no object identifier
ARIA-192-CFB8 : !!! ---------- cipher has no object identifier
ARIA-192-CTR // ok
ARIA-192-ECB // ok
ARIA-192-GCM : !!! ---------- AEAD ciphers not supported
ARIA-192-OFB // ok
ARIA-256-CBC // ok
ARIA-256-CCM : !!! ---------- AEAD ciphers not supported
ARIA-256-CFB // ok
ARIA-256-CFB1 : !!! ---------- cipher has no object identifier
ARIA-256-CFB8 : !!! ---------- cipher has no object identifier
ARIA-256-CTR // ok
ARIA-256-ECB // ok
ARIA-256-GCM : !!! ---------- AEAD ciphers not supported
ARIA-256-OFB // ok
BF-CBC // err
BF-CFB : !!! ---------- cipher has no object identifier
BF-ECB : !!! ---------- cipher has no object identifier
BF-OFB : !!! ---------- cipher has no object identifier
CAMELLIA-128-CBC // ok
CAMELLIA-128-CFB // ok
CAMELLIA-128-CFB1 : !!! ---------- cipher has no object identifier
CAMELLIA-128-CFB8 : !!! ---------- cipher has no object identifier
CAMELLIA-128-CTR // ok
CAMELLIA-128-ECB // ok
CAMELLIA-128-OFB // ok
CAMELLIA-192-CBC // ok
CAMELLIA-192-CFB // ok
CAMELLIA-192-CFB1 : !!! ---------- cipher has no object identifier
CAMELLIA-192-CFB8 : !!! ---------- cipher has no object identifier
CAMELLIA-192-CTR // ok
CAMELLIA-192-ECB // ok
CAMELLIA-192-OFB // ok
CAMELLIA-256-CBC // ok
CAMELLIA-256-CFB // ok
CAMELLIA-256-CFB1 : !!! ---------- cipher has no object identifier
CAMELLIA-256-CFB8 : !!! ---------- cipher has no object identifier
CAMELLIA-256-CTR // ok
CAMELLIA-256-ECB // ok
CAMELLIA-256-OFB // ok
CAST5-CBC // err
CAST5-CFB : !!! ---------- cipher has no object identifier
CAST5-ECB : !!! ---------- cipher has no object identifier
CAST5-OFB : !!! ---------- cipher has no object identifier
ChaCha20 : !!! ---------- cipher has no object identifier
ChaCha20-Poly1305 : !!! ---------- cipher has no object identifier
DES-CBC // err
DES-CFB // err
DES-CFB1 // err
DES-CFB8 // err
DES-ECB // err
DES-EDE // ok
DES-EDE-CBC : !!! ---------- cipher has no object identifier
DES-EDE-CFB : !!! ---------- cipher has no object identifier
DES-EDE-OFB : !!! ---------- cipher has no object identifier
DES-EDE3 : !!! ---------- cipher has no object identifier
DES-EDE3-CBC // ok
DES-EDE3-CFB // err
DES-EDE3-CFB1 // err
DES-EDE3-CFB8 // err
DES-EDE3-OFB : !!! ---------- cipher has no object identifier
DES-OFB // err
DESX-CBC : !!! ---------- cipher has no object identifier
id-aes128-CCM : !!! ---------- AEAD ciphers not supported
id-aes128-GCM : !!! ---------- AEAD ciphers not supported
id-aes128-wrap // ok
id-aes128-wrap-pad // ok
id-aes192-CCM : !!! ---------- AEAD ciphers not supported
id-aes192-GCM : !!! ---------- AEAD ciphers not supported
id-aes192-wrap // ok
id-aes192-wrap-pad // ok
id-aes256-CCM : !!! ---------- AEAD ciphers not supported
id-aes256-GCM : !!! ---------- AEAD ciphers not supported
id-aes256-wrap // ok
id-aes256-wrap-pad // ok
id-smime-alg-CMS3DESwrap // err
IDEA-CBC // err
IDEA-CFB : !!! ---------- cipher has no object identifier
IDEA-ECB : !!! ---------- cipher has no object identifier
IDEA-OFB : !!! ---------- cipher has no object identifier
RC2-40-CBC // err
RC2-64-CBC // err
RC2-CBC
RC2-CFB : !!! ---------- cipher has no object identifier
RC2-ECB : !!! ---------- cipher has no object identifier
RC2-OFB : !!! ---------- cipher has no object identifier
RC4 // err
RC4-40 // err
RC4-HMAC-MD5 : !!! ---------- cipher has no object identifier
SEED-CBC // err
SEED-CFB // err
SEED-ECB // err
SEED-OFB // err
SM4-CBC // ok
SM4-CFB // ok
SM4-CTR // ok
SM4-ECB // ok
SM4-OFB // ok
Provided:
{ 1.2.410.200046.1.1.12, ARIA-256-CBC, ARIA256 } // ok
{ 2.16.840.1.101.3.4.1.22, AES-192-CBC, AES192 } // ok
{ 2.16.840.1.101.3.4.1.4, AES-128-CFB } // ok
ARIA-192-CCM : !!! ---------- AEAD ciphers not supported
{ 1.2.410.200046.1.1.1, ARIA-128-ECB } // ok
{ 2.16.840.1.101.3.4.1.2, AES-128-CBC, AES128 } // ok
{ 2.16.840.1.101.3.4.1.24, AES-192-CFB } // ok
{ 1.2.392.200011.61.1.1.1.2, CAMELLIA-128-CBC, CAMELLIA128 } // ok
{ 1.2.392.200011.61.1.1.1.4, CAMELLIA-256-CBC, CAMELLIA256 } // ok
ARIA-192-GCM : !!! ---------- AEAD ciphers not supported
{ 2.16.840.1.101.3.4.1.42, AES-256-CBC, AES256 } // ok
{ 2.16.840.1.101.3.4.1.28, AES-192-WRAP-PAD, AES192-WRAP-PAD, id-aes192-wrap-pad } // ok
ARIA-256-GCM : !!! ---------- AEAD ciphers not supported
AES-256-XTS : !!! ---------- XTS ciphers not supported
{ 2.16.840.1.101.3.4.1.8, AES-128-WRAP-PAD, AES128-WRAP-PAD, id-aes128-wrap-pad } // ok
{ 1.2.840.113549.1.9.16.3.6, DES3-WRAP, id-smime-alg-CMS3DESwrap } // err
{ 2.16.840.1.101.3.4.1.48, AES-256-WRAP-PAD, AES256-WRAP-PAD, id-aes256-wrap-pad } // ok
{ 1.2.156.10197.1.104.3, SM4-OFB, SM4-OFB128 } // ok
{ 2.16.840.1.101.3.4.1.25, AES-192-WRAP, AES192-WRAP, id-aes192-wrap } // ok
{ 2.16.840.1.101.3.4.1.41, AES-256-ECB } // ok
{ 0.3.4401.5.3.1.9.49, CAMELLIA-256-CTR } // ok
{ 1.2.410.200046.1.1.2, ARIA-128-CBC, ARIA128 } // ok
AES-128-GCM : !!! ---------- AEAD ciphers not supported
{ 0.3.4401.5.3.1.9.41, CAMELLIA-256-ECB } // ok
{ 2.16.840.1.101.3.4.1.44, AES-256-CFB } // ok
{ 1.2.156.10197.1.104.4, SM4-CFB, SM4-CFB128 } // ok
{ 0.3.4401.5.3.1.9.4, CAMELLIA-128-CFB } // ok
ARIA-256-CCM : !!! ---------- AEAD ciphers not supported
{ 1.2.410.200046.1.1.14, ARIA-256-OFB } // ok
AES-256-GCM : !!! ---------- AEAD ciphers not supported
{ 0.3.4401.5.3.1.9.9, CAMELLIA-128-CTR } // ok
{ 2.16.840.1.101.3.4.1.23, AES-192-OFB } // ok
{ 1.2.156.10197.1.104.1, SM4-ECB } // ok
AES-128-CCM : !!! ---------- AEAD ciphers not supported
AES-256-CCM : !!! ---------- AEAD ciphers not supported
{ 1.2.410.200046.1.1.7, ARIA-192-CBC, ARIA192 } // ok
{ 2.16.840.1.101.3.4.1.45, AES-256-WRAP, AES256-WRAP, id-aes256-wrap } // ok
{ 1.2.410.200046.1.1.15, ARIA-256-CTR } // ok
{ 1.2.410.200046.1.1.3, ARIA-128-CFB } // ok
ARIA-128-GCM : !!! ---------- AEAD ciphers not supported
{ 1.2.410.200046.1.1.6, ARIA-192-ECB } // ok
AES-192-GCM : !!! ---------- AEAD ciphers not supported
{ 0.3.4401.5.3.1.9.29, CAMELLIA-192-CTR } // ok
{ 0.3.4401.5.3.1.9.43, CAMELLIA-256-OFB } // ok
{ 1.2.156.10197.1.104.2, SM4, SM4-CBC } // ok
ARIA-128-CCM : !!! ---------- AEAD ciphers not supported
AES-192-CCM : !!! ---------- AEAD ciphers not supported
{ 1.3.14.3.2.17, DES-EDE, DES-EDE-ECB } // ok
{ 1.2.410.200046.1.1.11, ARIA-256-ECB } // ok
AES-128-XTS : !!! ---------- XTS ciphers not supported
{ 2.16.840.1.101.3.4.1.5, AES-128-WRAP, AES128-WRAP, id-aes128-wrap } // ok
{ 2.16.840.1.101.3.4.1.3, AES-128-OFB } // ok
{ 0.3.4401.5.3.1.9.3, CAMELLIA-128-OFB } // ok
{ 0.3.4401.5.3.1.9.1, CAMELLIA-128-ECB } // ok
{ 1.2.840.113549.3.7, DES-EDE3-CBC, DES3 } // ok
{ 0.3.4401.5.3.1.9.44, CAMELLIA-256-CFB } // ok
{ 1.2.410.200046.1.1.10, ARIA-192-CTR } // ok
{ 0.3.4401.5.3.1.9.23, CAMELLIA-192-OFB } // ok
{ 0.3.4401.5.3.1.9.24, CAMELLIA-192-CFB } // ok
{ 1.2.410.200046.1.1.9, ARIA-192-OFB } // ok
{ 1.2.410.200046.1.1.13, ARIA-256-CFB } // 好使
{ 2.16.840.1.101.3.4.1.1, AES-128-ECB } // 好使
{ 1.2.410.200046.1.1.8, ARIA-192-CFB } // 好使
{ 1.2.156.10197.1.104.7, SM4-CTR } // 好使
{ 2.16.840.1.101.3.4.1.43, AES-256-OFB } // 好使
{ 1.2.410.200046.1.1.4, ARIA-128-OFB } // 好使
{ 1.2.392.200011.61.1.1.1.3, CAMELLIA-192-CBC, CAMELLIA192 } // 好使
{ 0.3.4401.5.3.1.9.21, CAMELLIA-192-ECB } // 好使
{ 1.2.410.200046.1.1.5, ARIA-128-CTR } // 好使
{ 2.16.840.1.101.3.4.1.21, AES-192-ECB } // 好使
NULL : !!! ---------- cipher has no object identifier
AES-128-CBC-CTS : !!! ---------- cipher has no object identifier
AES-192-CBC-CTS : !!! ---------- cipher has no object identifier
AES-256-CBC-CTS : !!! ---------- cipher has no object identifier
AES-256-CFB1 // 好使
AES-192-CFB1 // 好使
AES-128-CFB1 // 好使
AES-256-CFB8 // 好使
AES-192-CFB8 // 好使
AES-128-CFB8 // 可以
AES-256-CTR : !!! ---------- cipher has no object identifier
AES-192-CTR : !!! ---------- cipher has no object identifier
AES-128-CTR : !!! ---------- cipher has no object identifier
AES-256-OCB : !!! ---------- cipher has no object identifier
AES-192-OCB : !!! ---------- cipher has no object identifier
AES-128-OCB : !!! ---------- cipher has no object identifier
AES-128-SIV : !!! ---------- cipher has no object identifier
AES-192-SIV : !!! ---------- cipher has no object identifier
AES-256-SIV : !!! ---------- cipher has no object identifier
AES-128-GCM-SIV : !!! ---------- cipher has no object identifier
AES-192-GCM-SIV : !!! ---------- cipher has no object identifier
AES-256-GCM-SIV : !!! ---------- cipher has no object identifier
AES-256-WRAP-INV : !!! ---------- cipher has no object identifier
AES-192-WRAP-INV : !!! ---------- cipher has no object identifier
AES-128-WRAP-INV : !!! ---------- cipher has no object identifier
AES-256-WRAP-PAD-INV : !!! ---------- cipher has no object identifier
AES-192-WRAP-PAD-INV : !!! ---------- cipher has no object identifier
AES-128-WRAP-PAD-INV : !!! ---------- cipher has no object identifier
AES-128-CBC-HMAC-SHA1 : !!! ---------- cipher has no object identifier
AES-256-CBC-HMAC-SHA1 : !!! ---------- cipher has no object identifier
AES-128-CBC-HMAC-SHA256 : !!! ---------- cipher has no object identifier
AES-256-CBC-HMAC-SHA256 : !!! ---------- cipher has no object identifier
ARIA-256-CFB1 : !!! ---------- cipher has no object identifier
ARIA-192-CFB1 : !!! ---------- cipher has no object identifier
ARIA-128-CFB1 : !!! ---------- cipher has no object identifier
ARIA-256-CFB8 : !!! ---------- cipher has no object identifier
ARIA-192-CFB8 : !!! ---------- cipher has no object identifier
ARIA-128-CFB8 : !!! ---------- cipher has no object identifier
CAMELLIA-128-CBC-CTS : !!! ---------- cipher has no object identifier
CAMELLIA-192-CBC-CTS : !!! ---------- cipher has no object identifier
CAMELLIA-256-CBC-CTS : !!! ---------- cipher has no object identifier
CAMELLIA-256-CFB1 : !!! ---------- cipher has no object identifier
CAMELLIA-192-CFB1 : !!! ---------- cipher has no object identifier
CAMELLIA-128-CFB1 : !!! ---------- cipher has no object identifier
CAMELLIA-256-CFB8 : !!! ---------- cipher has no object identifier
CAMELLIA-192-CFB8 : !!! ---------- cipher has no object identifier
CAMELLIA-128-CFB8 : !!! ---------- cipher has no object identifier
DES-EDE3-ECB : !!! ---------- cipher has no object identifier
DES-EDE3-OFB : !!! ---------- cipher has no object identifier
DES-EDE3-CFB // 不行
DES-EDE3-CFB8 // 不行
DES-EDE3-CFB1 // 不行
DES-EDE-CBC : !!! ---------- cipher has no object identifier
DES-EDE-OFB : !!! ---------- cipher has no object identifier
DES-EDE-CFB : !!! ---------- cipher has no object identifier
SM4-GCM : !!! ---------- cipher has no object identifier
SM4-CCM : !!! ---------- cipher has no object identifier
SM4-XTS : !!! ---------- cipher has no object identifier
ChaCha20 : !!! ---------- cipher has no object identifier
ChaCha20-Poly1305 : !!! ---------- cipher has no object identifier
free map, g_mem_hook_map.size() = 0
笔记
测试工程实现
/*!
* \file main.cpp
*/#include "my_openSSL_lib.h"
#include <openssl/crypto.h>
#include <openssl/bio.h>
#include <openssl/safestack.h>
#include <openssl/evp.h>
#include <openssl/provider.h>#include <stdlib.h>
#include <stdio.h>
#include <assert.h>#include "CMemHookRec.h"BIO* bio_out = NULL;
BIO* bio_err = NULL;
static const char* select_name = NULL;void my_openssl_app();
void list_ciphers(const char* prefix);
int cipher_cmp(const EVP_CIPHER* const* a, const EVP_CIPHER* const* b);
void collect_ciphers(EVP_CIPHER* cipher, void* stack);int main(int argc, char** argv)
{setvbuf(stdout, NULL, _IONBF, 0); // 清掉stdout缓存, 防止调用printf时阻塞mem_hook();my_openssl_app();mem_unhook();return 0;
}void my_openssl_app()
{bio_out = BIO_new_fp(stdout, 0);bio_err = BIO_new_fp(stdout, 0);if ((NULL != bio_out) && (NULL != bio_err)){list_ciphers(" ");}if (NULL != bio_out){BIO_free(bio_out);bio_out = NULL;}if (NULL != bio_err){BIO_free(bio_err);bio_err = NULL;}
}void legacy_cipher_fn(const EVP_CIPHER* c,const char* from, const char* to, void* arg)
{int mode = 0;unsigned long int flags = 0;int alg_nid = 0;if (select_name != NULL&& (c == NULL|| OPENSSL_strcasecmp(select_name, EVP_CIPHER_get0_name(c)) != 0)){return;}if (c != NULL) {mode = EVP_CIPHER_get_mode(c);flags = EVP_CIPHER_get_flags(c);alg_nid = EVP_CIPHER_get_type(c);if (alg_nid == NID_undef) {BIO_printf(bio_out, " %s : !!! ---------- cipher has no object identifier\n", EVP_CIPHER_get0_name(c));}else if (mode == EVP_CIPH_XTS_MODE) {BIO_printf((BIO*)arg, " %s : !!! ---------- XTS ciphers not supported\n", EVP_CIPHER_get0_name(c));}else if ((flags & EVP_CIPH_FLAG_AEAD_CIPHER) != 0) {BIO_printf((BIO*)arg, " %s : !!! ---------- AEAD ciphers not supported\n", EVP_CIPHER_get0_name(c));}else {BIO_printf((BIO*)arg, " %s \n", EVP_CIPHER_get0_name(c));}}
}int name_cmp(const char* const* a, const char* const* b)
{return OPENSSL_strcasecmp(*a, *b);
}void collect_names(const char* name, void* vdata)
{STACK_OF(OPENSSL_CSTRING)* names = (STACK_OF(OPENSSL_CSTRING)*)vdata;sk_OPENSSL_CSTRING_push(names, name);
}void print_names(BIO* out, STACK_OF(OPENSSL_CSTRING)* names)
{int i = sk_OPENSSL_CSTRING_num(names);int j;sk_OPENSSL_CSTRING_sort(names);if (i > 1)BIO_printf(out, "{ ");for (j = 0; j < i; j++) {const char* name = sk_OPENSSL_CSTRING_value(names, j);if (j > 0)BIO_printf(out, ", ");BIO_printf(out, "%s", name);}if (i > 1)BIO_printf(out, " }");
}DEFINE_STACK_OF(EVP_CIPHER)
void list_ciphers(const char* prefix)
{STACK_OF(EVP_CIPHER)* ciphers = sk_EVP_CIPHER_new(cipher_cmp);int i;int mode = 0;int flags = 0;int alg_nid = 0;if (ciphers == NULL) {BIO_printf(bio_err, "ERROR: Memory allocation\n");return;}if (true) {BIO_printf(bio_out, "%sLegacy:\n", prefix);EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out);}BIO_printf(bio_out, "%sProvided:\n", prefix);EVP_CIPHER_do_all_provided(NULL, collect_ciphers, ciphers);sk_EVP_CIPHER_sort(ciphers);for (i = 0; i < sk_EVP_CIPHER_num(ciphers); i++) {const EVP_CIPHER* c = sk_EVP_CIPHER_value(ciphers, i);mode = EVP_CIPHER_get_mode(c);flags = EVP_CIPHER_get_flags(c);alg_nid = EVP_CIPHER_get_type(c);if (alg_nid == NID_undef) {BIO_printf(bio_out, " %s : !!! ---------- cipher has no object identifier\n", EVP_CIPHER_get0_name(c));continue;}else if (mode == EVP_CIPH_XTS_MODE) {BIO_printf(bio_out, " %s : !!! ---------- XTS ciphers not supported\n", EVP_CIPHER_get0_name(c));continue;}else if ((flags & EVP_CIPH_FLAG_AEAD_CIPHER) != 0) {BIO_printf(bio_out, " %s : !!! ---------- AEAD ciphers not supported\n", EVP_CIPHER_get0_name(c));continue;}STACK_OF(OPENSSL_CSTRING)* names = NULL;if (select_name != NULL && !EVP_CIPHER_is_a(c, select_name))continue;names = sk_OPENSSL_CSTRING_new(name_cmp);if (names != NULL && EVP_CIPHER_names_do_all(c, collect_names, names)) {BIO_printf(bio_out, " ");print_names(bio_out, names);BIO_printf(bio_out, "\r\n");/* BIO_printf(bio_out, " @ %s\n",OSSL_PROVIDER_get0_name(EVP_CIPHER_get0_provider(c)));if (verbose) {const char* desc = EVP_CIPHER_get0_description(c);if (desc != NULL)BIO_printf(bio_out, " description: %s\n", desc);print_param_types("retrievable algorithm parameters",EVP_CIPHER_gettable_params(c), 4);print_param_types("retrievable operation parameters",EVP_CIPHER_gettable_ctx_params(c), 4);print_param_types("settable operation parameters",EVP_CIPHER_settable_ctx_params(c), 4);}*/}sk_OPENSSL_CSTRING_free(names);}sk_EVP_CIPHER_pop_free(ciphers, EVP_CIPHER_free);
}int cipher_cmp(const EVP_CIPHER* const* a, const EVP_CIPHER* const* b)
{return strcmp(OSSL_PROVIDER_get0_name(EVP_CIPHER_get0_provider(*a)),OSSL_PROVIDER_get0_name(EVP_CIPHER_get0_provider(*b)));
}void collect_ciphers(EVP_CIPHER* cipher, void* stack)
{STACK_OF(EVP_CIPHER)* cipher_stack = (STACK_OF(EVP_CIPHER)*)stack;if (sk_EVP_CIPHER_push(cipher_stack, cipher) > 0)EVP_CIPHER_up_ref(cipher);
}
备注
我们自己写的工程, 只能调用openssl对外提供的接口, 没办法用openssl内部接口(包括内部函数, 内部头文件, 内部结构定义)
像这个列出openssl全部加密算法的实现, 用的是openssl接口上的回调函数入参. 传入我们自己的回调函数指针, 在回调函数中判断算法功能是否在命令行参数中可用于口令加密.
现在知道了支持口令加密的加密算法名称, 试几个不常见的口令加密算法, 看看是否好使?
openssl pkey -in app_key.pem -passin pass:my_pwd_for_app_key -out app_key.der -outform DER
app_key.pem是带口令保护的, 执行上面的命令, 转为一个不带口令的.der
现在用这个不带口令的.der, 转成带口令的.der, 加密算法用上面测试工程找到的有效算法名称, 试试好使不?openssl pkey -in app_key.der -out app_key_pwd1.pem -outform DER -passout pass:111111 -ChaCha20
Error: Cipher options are supported only for PEM output看到口令加密算法只支持.PEM格式…
那算了, 就实验.der/.pem转成.pem的场景.openssl pkey -in app_key.der -out app_key_no_pwd.pem -outform PEM
先将上面实验的.der转成不带口令保护的.pemopenssl pkey -in app_key_no_pwd.pem -out app_key_pwd1.pem -outform PEM -passout pass:111111 -ChaCha20
cipher has no object identifier
说明还有限制条件, 选用的算法必须有obj_id, 那将这个条件也加入算法选择逻辑里面.程序修改完了, 上面的工程副本已经更新. 现在能看到, 算法ChaCha20在列表中已经标记为了不支持.
再试试其他支持的不常见加密算法.
openssl pkey -in app_key_no_pwd.pem -out app_key_pwd1.pem -outform PEM -passout pass:111111 -DES-EDE3-CFB1
BC570600:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto\evp\evp_fetch.c:342:Global default library context, Algorithm (DES-CFB : 6), Properties ()
可以看到, 也不是每种算法都支持.
跟了一下openssl源码, 都是宏写的, 调用的都是内部函数, 不好弄清为啥不行.
那就试试找到的其他算法, 看行不行.下面列出的都是好使的算法, 没有都列出, 在上面的算法列表中写上了是否好使.
openssl pkey -in app_key_no_pwd.pem -out app_key_pwd1.pem -outform PEM -passout pass:111111 -AES-128-CFB8
过滤掉的算法中, 不好通过程序来判断了, 只能一个一个实验.
整理 - 总共有126种加密算法可用于命令行参数的密码加密算法
// 总共有126种加密算法可用于命令行参数的密码加密算法
Legacy:
AES-128-CBC // ok
AES-128-CFB // ok
AES-128-CFB1 // ok
AES-128-CFB8 // ok
AES-128-ECB // ok
AES-128-OFB // ok
AES-192-CBC // ok
AES-192-CFB // ok
AES-192-CFB1 // ok
AES-192-CFB8 // ok
AES-192-ECB // ok
AES-192-OFB // ok
AES-256-CBC // ok
AES-256-CFB // ok
AES-256-CFB1 // ok
AES-256-CFB8 // ok
AES-256-ECB // ok
AES-256-OFB // ok
ARIA-128-CBC // ok
ARIA-128-CFB // ok
ARIA-128-CTR // ok
ARIA-128-ECB // ok
ARIA-128-OFB // ok
ARIA-192-CBC // ok
ARIA-192-CFB // ok
ARIA-192-CTR // ok
ARIA-192-ECB // ok
ARIA-192-OFB // ok
ARIA-256-CBC // ok
ARIA-256-CFB // ok
ARIA-256-CTR // ok
ARIA-256-ECB // ok
ARIA-256-OFB // ok
CAMELLIA-128-CBC // ok
CAMELLIA-128-CFB // ok
CAMELLIA-128-CTR // ok
CAMELLIA-128-ECB // ok
CAMELLIA-128-OFB // ok
CAMELLIA-192-CBC // ok
CAMELLIA-192-CFB // ok
CAMELLIA-192-CTR // ok
CAMELLIA-192-ECB // ok
CAMELLIA-192-OFB // ok
CAMELLIA-256-CBC // ok
CAMELLIA-256-CFB // ok
CAMELLIA-256-CTR // ok
CAMELLIA-256-ECB // ok
CAMELLIA-256-OFB // ok
DES-EDE // ok
DES-EDE3-CBC // ok
DES-EDE3-CFB // err
DES-EDE3-CFB1 // err
DES-EDE3-CFB8 // err
id-aes128-wrap // ok
id-aes128-wrap-pad // ok
id-aes192-wrap // ok
id-aes192-wrap-pad // ok
id-aes256-wrap // ok
id-aes256-wrap-pad // ok
SM4-CBC // ok
SM4-CFB // ok
SM4-CTR // ok
SM4-ECB // ok
SM4-OFB // ok
Provided:
{ 1.2.410.200046.1.1.12, ARIA-256-CBC, ARIA256 } // ok
{ 2.16.840.1.101.3.4.1.22, AES-192-CBC, AES192 } // ok
{ 2.16.840.1.101.3.4.1.4, AES-128-CFB } // ok
{ 1.2.410.200046.1.1.1, ARIA-128-ECB } // ok
{ 2.16.840.1.101.3.4.1.2, AES-128-CBC, AES128 } // ok
{ 2.16.840.1.101.3.4.1.24, AES-192-CFB } // ok
{ 1.2.392.200011.61.1.1.1.2, CAMELLIA-128-CBC, CAMELLIA128 } // ok
{ 1.2.392.200011.61.1.1.1.4, CAMELLIA-256-CBC, CAMELLIA256 } // ok
{ 2.16.840.1.101.3.4.1.42, AES-256-CBC, AES256 } // ok
{ 2.16.840.1.101.3.4.1.28, AES-192-WRAP-PAD, AES192-WRAP-PAD, id-aes192-wrap-pad } // ok
{ 2.16.840.1.101.3.4.1.8, AES-128-WRAP-PAD, AES128-WRAP-PAD, id-aes128-wrap-pad } // ok
{ 1.2.840.113549.1.9.16.3.6, DES3-WRAP, id-smime-alg-CMS3DESwrap } // err
{ 2.16.840.1.101.3.4.1.48, AES-256-WRAP-PAD, AES256-WRAP-PAD, id-aes256-wrap-pad } // ok
{ 1.2.156.10197.1.104.3, SM4-OFB, SM4-OFB128 } // ok
{ 2.16.840.1.101.3.4.1.25, AES-192-WRAP, AES192-WRAP, id-aes192-wrap } // ok
{ 2.16.840.1.101.3.4.1.41, AES-256-ECB } // ok
{ 0.3.4401.5.3.1.9.49, CAMELLIA-256-CTR } // ok
{ 1.2.410.200046.1.1.2, ARIA-128-CBC, ARIA128 } // ok
{ 0.3.4401.5.3.1.9.41, CAMELLIA-256-ECB } // ok
{ 2.16.840.1.101.3.4.1.44, AES-256-CFB } // ok
{ 1.2.156.10197.1.104.4, SM4-CFB, SM4-CFB128 } // ok
{ 0.3.4401.5.3.1.9.4, CAMELLIA-128-CFB } // ok
{ 1.2.410.200046.1.1.14, ARIA-256-OFB } // ok
{ 0.3.4401.5.3.1.9.9, CAMELLIA-128-CTR } // ok
{ 2.16.840.1.101.3.4.1.23, AES-192-OFB } // ok
{ 1.2.156.10197.1.104.1, SM4-ECB } // ok
{ 1.2.410.200046.1.1.7, ARIA-192-CBC, ARIA192 } // ok
{ 2.16.840.1.101.3.4.1.45, AES-256-WRAP, AES256-WRAP, id-aes256-wrap } // ok
{ 1.2.410.200046.1.1.15, ARIA-256-CTR } // ok
{ 1.2.410.200046.1.1.3, ARIA-128-CFB } // ok
{ 1.2.410.200046.1.1.6, ARIA-192-ECB } // ok
{ 0.3.4401.5.3.1.9.29, CAMELLIA-192-CTR } // ok
{ 0.3.4401.5.3.1.9.43, CAMELLIA-256-OFB } // ok
{ 1.2.156.10197.1.104.2, SM4, SM4-CBC } // ok
{ 1.3.14.3.2.17, DES-EDE, DES-EDE-ECB } // ok
{ 1.2.410.200046.1.1.11, ARIA-256-ECB } // ok
{ 2.16.840.1.101.3.4.1.5, AES-128-WRAP, AES128-WRAP, id-aes128-wrap } // ok
{ 2.16.840.1.101.3.4.1.3, AES-128-OFB } // ok
{ 0.3.4401.5.3.1.9.3, CAMELLIA-128-OFB } // ok
{ 0.3.4401.5.3.1.9.1, CAMELLIA-128-ECB } // ok
{ 1.2.840.113549.3.7, DES-EDE3-CBC, DES3 } // ok
{ 0.3.4401.5.3.1.9.44, CAMELLIA-256-CFB } // ok
{ 1.2.410.200046.1.1.10, ARIA-192-CTR } // ok
{ 0.3.4401.5.3.1.9.23, CAMELLIA-192-OFB } // ok
{ 0.3.4401.5.3.1.9.24, CAMELLIA-192-CFB } // ok
{ 1.2.410.200046.1.1.9, ARIA-192-OFB } // ok
{ 1.2.410.200046.1.1.13, ARIA-256-CFB } // 好使
{ 2.16.840.1.101.3.4.1.1, AES-128-ECB } // 好使
{ 1.2.410.200046.1.1.8, ARIA-192-CFB } // 好使
{ 1.2.156.10197.1.104.7, SM4-CTR } // 好使
{ 2.16.840.1.101.3.4.1.43, AES-256-OFB } // 好使
{ 1.2.410.200046.1.1.4, ARIA-128-OFB } // 好使
{ 1.2.392.200011.61.1.1.1.3, CAMELLIA-192-CBC, CAMELLIA192 } // 好使
{ 0.3.4401.5.3.1.9.21, CAMELLIA-192-ECB } // 好使
{ 1.2.410.200046.1.1.5, ARIA-128-CTR } // 好使
{ 2.16.840.1.101.3.4.1.21, AES-192-ECB } // 好使
AES-256-CFB1 // 好使
AES-192-CFB1 // 好使
AES-128-CFB1 // 好使
AES-256-CFB8 // 好使
AES-192-CFB8 // 好使
AES-128-CFB8 // 可以
备注
如果想要转换后的.der/.pem受口令密码和加密算法保护, 必须是.pem格式.
如果怕逆向的用户看到程序中的.pem内容的数组, 可以将.pem放到参数文件中.
文件的组织可以用多个buffer合成一个buffer的方法(C++ - 多个buffer合并成一个buffer的管理类).
对一个大buffer加密(非对称/对称), 只有正版用户才能载入, 间接保护了程序被逆向.
END
相关文章:
openssl3.2 - exp - 可以在命令行使用的口令算法名称列表
文章目录 openssl3.2 - exp - 可以在命令行使用的口令算法名称列表概述笔记测试工程实现备注整理 - 总共有126种加密算法可用于命令行参数的密码加密算法备注END openssl3.2 - exp - 可以在命令行使用的口令算法名称列表 概述 上一个笔记openssl3.2 - exp - PEM <…...
模板不存在:./Application/Home/View/OnContact/Index.html 错误位置
模板不存在:./Application/Home/View/OnContact/Index.html 错误位置FILE: /home/huimingdedhpucixmaihndged5e/wwwroot/ThinkPHP123/Library/Think/View.class.php LINE: 110 TRACE#0 /home/huimingdedhpucixmaihndged5e/wwwroot/ThinkPHP123/Library/Think/View.class.php(…...
复杂的数据类型如何转成字符串!
1.首先,会调用 valueOf 方法,如果方法的返回值是一个基本数据类型,就返回这个值, 如果调用 valueOf 方法之后的返回值仍旧是一个复杂数据类型,就会调用该对象的 toString 方法, 如果 toString 方法调用之后…...
云原生构建 微服务、容器化与容器编排
第1章 何为云原生,云原生为何而生 SOA也就是面向服务的架构 软件架构的发展主要经历了集中式架构、分布式架构以及云原生架构这几代架构的发展。 微服务架构,其实是SOA的另外一种实现方式,属于SOA的子集。 在微服务架构下,系统…...
JavaSE——面向对象高级一(2/4)-饿汉式单例、懒汉式单例、代码块、static的注意事项
目录 static的注意事项 static相关:代码块 单例设计模式 饿汉式单例 懒汉式单例 static的注意事项 类方法中可以直接访问类的成员,不可以直接访问实例成员。 public class Student{//定义一个类变量和一个实例变量static String schoolName;int s…...
排序之冒泡排序
通过连续地比较与交换相邻元素实现排序。这个过程就像气泡从底部升到顶部一样,因此得名冒泡排序。 流程: 首先,对 n 个元素执行“冒泡”,将数组的最大元素交换至正确位置。接下来,对剩余 n−1 个元素执行“冒泡”&…...
【NR技术】 3GPP支持无人机服务的关键性能指标
1 性能指标概述 5G系统传输的数据包括安装在无人机上的硬件设备(如摄像头)收集的数据,例如图片、视频和文件。也可以传输一些软件计算或统计数据,例如无人机管理数据。5G系统传输的业务控制数据可基于应用触发,如无人机上设备的开关、旋转、升…...
Day29:安全开发-JS应用DOM树加密编码库断点调试逆向分析元素属性操作
目录 JS原生开发-DOM树-用户交互 JS导入库开发-编码加密-逆向调试 思维导图 JS知识点: 功能:登录验证,文件操作,SQL操作,云应用接入,框架开发,打包器使用等 技术:原生开发&#x…...
Python爬虫——scrapy-4
目录 免责声明 目标 过程 先修改配置文件 再修改pipelines.py 最后的结果是这样的 read.py pipelines.py items.py settings.py scrapy日志信息以及日志级别 settings.py文件设置 用百度实验一下 指定日志级别 WARNING 日志文件 注意 scrapy的post请求 简介 …...
美团春招编程第一场第三题
美团春招编程第一场第三题 题目 解答 思路-暴力解法 pair中存储从原点到包含当前元素的0,1数量,得到二维数组mat; 从头到尾遍历尺寸为i*i的矩形,计算完美矩形数量 #include <iostream> #include <vector> using namespace std;int main()…...
BulingBuling - 《金钱心理学》 [ The Psychology of Money ]
金钱心理学 摩根-豪泽尔 关于财富、贪婪和幸福的永恒课程 The Psychology of Money Morgan Housel Timeless Lessons on Wealth, Greed, and Happiness 内容简介 [ 心理学 ] [ 金钱与投资 ] Whats it about? [ Psychology ] [ Money & Investments ] 《金钱心理学》&…...
急速建立网站方法
急速建立网站方法 WordPress: 简介: WordPress是一种广泛用于建设博客、网站的免费开源内容管理系统(CMS)。它具有友好的用户界面和丰富的插件生态系统,使得用户可以轻松创建和管理网站。特点: 主题和插件支…...
Java EE之wait和notify
一.多线程的执行顺序 由于多个线程执行是抢占式执行,就会导致顺序不同,同时就会导致出现问题,就比如俩个线程同时对同一个变量进行修改,我们难以预知执行顺序。 但在实际开发中,我们希望代码按一定的逻辑顺序执行&am…...
PostgreSQL中In, Exists在SQL查询中到底有无区别
前言 SQL查询当中,In和Exists子查询到底有无区别?记得很多年以前,确实是有相关的使用戒条的,或者说存在一些使用的惯用法。试图完全抹开两者的区别,就有点过了。 两者的主要区别: 从目的上讲,…...
Netty Review - 探究Netty服务端主程序无异常退出的背后机制
文章目录 概述故障场景尝试改进问题分析铺垫: Daemon线程Netty服务端启动源码分析逻辑分析 如何避免Netty服务端意外退出最佳实践 概述 在使用Netty进行服务端程序开发时,初学者可能会遇到各种问题,其中之一就是服务端意外退出的问题。这种问…...
【兔子机器人】修改GO电机id(软件方法、硬件方法)
一、硬件方法 利用上位机直接修改GO电机的id号: 打开调试助手,点击“调试”,查询电机,修改id号,即可。 但先将四个GO电机连接线拔掉,不然会将连接的电机一并修改。 利用24V电源给GO电机供电。 二、软件方…...
Spring MVC | Spring MVC 的“核心类” 和 “注解”
目录: Spring MVC 的“核心类” 和 “注解” :1.DispatcherServlet (前端控制器)2.Controller 注解3.RequestMapping 注解3.1 RequestMapping 注解的 “使用”标注在 “方法” 上标注在 “类” 上 3.2 RequestMapping 注解的 “属性” 4.组合注解4.1 请求处理方法的…...
Python 创建PPT
本篇为如何使用Python来创建ppt文件。 创建PPT 安装必要的库 命令如下: pip install python-pptx 安装过程: 创建ppt文件 在当前目录下创建一个test的ppt文件。其中包含两页,分别使用了不同的布局。 第一页设置了标题和内容。第二页只设…...
【工具】Git的24种常用命令
相关链接 传送门:>>>【工具】Git的介绍与安装<< 1.Git配置邮箱和用户 第一次使用Git软件,需要告诉Git软件你的名称和邮箱,否则无法将文件纳入到版本库中进行版本管理。 原因:多人协作时,不同的用户可…...
rabbitmq 基本总结
rabbitmq 的基本概念 vhost、broker、producer、 consumer、 exchange、 queue、 routing key rabbitmq 常用的队列类型,工作队列(简单队列),pub/sub, routing key, topic 模式 <dependency><groupId>com.rabbitmq&l…...
基于ASP.NET+ SQL Server实现(Web)医院信息管理系统
医院信息管理系统 1. 课程设计内容 在 visual studio 2017 平台上,开发一个“医院信息管理系统”Web 程序。 2. 课程设计目的 综合运用 c#.net 知识,在 vs 2017 平台上,进行 ASP.NET 应用程序和简易网站的开发;初步熟悉开发一…...
使用分级同态加密防御梯度泄漏
抽象 联邦学习 (FL) 支持跨分布式客户端进行协作模型训练,而无需共享原始数据,这使其成为在互联和自动驾驶汽车 (CAV) 等领域保护隐私的机器学习的一种很有前途的方法。然而,最近的研究表明&…...
蓝桥杯 2024 15届国赛 A组 儿童节快乐
P10576 [蓝桥杯 2024 国 A] 儿童节快乐 题目描述 五彩斑斓的气球在蓝天下悠然飘荡,轻快的音乐在耳边持续回荡,小朋友们手牵着手一同畅快欢笑。在这样一片安乐祥和的氛围下,六一来了。 今天是六一儿童节,小蓝老师为了让大家在节…...
五年级数学知识边界总结思考-下册
目录 一、背景二、过程1.观察物体小学五年级下册“观察物体”知识点详解:由来、作用与意义**一、知识点核心内容****二、知识点的由来:从生活实践到数学抽象****三、知识的作用:解决实际问题的工具****四、学习的意义:培养核心素养…...
生成 Git SSH 证书
🔑 1. 生成 SSH 密钥对 在终端(Windows 使用 Git Bash,Mac/Linux 使用 Terminal)执行命令: ssh-keygen -t rsa -b 4096 -C "your_emailexample.com" 参数说明: -t rsa&#x…...
Linux-07 ubuntu 的 chrome 启动不了
文章目录 问题原因解决步骤一、卸载旧版chrome二、重新安装chorme三、启动不了,报错如下四、启动不了,解决如下 总结 问题原因 在应用中可以看到chrome,但是打不开(说明:原来的ubuntu系统出问题了,这个是备用的硬盘&a…...
全面解析各类VPN技术:GRE、IPsec、L2TP、SSL与MPLS VPN对比
目录 引言 VPN技术概述 GRE VPN 3.1 GRE封装结构 3.2 GRE的应用场景 GRE over IPsec 4.1 GRE over IPsec封装结构 4.2 为什么使用GRE over IPsec? IPsec VPN 5.1 IPsec传输模式(Transport Mode) 5.2 IPsec隧道模式(Tunne…...
安宝特案例丨Vuzix AR智能眼镜集成专业软件,助力卢森堡医院药房转型,赢得辉瑞创新奖
在Vuzix M400 AR智能眼镜的助力下,卢森堡罗伯特舒曼医院(the Robert Schuman Hospitals, HRS)凭借在无菌制剂生产流程中引入增强现实技术(AR)创新项目,荣获了2024年6月7日由卢森堡医院药剂师协会࿰…...
七、数据库的完整性
七、数据库的完整性 主要内容 7.1 数据库的完整性概述 7.2 实体完整性 7.3 参照完整性 7.4 用户定义的完整性 7.5 触发器 7.6 SQL Server中数据库完整性的实现 7.7 小结 7.1 数据库的完整性概述 数据库完整性的含义 正确性 指数据的合法性 有效性 指数据是否属于所定…...
消防一体化安全管控平台:构建消防“一张图”和APP统一管理
在城市的某个角落,一场突如其来的火灾打破了平静。熊熊烈火迅速蔓延,滚滚浓烟弥漫开来,周围群众的生命财产安全受到严重威胁。就在这千钧一发之际,消防救援队伍迅速行动,而豪越科技消防一体化安全管控平台构建的消防“…...
