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 11 12 #ifndef GMSSL_RSA_H 13 #define GMSSL_RSA_H 14 15 16 #include <stdio.h> 17 #include <string.h> 18 #include <stdint.h> 19 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 26 /* 27 RSAPublicKey ::= SEQUENCE { 28 modulus INTEGER, -- n 29 publicExponent INTEGER -- e 30 } 31 32 RSAPrivateKey ::= SEQUENCE { 33 version INTEGER, -- 0 34 modulus INTEGER, -- n 35 publicExponent INTEGER, -- e 36 privateExponent INTEGER, -- d 37 prime1 INTEGER, -- p 38 prime2 INTEGER, -- q 39 exponent1 INTEGER, -- d mod (p-1) 40 exponent2 INTEGER, -- d mod (q-1) 41 coefficient INTEGER -- q^-1 mod p 42 } 43 */ 44 45 46 int rsa_public_key_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen); 47 48 49 50 51 52 53 #ifdef __cplusplus 54 } 55 #endif 56 #endif 57