xref: /openssl/crypto/store/store_strings.c (revision 7ed6de99)
1 /*
2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #include <openssl/store.h>
11 
12 #include "internal/nelem.h"
13 
14 static char *type_strings[] = {
15     "Name",                      /* OSSL_STORE_INFO_NAME */
16     "Parameters",                /* OSSL_STORE_INFO_PARAMS */
17     "Public key",                /* OSSL_STORE_INFO_PUBKEY */
18     "Pkey",                      /* OSSL_STORE_INFO_PKEY */
19     "Certificate",               /* OSSL_STORE_INFO_CERT */
20     "CRL"                        /* OSSL_STORE_INFO_CRL */
21 };
22 
OSSL_STORE_INFO_type_string(int type)23 const char *OSSL_STORE_INFO_type_string(int type)
24 {
25     int types = OSSL_NELEM(type_strings);
26 
27     if (type < 1 || type > types)
28         return NULL;
29 
30     return type_strings[type - 1];
31 }
32