| 1 | /* |
| 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | * You may not use this file except in compliance with the License. |
| 6 | * A copy of the License is located at |
| 7 | * |
| 8 | * http://aws.amazon.com/apache2.0 |
| 9 | * |
| 10 | * or in the "license" file accompanying this file. This file is distributed |
| 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | * express or implied. See the License for the specific language governing |
| 13 | * permissions and limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #include <openssl/x509.h> |
| 17 | |
| 18 | int main() { |
| 19 | /* X509_STORE_get0_objects appears to be the earliest method available that |
| 20 | * can retrieve all certificates from an X509_STORE. |
| 21 | * |
| 22 | * X509_STORE_get_by_subject and X509_STORE_get1_certs are available even |
| 23 | * earlier (Openssl-1.0.2), but both require known X509_NAMEs. |
| 24 | */ |
| 25 | STACK_OF(X509_OBJECT) *objects = X509_STORE_get0_objects(NULL); |
| 26 | X509 *cert = X509_OBJECT_get0_X509(NULL); |
| 27 | /* We could use i2d_X509_NAME instead if necessary, but X509_NAME_get0_der |
| 28 | * should be available where X509_STORE_get0_objects is */ |
| 29 | X509_NAME_get0_der(NULL, NULL, NULL); |
| 30 | return 0; |
| 31 | } |