MCPcopy Index your code
hub / github.com/MapServer/MapServer / msLoadEncryptionKey

Function msLoadEncryptionKey

mapcrypto.c:261–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259 **********************************************************************/
260
261static int msLoadEncryptionKey(mapObj *map)
262{
263 const char *keyfile;
264
265 if (map == NULL)
266 {
267 msSetError(MS_MISCERR, "NULL MapObj.", "msLoadEncryptionKey()");
268 return MS_FAILURE;
269 }
270
271 if (map->encryption_key_loaded)
272 return MS_SUCCESS; /* Already loaded */
273
274 keyfile = msGetConfigOption(map, "MS_ENCRYPTION_KEY");
275
276 if (keyfile == NULL)
277 keyfile = getenv("MS_ENCRYPTION_KEY");
278
279 if (keyfile &&
280 msReadEncryptionKeyFromFile(keyfile,map->encryption_key) == MS_SUCCESS)
281 {
282 map->encryption_key_loaded = MS_TRUE;
283 }
284 else
285 {
286 msSetError(MS_MISCERR, "Failed reading encryption key. Make sure "
287 "MS_ENCRYPTION_KEY is set and points to a valid key file.",
288 "msLoadEncryptionKey()");
289 return MS_FAILURE;
290 }
291
292 return MS_SUCCESS;
293}
294
295/**********************************************************************
296 * msEncryptStringWithKey()

Callers 1

msDecryptStringTokensFunction · 0.85

Calls 3

msSetErrorFunction · 0.85
msGetConfigOptionFunction · 0.85

Tested by

no test coverage detected