1 /* 2 * XML Security Library (http://www.aleksey.com/xmlsec). 3 * 4 * This is free software; see Copyright file in the source 5 * distribution for preciese wording. 6 * 7 * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. 8 */ 9 #ifndef __XMLSEC_MSCNG_APP_H__ 10 #define __XMLSEC_MSCNG_APP_H__ 11 12 #include <windows.h> 13 14 #include <xmlsec/xmlsec.h> 15 #include <xmlsec/keys.h> 16 #include <xmlsec/keysmngr.h> 17 #include <xmlsec/transforms.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif /* __cplusplus */ 22 23 /******************************************************************** 24 * 25 * Init/shutdown 26 * 27 ********************************************************************/ 28 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppInit (const char* config); 29 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppShutdown (void); 30 XMLSEC_CRYPTO_EXPORT LPCTSTR xmlSecMSCngAppGetCertStoreName (void); 31 32 /******************************************************************** 33 * 34 * Keys Manager 35 * 36 ********************************************************************/ 37 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr); 38 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, 39 xmlSecKeyPtr key); 40 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr, 41 const char* uri); 42 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr, 43 const char* filename, 44 xmlSecKeyDataType type); 45 #ifndef XMLSEC_NO_X509 46 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr, 47 const char *filename, 48 xmlSecKeyDataFormat format, 49 xmlSecKeyDataType type); 50 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr, 51 const xmlSecByte *data, 52 xmlSecSize dataSize, 53 xmlSecKeyDataFormat format, 54 xmlSecKeyDataType type); 55 #endif /* XMLSEC_NO_X509 */ 56 57 58 /******************************************************************** 59 * 60 * Keys 61 * 62 ********************************************************************/ 63 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppKeyLoad (const char *filename, 64 xmlSecKeyDataFormat format, 65 const char *pwd, 66 void *pwdCallback, 67 void* pwdCallbackCtx); 68 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppKeyLoadMemory (const xmlSecByte *data, 69 xmlSecSize dataSize, 70 xmlSecKeyDataFormat format, 71 const char *pwd, 72 void *pwdCallback, 73 void* pwdCallbackCtx); 74 #ifndef XMLSEC_NO_X509 75 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppPkcs12Load (const char *filename, 76 const char *pwd, 77 void* pwdCallback, 78 void* pwdCallbackCtx); 79 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppPkcs12LoadMemory (const xmlSecByte *data, 80 xmlSecSize dataSize, 81 const char *pwd, 82 void* pwdCallback, 83 void* pwdCallbackCtx); 84 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeyCertLoad (xmlSecKeyPtr key, 85 const char* filename, 86 xmlSecKeyDataFormat format); 87 XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeyCertLoadMemory (xmlSecKeyPtr key, 88 const xmlSecByte *data, 89 xmlSecSize dataSize, 90 xmlSecKeyDataFormat format); 91 #endif /* XMLSEC_NO_X509 */ 92 93 XMLSEC_CRYPTO_EXPORT void* xmlSecMSCngAppGetDefaultPwdCallback (void); 94 95 #ifdef __cplusplus 96 } 97 #endif /* __cplusplus */ 98 99 #endif /* __XMLSEC_MSCNG_APP_H__ */ 100 101