mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
res_stir_shaken: Add outbound INVITE support.
Integrated STIR/SHAKEN support with outgoing INVITEs. When an INVITE is sent, the caller ID will be checked to see if there is a certificate that corresponds to it. If so, that information will be retrieved and an Identity header will be added to the SIP message. The format is: header.payload.signature;info=<public_key_url>alg=ES256;ppt=shaken Header, payload, and signature are all BASE64 encoded. The public key URL is retrieved from the certificate. Currently the algorithm and ppt are ES256 and shaken, respectively. This message is signed and can be used for verification on the receiving end. Two new configuration options have been added to the certificate object: attestation and origid. The attestation is required and must be A, B, or C. origid is the origination identifier. A new utility function has been added as well that takes a string, allocates space, BASE64 encodes it, then returns it, eliminating the need to calculate the size yourself. Change-Id: I1f84d6a5839cb2ed152ef4255b380cfc2de662b4
This commit is contained in:
committed by
Friendly Automation
parent
db012e8cc6
commit
1274117102
@@ -21,6 +21,10 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#define STIR_SHAKEN_ENCRYPTION_ALGORITHM "ES256"
|
||||
#define STIR_SHAKEN_PPT "shaken"
|
||||
#define STIR_SHAKEN_TYPE "passport"
|
||||
|
||||
enum ast_stir_shaken_verification_result {
|
||||
AST_STIR_SHAKEN_VERIFY_NOT_PRESENT, /*! No STIR/SHAKEN information was available */
|
||||
AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED, /*! Signature verification failed */
|
||||
@@ -32,6 +36,24 @@ struct ast_stir_shaken_payload;
|
||||
|
||||
struct ast_json;
|
||||
|
||||
/*!
|
||||
* \brief Retrieve the value for 'signature' from an ast_stir_shaken_payload
|
||||
*
|
||||
* \param payload The payload
|
||||
*
|
||||
* \retval The signature
|
||||
*/
|
||||
unsigned char *ast_stir_shaken_payload_get_signature(const struct ast_stir_shaken_payload *payload);
|
||||
|
||||
/*!
|
||||
* \brief Retrieve the value for 'public_key_url' from an ast_stir_shaken_payload
|
||||
*
|
||||
* \param payload The payload
|
||||
*
|
||||
* \retval The public key URL
|
||||
*/
|
||||
char *ast_stir_shaken_payload_get_public_key_url(const struct ast_stir_shaken_payload *payload);
|
||||
|
||||
/*!
|
||||
* \brief Retrieve the value for 'signature_timeout' from 'general' config object
|
||||
*
|
||||
|
@@ -239,6 +239,19 @@ int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int m
|
||||
*/
|
||||
int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max);
|
||||
|
||||
/*!
|
||||
* \brief Same as ast_base64encode, but does hte math for you and returns
|
||||
* an encoded string
|
||||
*
|
||||
* \note The returned string will need to be freed later
|
||||
*
|
||||
* \param src The source buffer
|
||||
*
|
||||
* \retval NULL on failure
|
||||
* \retval Encoded string on success
|
||||
*/
|
||||
char *ast_base64encode_string(const char *src);
|
||||
|
||||
/*!
|
||||
* \brief Decode data from base64
|
||||
* \param dst the destination buffer
|
||||
|
Reference in New Issue
Block a user