OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* C port of DumpPublicKey.java from the Android Open source project with | 6 /* C port of DumpPublicKey.java from the Android Open source project with |
7 * support for additional RSA key sizes. (platform/system/core,git/libmincrypt | 7 * support for additional RSA key sizes. (platform/system/core,git/libmincrypt |
8 * /tools/DumpPublicKey.java). Uses the OpenSSL X509 and BIGNUM library. | 8 * /tools/DumpPublicKey.java). Uses the OpenSSL X509 and BIGNUM library. |
9 */ | 9 */ |
10 | 10 |
11 #include <inttypes.h> | 11 #include <stdint.h> |
12 #include <openssl/bn.h> | 12 #include <openssl/bn.h> |
13 #include <openssl/evp.h> | 13 #include <openssl/evp.h> |
14 #include <openssl/pem.h> | 14 #include <openssl/pem.h> |
15 #include <openssl/x509.h> | 15 #include <openssl/x509.h> |
16 #include <string.h> | 16 #include <string.h> |
17 #include <unistd.h> | 17 #include <unistd.h> |
18 | 18 |
19 /* Command line tool to extract RSA public keys from X.509 certificates | 19 /* Command line tool to extract RSA public keys from X.509 certificates |
20 * and output a pre-processed version of keys for use by RSA verification | 20 * and output a pre-processed version of keys for use by RSA verification |
21 * routines. | 21 * routines. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 output (pubkey); | 172 output (pubkey); |
173 } | 173 } |
174 | 174 |
175 fail: | 175 fail: |
176 X509_free(cert); | 176 X509_free(cert); |
177 RSA_free(pubkey); | 177 RSA_free(pubkey); |
178 fclose(fp); | 178 fclose(fp); |
179 | 179 |
180 return 0; | 180 return 0; |
181 } | 181 } |
OLD | NEW |