We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#签发根证书 gmssl sm2keygen -pass 123456 -out rootkey.pem gmssl certgen -C CN \ -ST Beijing \ -L Haidian \ -O PKU \ -OU CS \ -CN ROOTCA \ -days 3650 \ -key rootkey.pem \ -pass 123456 \ -out rootcert.pem \ -key_usage keyCertSign \ -key_usage cRLSign \ -gen_subject_key_id \ -gen_authority_key_id #使用根证书签发中间证书 gmssl sm2keygen -pass 123456 -out cakey.pem gmssl reqgen -key cakey.pem -out careq.pem -pass 123456 -C "CN" -ST "Beijing" -L "Haidian" -O "PKU" -OU "CS" -CN "Intermediate CA" gmssl reqsign -in careq.pem -out cacert.pem \ -cacert rootcert.pem \ -key rootkey.pem \ -pass 123456 \ -days 365 \ -key_usage digitalSignature \ -key_usage keyCertSign \ -gen_authority_key_id \ -gen_subject_key_id \ -path_len_constraint 0 \ -ca
从上图可以看出来,生成的Authority Key Identifier和Subject Key Identifier 都一样
通过查看代码,tools/reqsign.c中
// following code copy from certgen.c // Extensions if (gen_authority_key_id) { if (x509_exts_add_default_authority_key_identifier(exts, &extslen, sizeof(exts), &sm2_key) != 1) { fprintf(stderr, "%s: set AuthorityKeyIdentifier extension failure\n", prog); goto end; } } if (gen_subject_key_id) { if (x509_exts_add_subject_key_identifier_ex(exts, &extslen, sizeof(exts), -1, &sm2_key) != 1) { fprintf(stderr, "%s: set SubjectKeyIdentifier extension failure\n", prog); goto end; } }
这里的gen_authority_key_id和gen_subject_key_id使用了相同的参数sm2_key, sm2_key是签发者的key,即例子里的rootcert.pem。 这里应该调整gen_subject_key_id 使用被签发者自己的key,即例子里的cacert.pem,代码里的subject_public_key即是。
// following code copy from certgen.c // Extensions if (gen_authority_key_id) { if (x509_exts_add_default_authority_key_identifier(exts, &extslen, sizeof(exts), &sm2_key) != 1) { fprintf(stderr, "%s: set AuthorityKeyIdentifier extension failure\n", prog); goto end; } } if (gen_subject_key_id) { if (x509_exts_add_subject_key_identifier_ex(exts, &extslen, sizeof(exts), -1, &subject_public_key) != 1) { fprintf(stderr, "%s: set SubjectKeyIdentifier extension failure\n", prog); goto end; } }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
从上图可以看出来,生成的Authority Key Identifier和Subject Key Identifier 都一样
通过查看代码,tools/reqsign.c中
这里的gen_authority_key_id和gen_subject_key_id使用了相同的参数sm2_key, sm2_key是签发者的key,即例子里的rootcert.pem。
这里应该调整gen_subject_key_id 使用被签发者自己的key,即例子里的cacert.pem,代码里的subject_public_key即是。
The text was updated successfully, but these errors were encountered: