• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
3  *
4  *  Licensed under the Apache License, Version 2.0 (the License); you may
5  *  not use this file except in compliance with the License.
6  *
7  *  http://www.apache.org/licenses/LICENSE-2.0
8  */
9 
10 #include <stdio.h>
11 #include <string.h>
12 #include <stdlib.h>
13 #include <gmssl/sm2.h>
14 
main(void)15 int main(void)
16 {
17 	SM2_KEY sm2_key;
18 	char *password = "123456";
19 
20 	if (sm2_key_generate(&sm2_key) != 1) {
21 		fprintf(stderr, "error\n");
22 		return 1;
23 	}
24 
25 	if (sm2_private_key_info_encrypt_to_pem(&sm2_key, password, stdout) != 1) {
26 		fprintf(stderr, "error\n");
27 		return 1;
28 	}
29 
30 	return 0;
31 }
32