Update tools use v3 API

This commit is contained in:
Zhi Guan
2022-02-27 19:11:01 +08:00
parent 381bfb5b99
commit cadbb542e3
6 changed files with 18 additions and 14 deletions

View File

@@ -70,7 +70,8 @@ int main(int argc, char **argv)
FILE *certfp = NULL;
FILE *infp = stdin;
FILE *outfp = stdout;
X509_CERTIFICATE cert;
uint8_t cert[1024];
size_t certlen;
SM2_KEY key;
uint8_t inbuf[SM2_MAX_PLAINTEXT_SIZE];
uint8_t outbuf[SM2_MAX_CIPHERTEXT_SIZE];
@@ -122,11 +123,11 @@ help:
error_print();
return -1;
}
if (x509_certificate_from_pem(&cert, certfp) != 1) {
if (x509_cert_from_pem(cert, &certlen, sizeof(cert), certfp) != 1) {
error_print();
return -1;
}
if (x509_certificate_get_public_key(&cert, &key) != 1) {
if (x509_cert_get_subject_public_key(cert, certlen, &key) != 1) {
error_print();
return -1;
}