摘要: 3.1 非对称算法使用流程 步骤1 密钥生成(见3.3 密钥生成) 步骤2 加密解密(见3.5 加密解密)或 签名验签(见3.4 签名验签)或 密钥协商(见3.6 密钥协商)步骤3 清除数据 阅读全文
posted @ 2023-04-05 09:45 艾米的爸爸 阅读(1) 评论(0) 推荐(0)
摘要: 2.8 MAC示例代码 #include "openssl/hmac.h" int test_evp_hmac_sm3() { const EVP_MD *md = NULL; int flag, dlen1, dlen2; unsigned char key[16]={0x66,0xc7,0xf0 阅读全文
posted @ 2023-04-05 09:30 艾米的爸爸 阅读(1) 评论(0) 推荐(0)
摘要: 2.7 杂凑示例代码 #include <string.h> #include "openssl/evp.h" typedef struct sm3_test_vector_st { int msg_len; unsigned char msg[64]; unsigned char right_ha 阅读全文
posted @ 2023-04-05 09:15 艾米的爸爸 阅读(1) 评论(0) 推荐(0)
摘要: 2.6 MAC操作 HMAC_Init 函 数 名: int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md); 功能描述: 初始化HMAC_CTX,设置密钥和使用的算法 说 明: 清除数据并置零。 参数说明: 阅读全文
posted @ 2023-04-05 09:00 艾米的爸爸 阅读(2) 评论(0) 推荐(0)
摘要: 2.5 HMAC_CTX操作 HMAC_CTX_init 函 数 名: void HMAC_CTX_init(HMAC_CTX *ctx); 功能描述: 初始化HMAC_CTX 说 明: HMAC_CTX数据置零,但别的辅助数据未置零。 (1)EVP_MD_CTX_init(&ctx->i_ctx) 阅读全文
posted @ 2023-04-04 20:59 艾米的爸爸 阅读(2) 评论(0) 推荐(0)
摘要: 2.4 摘要操作 三段式摘要 EVP_DigestInit_ex或EVP_DigestInitEVP_DigestUpdateEVP_DigestFinal_ex或EVP_DigestFinal一段式摘要 EVP_DigestEVP_DigestInit 函 数 名: int EVP_DigestI 阅读全文
posted @ 2023-04-04 20:58 艾米的爸爸 阅读(2) 评论(0) 推荐(0)
摘要: 2.3 EVP_MD的辅助信息获取 EVP_MD_*** int EVP_MD_block_size(const EVP_MD *md) { return md->block_size; } int EVP_MD_type(const EVP_MD *md) { return md->type; } 阅读全文
posted @ 2023-04-04 20:53 艾米的爸爸 阅读(3) 评论(0) 推荐(0)
摘要: 2.1 杂凑和MAC的使用步骤 表2.1杂凑和MAC的使用步骤 分段式杂凑 备注 1 EVP_MD_CTX_init(&ctx); 2 EVP_DigestInit(&ctx, EVP_sm3() ); 3 EVP_DigestUpdate(&ctx, msg, msg_len); 可多次添加消息 阅读全文
posted @ 2023-04-04 20:51 艾米的爸爸 阅读(1) 评论(0) 推荐(0)
摘要: 2.2 EVP_MD_CTX操作 有EVP_MD_CTX,然后操作 EVP_MD_CTX_init(EVP_MD_CTX *ctx);EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);创建EVP_MD_CTX,然后操作 EVP_MD_CTX *EVP_MD_CTX_create 阅读全文
posted @ 2023-04-04 20:50 艾米的爸爸 阅读(3) 评论(0) 推荐(0)
摘要: 1.6 解密接口的说明 EVP_DecryptInit int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, const unsigned char *key, const unsigned char *iv); 功能描述 阅读全文
posted @ 2023-04-04 20:49 艾米的爸爸 阅读(2) 评论(0) 推荐(0)