摘要: ASN.1描述与实例 1.TBSCertificate 的 ASN.1描述与实例 TBSCertificate格式用ASN.1描述如下:TBSCertificate :=SEQUENCE {version[0] EXPLICIT Version DEFAULT v1,serialNumberCert 阅读全文
posted @ 2021-06-19 20:55 20181217Cindy 阅读(405) 评论(0) 推荐(0) 编辑
摘要: X.501 Name类型用ASN.1描述如下:Name ::=CHOICE{ RDNSequence }RDNSequence ::= SEQUENCE OF RelativeDistinguishedNameRelativeDistinguishedName ::= SET OF Attribut 阅读全文
posted @ 2021-06-19 19:38 20181217Cindy 阅读(527) 评论(0) 推荐(0) 编辑
摘要: 密码工程-大素数 #include<stdio.h> #include<openssl/bn.h> #include <string.h> int main(){ BIGNUM *r; char *out; r = BN_new(); BN_generate_prime_ex(r, 256, 0, 阅读全文
posted @ 2021-06-03 11:15 20181217Cindy 阅读(70) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //这里用了int类型,所支持的整数范围较小且本程序仅支持非负整数,可能缺乏实际用途,仅供演示。 struct EX_GCD { //s,t是裴蜀等式中的系数,gcd是a,b的最大公约数 int s; int t; int gcd; }; struct EX_G 阅读全文
posted @ 2021-06-03 09:02 20181217Cindy 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1.使用OpenSSL的命令产生不少于5个素数,提交运行结果截图(5‘) 参考《密码工程》p107伪代码基于Eratosthenes算法实现 SmallPrimeList,写出测试代码与OpenSSL产生的素数对比,提交代码和运行结果截图(10 ’) #include <stdio.h> #defi 阅读全文
posted @ 2021-06-03 08:18 20181217Cindy 阅读(179) 评论(0) 推荐(0) 编辑
摘要: main.c #include<stdio.h> #include"utils.h" int main(){ //把整型数字转化为字节数组 int p; char bytearr[100]; printf("请输入一个整型数字\n"); scanf("%d",&p); printf("把整型数转化为 阅读全文
posted @ 2021-05-31 17:36 20181217Cindy 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 1. 2. sm2_enc_dec.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/ec.h> #include <openssl/evp.h> int main(void) { int r 阅读全文
posted @ 2021-05-31 12:36 20181217Cindy 阅读(842) 评论(0) 推荐(0) 编辑
摘要: SM2加解密内容: package chenchen; import org.bouncycastle.crypto.engines.SM2Engine; import org.bouncycastle.crypto.params.*; import org.bouncycastle.jcajce. 阅读全文
posted @ 2021-05-29 15:08 20181217Cindy 阅读(128) 评论(0) 推荐(0) 编辑
摘要: main.c部分代码: int main(){ void **pdh; pdh=(void **)malloc(20); int ret; ret = SDF_OpenDevice(pdh); if(ret != SDR_OK) { printf("打开设备失败\n"); } else { prin 阅读全文
posted @ 2021-05-27 09:23 20181217Cindy 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 计算2^1217 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/bn.h> int main() { BN_CTX *r; BIGNUM *a; BIGNUM *b; BIGNUM *c; c 阅读全文
posted @ 2021-05-27 09:23 20181217Cindy 阅读(141) 评论(0) 推荐(0) 编辑