Browse code

secsipid: synced libsecsipid.h

Daniel-Constantin Mierla authored on 17/11/2020 09:02:04
Showing 1 changed files
... ...
@@ -70,20 +70,79 @@ extern "C" {
70 70
 
71 71
 
72 72
 // SecSIPIDSignJSONHP --
73
+// * sign the JSON header and payload with provided private key
74
+// * headerJSON -  header part in JSON forman (0-terminated string)
75
+// * payloadJSON -  payload part in JSON forman (0-terminated string)
76
+// * prvkeyPath - path to private key to be used to generate the signature
77
+// * outPtr - to be set to the pointer containing the output (it is a
78
+//   0-terminated string); the `*outPtr` must be freed after use
79
+// * return: the length of `*outPtr`
73 80
 extern int SecSIPIDSignJSONHP(char* headerJSON, char* payloadJSON, char* prvkeyPath, char** outPtr);
74 81
 
75 82
 // SecSIPIDGetIdentity --
83
+// Generate the Identity header content using the input attributes
84
+// * origTN - calling number
85
+// * destTN - called number
86
+// * attestVal - attestation level
87
+// * origID - unique ID for tracking purposes, if empty string a UUID is generated
88
+// * x5uVal - location of public certificate
89
+// * prvkeyPath - path to private key to be used to generate the signature
90
+// * outPtr - to be set to the pointer containing the output (it is a
91
+//   0-terminated string); the `*outPtr` must be freed after use
92
+// * return: the length of `*outPtr`
76 93
 extern int SecSIPIDGetIdentity(char* origTN, char* destTN, char* attestVal, char* origID, char* x5uVal, char* prvkeyPath, char** outPtr);
77 94
 
78 95
 // SecSIPIDCheck --
96
+// check the Identity header value
97
+// * identityVal - identity header value
98
+// * identityLen - length of identityVal, if is 0, identityVal is expected
99
+//   to be 0-terminated
100
+// * expireVal - number of seconds until the validity is considered expired
101
+// * pubkeyPath - file path or URL to public key
102
+// * timeoutVal - timeout in seconds to try to fetch the public key via HTTP
103
+// * return: 0 - if validity is ok; <0 - on error or validity is not ok
79 104
 extern int SecSIPIDCheck(char* identityVal, int identityLen, int expireVal, char* pubkeyPath, int timeoutVal);
80 105
 
81 106
 // SecSIPIDCheckFull --
107
+// check the Identity header value
108
+// * identityVal - identity header value with header parameters
109
+// * identityLen - length of identityVal, if it is 0, identityVal is expected
110
+//   to be 0-terminated
111
+// * expireVal - number of seconds until the validity is considered expired
112
+// * pubkeyPath - file path or URL to public key
113
+// * timeoutVal - timeout in seconds to try to fetch the public key via HTTP
114
+// * return: 0 - if validity is ok; <0 - on error or validity is not ok
82 115
 extern int SecSIPIDCheckFull(char* identityVal, int identityLen, int expireVal, char* pubkeyPath, int timeoutVal);
83 116
 
117
+// SecSIPIDCheckFullPubKey --
118
+// check the Identity header value
119
+// * identityVal - identity header value with header parameters
120
+// * identityLen - length of identityVal, if it is 0, identityVal is expected
121
+//   to be 0-terminated
122
+// * expireVal - number of seconds until the validity is considered expired
123
+// * pubkeyVal - the value of the public key
124
+// * pubkeyLen - the length of the public key, if it is 0, then the pubkeyVal
125
+//   is expected to be 0-terminated
126
+// * return: 0 - if validity is ok; <0 - on error or validity is not ok
127
+extern int SecSIPIDCheckFullPubKey(char* identityVal, int identityLen, int expireVal, char* pubkeyVal, int pubkeyLen);
128
+
84 129
 // SecSIPIDSetFileCacheOptions --
130
+// set the options for local file caching of public keys
131
+// * dirPath - path to local directory where to store the files
132
+// * expireVal - number of the seconds after which to invalidate the cached file
133
+// * return: 0
85 134
 extern int SecSIPIDSetFileCacheOptions(char* dirPath, int expireVal);
86 135
 
136
+// SecSIPIDGetURLContent --
137
+// get the content of an URL
138
+// * urlVal - the HTTP or HTTPS URL
139
+// * timeoutVal - timeout in seconds to try to get the content of the HTTP URL
140
+// * outPtr - to be set to the pointer containing the output (it is a
141
+//   0-terminated string); the `*outPtr` must be freed after use
142
+// * outLen: to be set to the length of `*outPtr`
143
+// * return: 0 - on success; -1 - on failure
144
+extern int SecSIPIDGetURLContent(char* urlVal, int timeoutVal, char** outPtr, int* outLen);
145
+
87 146
 #ifdef __cplusplus
88 147
 }
89 148
 #endif