Asterisk - The Open Source Telephony Project  18.5.0
certificate.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2020, Sangoma Technologies Corporation
5  *
6  * Kevin Harwell <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 #ifndef _STIR_SHAKEN_CERTIFICATE_H
19 #define _STIR_SHAKEN_CERTIFICATE_H
20 
21 #include <openssl/evp.h>
22 
23 struct ast_sorcery;
24 
26 
27 /*!
28  * \brief Get a STIR/SHAKEN certificate by caller ID number
29  *
30  * \param callier_id_number The caller ID number
31  *
32  * \retval NULL if not found
33  * \retval The certificate on success
34  */
36 
37 /*!
38  * \brief Get the public key URL associated with a certificate
39  *
40  * \param cert The certificate to get the public key URL from
41  *
42  * \retval NULL on failure
43  * \retval The public key URL on success
44  */
46 
47 /*!
48  * \brief Get the attestation level associated with a certificate
49  *
50  * \param cert The certificate
51  *
52  * \retval NULL on failure
53  * \retval The attestation on success
54  */
56 
57 /*!
58  * \brief Get the private key associated with a certificate
59  *
60  * \param cert The certificate to get the private key from
61  *
62  * \retval NULL on failure
63  * \retval The private key on success
64  */
66 
67 #ifdef TEST_FRAMEWORK
68 
69 /*!
70  * \brief Clean up the certificate and mappings set up in test_stir_shaken_init
71  *
72  * \param caller_id_number The caller ID of the certificate to clean up
73  *
74  * \retval non-zero on failure
75  * \retval 0 on success
76  */
78 
79 /*!
80  * \brief Initialize a test certificate through wizard mappings
81  *
82  * \note test_stir_shaken_cleanup should be called when done with this certificate
83  *
84  * \param caller_id_number The caller ID of the certificate to create
85  * \param file_path The path to the private key for this certificate
86  *
87  * \retval non-zero on failure
88  * \retval 0 on success
89  */
90 int test_stir_shaken_create_cert(const char *caller_id_number, const char *file_path);
91 
92 #endif /* TEST_FRAMEWORK */
93 
94 /*!
95  * \brief Load time initialization for the stir/shaken 'certificate' configuration
96  *
97  * \retval 0 on success, -1 on error
98  */
100 
101 /*!
102  * \brief Unload time cleanup for the stir/shaken 'certificate' configuration
103  *
104  * \retval 0 on success, -1 on error
105  */
107 
108 #endif /* _STIR_SHAKEN_CERTIFICATE_H */
109 
EVP_PKEY * stir_shaken_certificate_get_private_key(struct stir_shaken_certificate *cert)
Get the private key associated with a certificate.
Definition: certificate.c:106
Full structure for sorcery.
Definition: sorcery.c:230
int stir_shaken_certificate_unload(void)
Unload time cleanup for the stir/shaken &#39;certificate&#39; configuration.
Definition: certificate.c:347
struct stir_shaken_certificate * stir_shaken_certificate_get_by_caller_id_number(const char *caller_id_number)
Get a STIR/SHAKEN certificate by caller ID number.
Definition: certificate.c:84
const char * stir_shaken_certificate_get_attestation(struct stir_shaken_certificate *cert)
Get the attestation level associated with a certificate.
Definition: certificate.c:101
const char * stir_shaken_certificate_get_public_cert_url(struct stir_shaken_certificate *cert)
Get the public key URL associated with a certificate.
Definition: certificate.c:96
int test_stir_shaken_create_cert(const char *caller_id_number, const char *file_path)
Definition: certificate.c:306
int test_stir_shaken_cleanup_cert(const char *caller_id_number)
Definition: certificate.c:280
const ast_string_field caller_id_number
Definition: certificate.c:43
int stir_shaken_certificate_load(void)
Load time initialization for the stir/shaken &#39;certificate&#39; configuration.
Definition: certificate.c:355