xmlsecurityengine/xmlsec/inc/xmlsec_app.h
changeset 0 e35f40988205
child 20 889504eac4fb
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 /** 
       
     2  * XML Security Library (http://www.aleksey.com/xmlsec).
       
     3  *
       
     4  *
       
     5  * This is free software; see Copyright file in the source
       
     6  * distribution for preciese wording.
       
     7  * 
       
     8  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey@aleksey.com>
       
     9  * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
       
    10  */
       
    11 #ifndef __XMLSEC_APP_H__
       
    12 #define __XMLSEC_APP_H__    
       
    13 #include "xmlsec_config.h"
       
    14 #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
       
    15 
       
    16 #if !defined(IN_XMLSEC) && !defined(XMLSEC_CRYPTO_DYNAMIC_LOADING)
       
    17 #error To use dynamic crypto engines loading define XMLSEC_CRYPTO_DYNAMIC_LOADING
       
    18 #endif /* !defined(IN_XMLSEC) && !defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */
       
    19 
       
    20 #ifdef __cplusplus
       
    21 extern "C" {
       
    22 #endif /* __cplusplus */ 
       
    23 
       
    24 #include <libxml2_tree.h>
       
    25 #include <libxml2_xmlio.h>
       
    26 
       
    27 #include "xmlsec_xmlsec.h"
       
    28 #include "xmlsec_keysdata.h"
       
    29 #include "xmlsec_keys.h"
       
    30 #include "xmlsec_keysmngr.h"
       
    31 #include "xmlsec_transforms.h"
       
    32 #include "xmlsec_dl.h"
       
    33 
       
    34 /**********************************************************************
       
    35  *
       
    36  * Crypto Init/shutdown
       
    37  *
       
    38  *********************************************************************/
       
    39 XMLSEC_EXPORT int 				xmlSecCryptoInit		(void);
       
    40 XMLSEC_EXPORT int 				xmlSecCryptoShutdown		(void);
       
    41 XMLSEC_EXPORT int				xmlSecCryptoKeysMngrInit	(xmlSecKeysMngrPtr mngr);
       
    42 
       
    43 /*********************************************************************
       
    44  *
       
    45  * Key data ids
       
    46  *
       
    47  ********************************************************************/
       
    48 /**
       
    49  * xmlSecKeyDataAesId:
       
    50  * 
       
    51  * The AES key klass.
       
    52  */
       
    53 #define xmlSecKeyDataAesId			xmlSecKeyDataAesGetKlass()
       
    54 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataAesGetKlass	(void);	
       
    55 /**
       
    56  * xmlSecKeyDataDesId:
       
    57  * 
       
    58  * The DES key klass.
       
    59  */
       
    60 #define xmlSecKeyDataDesId			xmlSecKeyDataDesGetKlass()
       
    61 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataDesGetKlass	(void);	
       
    62 /**
       
    63  * xmlSecKeyDataDsaId:
       
    64  * 
       
    65  * The DSA key klass.
       
    66  */
       
    67 #define xmlSecKeyDataDsaId			xmlSecKeyDataDsaGetKlass()
       
    68 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataDsaGetKlass	(void);		
       
    69 /** 
       
    70  * xmlSecKeyDataHmacId:
       
    71  * 
       
    72  * The DHMAC key klass.
       
    73  */
       
    74 #define xmlSecKeyDataHmacId			xmlSecKeyDataHmacGetKlass()
       
    75 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataHmacGetKlass	(void);		
       
    76 /**
       
    77  * xmlSecKeyDataRsaId:
       
    78  * 
       
    79  * The RSA key klass.
       
    80  */
       
    81 #define xmlSecKeyDataRsaId			xmlSecKeyDataRsaGetKlass()
       
    82 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataRsaGetKlass	(void);		
       
    83 /**
       
    84  * xmlSecKeyDataX509Id:
       
    85  * 
       
    86  * The X509 data klass.
       
    87  */
       
    88 #define xmlSecKeyDataX509Id			xmlSecKeyDataX509GetKlass()
       
    89 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataX509GetKlass	(void);		
       
    90 /**
       
    91  * xmlSecKeyDataRawX509CertId:
       
    92  * 
       
    93  * The  raw X509 certificate klass.
       
    94  */
       
    95 #define xmlSecKeyDataRawX509CertId		xmlSecKeyDataRawX509CertGetKlass()
       
    96 XMLSEC_EXPORT xmlSecKeyDataId			xmlSecKeyDataRawX509CertGetKlass(void);		
       
    97 
       
    98 /*********************************************************************
       
    99  *
       
   100  * Key data store ids
       
   101  *
       
   102  ********************************************************************/
       
   103 /**
       
   104  * xmlSecX509StoreId:
       
   105  * 
       
   106  * The  X509 store klass.
       
   107  */
       
   108 #define xmlSecX509StoreId			xmlSecX509StoreGetKlass()
       
   109 XMLSEC_EXPORT xmlSecKeyDataStoreId		xmlSecX509StoreGetKlass		(void);	
       
   110 
       
   111 /*********************************************************************
       
   112  *
       
   113  * Crypto transforms ids
       
   114  *
       
   115  ********************************************************************/
       
   116 /**
       
   117  * xmlSecTransformAes128CbcId:
       
   118  * 
       
   119  * The AES128 CBC cipher transform klass.
       
   120  */
       
   121 #define xmlSecTransformAes128CbcId		xmlSecTransformAes128CbcGetKlass()
       
   122 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformAes128CbcGetKlass(void);
       
   123 /**
       
   124  * xmlSecTransformAes192CbcId:
       
   125  * 
       
   126  * The AES192 CBC cipher transform klass.
       
   127  */
       
   128 #define xmlSecTransformAes192CbcId		xmlSecTransformAes192CbcGetKlass()
       
   129 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformAes192CbcGetKlass(void);
       
   130 /**
       
   131  * xmlSecTransformAes256CbcId:
       
   132  * 
       
   133  * The AES256 CBC cipher transform klass.
       
   134  */
       
   135 #define xmlSecTransformAes256CbcId		xmlSecTransformAes256CbcGetKlass()
       
   136 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformAes256CbcGetKlass(void);
       
   137 /**
       
   138  * xmlSecTransformKWAes128Id:
       
   139  * 
       
   140  * The AES 128 key wrap transform klass.
       
   141  */
       
   142 #define xmlSecTransformKWAes128Id		xmlSecTransformKWAes128GetKlass()
       
   143 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformKWAes128GetKlass	(void);	
       
   144 /**
       
   145  * xmlSecTransformKWAes192Id:
       
   146  * 
       
   147  * The AES 192 key wrap transform klass.
       
   148  */
       
   149 #define xmlSecTransformKWAes192Id		xmlSecTransformKWAes192GetKlass()
       
   150 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformKWAes192GetKlass	(void);	
       
   151 /**
       
   152  * xmlSecTransformKWAes256Id:
       
   153  * 
       
   154  * The AES 256 key wrap transform klass.
       
   155  */
       
   156 #define xmlSecTransformKWAes256Id		xmlSecTransformKWAes256GetKlass()
       
   157 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformKWAes256GetKlass	(void);	
       
   158 /**
       
   159  * xmlSecTransformDes3CbcId:
       
   160  * 
       
   161  * The Triple DES encryption transform klass.
       
   162  */
       
   163 #define xmlSecTransformDes3CbcId		xmlSecTransformDes3CbcGetKlass()
       
   164 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformDes3CbcGetKlass	(void);	
       
   165 /**
       
   166  * xmlSecTransformKWDes3Id:
       
   167  * 
       
   168  * The DES3 CBC cipher transform klass.
       
   169  */
       
   170 #define xmlSecTransformKWDes3Id			xmlSecTransformKWDes3GetKlass()
       
   171 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformKWDes3GetKlass	(void);
       
   172 /**
       
   173  * xmlSecTransformDsaSha1Id:
       
   174  * 
       
   175  * The DSA-SHA1 signature transform klass.
       
   176  */
       
   177 #define xmlSecTransformDsaSha1Id		xmlSecTransformDsaSha1GetKlass()
       
   178 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformDsaSha1GetKlass	(void);	
       
   179 
       
   180 /**
       
   181  * xmlSecTransformHmacMd5Id:
       
   182  * 
       
   183  * The HMAC with MD5 signature transform klass.
       
   184  */
       
   185 #define xmlSecTransformHmacMd5Id		xmlSecTransformHmacMd5GetKlass()
       
   186 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacMd5GetKlass	(void);	
       
   187 /**
       
   188  * xmlSecTransformHmacRipemd160Id:
       
   189  * 
       
   190  * The HMAC with RipeMD160 signature transform klass.
       
   191  */
       
   192 #define xmlSecTransformHmacRipemd160Id		xmlSecTransformHmacRipemd160GetKlass()
       
   193 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacRipemd160GetKlass(void);
       
   194 /**
       
   195  * xmlSecTransformHmacSha1Id:
       
   196  * 
       
   197  * The HMAC with SHA1 signature transform klass.
       
   198  */
       
   199 #define xmlSecTransformHmacSha1Id		xmlSecTransformHmacSha1GetKlass()
       
   200 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacSha1GetKlass	(void);	
       
   201 /**
       
   202  * xmlSecTransformHmacSha224Id:
       
   203  * 
       
   204  * The HMAC with SHA224 signature transform klass.
       
   205  */
       
   206 #define xmlSecTransformHmacSha224Id		xmlSecTransformHmacSha224GetKlass()
       
   207 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacSha224GetKlass	(void);	
       
   208 /**
       
   209  * xmlSecTransformHmacSha256Id:
       
   210  * 
       
   211  * The HMAC with SHA256 signature transform klass.
       
   212  */
       
   213 #define xmlSecTransformHmacSha256Id		xmlSecTransformHmacSha256GetKlass()
       
   214 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacSha256GetKlass	(void);	
       
   215 /**
       
   216  * xmlSecTransformHmacSha384Id:
       
   217  * 
       
   218  * The HMAC with SHA384 signature transform klass.
       
   219  */
       
   220 #define xmlSecTransformHmacSha384Id		xmlSecTransformHmacSha384GetKlass()
       
   221 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacSha384GetKlass	(void);	
       
   222 /**
       
   223  * xmlSecTransformHmacSha512Id:
       
   224  * 
       
   225  * The HMAC with SHA512 signature transform klass.
       
   226  */
       
   227 #define xmlSecTransformHmacSha512Id		xmlSecTransformHmacSha512GetKlass()
       
   228 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformHmacSha512GetKlass	(void);	
       
   229 /**
       
   230  * xmlSecTransformMd5Id:
       
   231  * 
       
   232  * The MD5 digest transform klass.
       
   233  */
       
   234 #define xmlSecTransformMd5Id			xmlSecTransformMd5GetKlass()
       
   235 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformMd5GetKlass(void);
       
   236 /**
       
   237  * xmlSecTransformRipemd160Id:
       
   238  * 
       
   239  * The RIPEMD160 digest transform klass.
       
   240  */
       
   241 #define xmlSecTransformRipemd160Id		xmlSecTransformRipemd160GetKlass()
       
   242 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRipemd160GetKlass(void);
       
   243 /**
       
   244  * xmlSecTransformRsaMd5Id:
       
   245  * 
       
   246  * The RSA-MD5 signature transform klass.
       
   247  */
       
   248 #define xmlSecTransformRsaMd5Id			xmlSecTransformRsaMd5GetKlass()
       
   249 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaMd5GetKlass	(void);	
       
   250 /**
       
   251  * xmlSecTransformRsaRipemd160Id:
       
   252  * 
       
   253  * The RSA-RIPEMD160 signature transform klass.
       
   254  */
       
   255 #define xmlSecTransformRsaRipemd160Id		xmlSecTransformRsaRipemd160GetKlass()
       
   256 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaRipemd160GetKlass	(void);	
       
   257 /**
       
   258  * xmlSecTransformRsaSha1Id:
       
   259  * 
       
   260  * The RSA-SHA1 signature transform klass.
       
   261  */
       
   262 #define xmlSecTransformRsaSha1Id		xmlSecTransformRsaSha1GetKlass()
       
   263 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaSha1GetKlass	(void);	
       
   264 /**
       
   265  * xmlSecTransformRsaSha224Id:
       
   266  * 
       
   267  * The RSA-SHA224 signature transform klass.
       
   268  */
       
   269 #define xmlSecTransformRsaSha224Id		xmlSecTransformRsaSha224GetKlass()
       
   270 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaSha224GetKlass	(void);	
       
   271 /**
       
   272  * xmlSecTransformRsaSha256Id:
       
   273  * 
       
   274  * The RSA-SHA256 signature transform klass.
       
   275  */
       
   276 #define xmlSecTransformRsaSha256Id		xmlSecTransformRsaSha256GetKlass()
       
   277 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaSha256GetKlass	(void);	
       
   278 /**
       
   279  * xmlSecTransformRsaSha384Id:
       
   280  * 
       
   281  * The RSA-SHA384 signature transform klass.
       
   282  */
       
   283 #define xmlSecTransformRsaSha384Id		xmlSecTransformRsaSha384GetKlass()
       
   284 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaSha384GetKlass	(void);	
       
   285 /**
       
   286  * xmlSecTransformRsaSha512Id:
       
   287  * 
       
   288  * The RSA-SHA512 signature transform klass.
       
   289  */
       
   290 #define xmlSecTransformRsaSha512Id		xmlSecTransformRsaSha512GetKlass()
       
   291 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaSha512GetKlass	(void);	
       
   292 
       
   293 /**
       
   294  * xmlSecTransformRsaPkcs1Id:
       
   295  * 
       
   296  * The RSA PKCS1 key transport transform klass.
       
   297  */
       
   298 #define xmlSecTransformRsaPkcs1Id		xmlSecTransformRsaPkcs1GetKlass()
       
   299 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaPkcs1GetKlass	(void);	
       
   300 /**
       
   301  * xmlSecTransformRsaOaepId:
       
   302  * 
       
   303  * The RSA PKCS1 key transport transform klass.
       
   304  */
       
   305 #define xmlSecTransformRsaOaepId		xmlSecTransformRsaOaepGetKlass()
       
   306 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformRsaOaepGetKlass	(void);	
       
   307 /**
       
   308  * xmlSecTransformSha1Id:
       
   309  * 
       
   310  * The SHA1 digest transform klass.
       
   311  */
       
   312 #define xmlSecTransformSha1Id			xmlSecTransformSha1GetKlass()
       
   313 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformSha1GetKlass	(void);
       
   314 /**
       
   315  * xmlSecTransformSha224Id:
       
   316  * 
       
   317  * The SHA224 digest transform klass.
       
   318  */
       
   319 #define xmlSecTransformSha224Id			xmlSecTransformSha224GetKlass()
       
   320 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformSha224GetKlass	(void);
       
   321 /**
       
   322  * xmlSecTransformSha256Id:
       
   323  * 
       
   324  * The SHA256 digest transform klass.
       
   325  */
       
   326 #define xmlSecTransformSha256Id			xmlSecTransformSha256GetKlass()
       
   327 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformSha256GetKlass	(void);
       
   328 /**
       
   329  * xmlSecTransformSha384Id:
       
   330  * 
       
   331  * The SHA384 digest transform klass.
       
   332  */
       
   333 #define xmlSecTransformSha384Id			xmlSecTransformSha384GetKlass()
       
   334 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformSha384GetKlass	(void);
       
   335 /**
       
   336  * xmlSecTransformSha512Id:
       
   337  * 
       
   338  * The SHA512 digest transform klass.
       
   339  */
       
   340 #define xmlSecTransformSha512Id			xmlSecTransformSha512GetKlass()
       
   341 XMLSEC_EXPORT xmlSecTransformId			xmlSecTransformSha512GetKlass	(void);
       
   342 
       
   343 /*********************************************************************
       
   344  *
       
   345  * High level routines form xmlsec command line utility
       
   346  *
       
   347  ********************************************************************/ 
       
   348 XMLSEC_EXPORT int				xmlSecCryptoAppInit		(const char* config);
       
   349 XMLSEC_EXPORT int				xmlSecCryptoAppShutdown		(void);
       
   350 XMLSEC_EXPORT int				xmlSecCryptoAppDefaultKeysMngrInit	(xmlSecKeysMngrPtr mngr);
       
   351 XMLSEC_EXPORT int				xmlSecCryptoAppDefaultKeysMngrAdoptKey	(xmlSecKeysMngrPtr mngr,
       
   352 											 xmlSecKeyPtr key);
       
   353 XMLSEC_EXPORT int				xmlSecCryptoAppDefaultKeysMngrLoad	(xmlSecKeysMngrPtr mngr,
       
   354 											 const char* uri);
       
   355 XMLSEC_EXPORT int				xmlSecCryptoAppDefaultKeysMngrSave	(xmlSecKeysMngrPtr mngr,
       
   356 											 const char* filename,
       
   357 											 xmlSecKeyDataType type);
       
   358 XMLSEC_EXPORT int				xmlSecCryptoAppKeysMngrCertLoad	(xmlSecKeysMngrPtr mngr,
       
   359 										 const char *filename, 
       
   360 										 xmlSecKeyDataFormat format,
       
   361 										 xmlSecKeyDataType type);
       
   362 XMLSEC_EXPORT int				xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
       
   363 										 const xmlSecByte* data,
       
   364 										 xmlSecSize dataSize,
       
   365 										 xmlSecKeyDataFormat format,
       
   366 										 xmlSecKeyDataType type);
       
   367 /* Venus: xmlSecCryptoAppKeyLoad replaced by xmlSecCryptoAppKeyloadWithName */
       
   368 /*
       
   369 XMLSEC_EXPORT xmlSecKeyPtr			xmlSecCryptoAppKeyLoad		(const char *filename, 
       
   370 										 xmlSecKeyDataFormat format,
       
   371 										 const char *pwd,
       
   372 										 void* pwdCallback,
       
   373 										 void* pwdCallbackCtx);
       
   374 */										 
       
   375 /* Venus: xmlSecCryptoAppKeyLoadWithName is a new API added for Symbian */										 
       
   376 XMLSEC_EXPORT xmlSecKeyPtr			xmlSecCryptoAppKeyLoadWithName	(const char *filename, 
       
   377 										 xmlSecKeyDataFormat format,
       
   378 										 const char* keyname,
       
   379 										 const char *pwd,
       
   380 										 void* pwdCallback,
       
   381 										 void* pwdCallbackCtx);										 
       
   382 XMLSEC_EXPORT xmlSecKeyPtr			xmlSecCryptoAppKeyLoadMemory	(const xmlSecByte* data,
       
   383 										 xmlSecSize dataSize,
       
   384 										 xmlSecKeyDataFormat format,
       
   385 										 const char *pwd,
       
   386 										 void* pwdCallback,
       
   387 										 void* pwdCallbackCtx);
       
   388 XMLSEC_EXPORT xmlSecKeyPtr			xmlSecCryptoAppPkcs12Load	(const char* filename, 
       
   389 										 const char* pwd,
       
   390 										 void* pwdCallback, 
       
   391 										 void* pwdCallbackCtx);	
       
   392 XMLSEC_EXPORT xmlSecKeyPtr			xmlSecCryptoAppPkcs12LoadMemory	(const xmlSecByte* data,
       
   393 										 xmlSecSize dataSize,
       
   394 										 const char *pwd,
       
   395 										 void* pwdCallback,
       
   396 										 void* pwdCallbackCtx);
       
   397 XMLSEC_EXPORT int				xmlSecCryptoAppKeyCertLoad	(xmlSecKeyPtr key,
       
   398 										 const char* filename,
       
   399 										 xmlSecKeyDataFormat format);
       
   400 XMLSEC_EXPORT int				xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key,
       
   401 										 const xmlSecByte* data,
       
   402 										 xmlSecSize dataSize,
       
   403 										 xmlSecKeyDataFormat format);
       
   404 XMLSEC_EXPORT void*				xmlSecCryptoAppGetDefaultPwdCallback(void);
       
   405 
       
   406 #ifdef __cplusplus
       
   407 }
       
   408 #endif /* __cplusplus */
       
   409 
       
   410 #endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
       
   411 
       
   412 #endif /* __XMLSEC_APP_H__ */
       
   413