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) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved. 8 */ 9 #ifndef __XMLSEC_OPENSSL_X509_H__ 10 #define __XMLSEC_OPENSSL_X509_H__ 11 12 #ifndef XMLSEC_NO_X509 13 14 #include <openssl/x509.h> 15 16 #include <xmlsec/xmlsec.h> 17 #include <xmlsec/keys.h> 18 #include <xmlsec/transforms.h> 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif /* __cplusplus */ 23 24 /** 25 * XMLSEC_STACK_OF_X509: 26 * 27 * Macro. To make docbook happy. 28 */ 29 #define XMLSEC_STACK_OF_X509 STACK_OF(X509) 30 31 /** 32 * XMLSEC_STACK_OF_X509_CRL: 33 * 34 * Macro. To make docbook happy. 35 */ 36 #define XMLSEC_STACK_OF_X509_CRL STACK_OF(X509_CRL) 37 38 /** 39 * xmlSecOpenSSLKeyDataX509Id: 40 * 41 * The OpenSSL X509 data klass. 42 */ 43 #define xmlSecOpenSSLKeyDataX509Id \ 44 xmlSecOpenSSLKeyDataX509GetKlass() 45 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataX509GetKlass(void); 46 47 XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data); 48 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, 49 X509* cert); 50 51 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, 52 X509* cert); 53 XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLKeyDataX509GetCert (xmlSecKeyDataPtr data, 54 xmlSecSize pos); 55 XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data); 56 57 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, 58 X509_CRL* crl); 59 XMLSEC_CRYPTO_EXPORT X509_CRL* xmlSecOpenSSLKeyDataX509GetCrl (xmlSecKeyDataPtr data, 60 xmlSecSize pos); 61 XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecOpenSSLKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data); 62 63 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecOpenSSLX509CertGetKey (X509* cert); 64 65 66 /** 67 * xmlSecOpenSSLKeyDataRawX509CertId: 68 * 69 * The OpenSSL raw X509 certificate klass. 70 */ 71 #define xmlSecOpenSSLKeyDataRawX509CertId \ 72 xmlSecOpenSSLKeyDataRawX509CertGetKlass() 73 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataRawX509CertGetKlass(void); 74 75 /** 76 * xmlSecOpenSSLX509StoreId: 77 * 78 * The OpenSSL X509 store klass. 79 */ 80 #define xmlSecOpenSSLX509StoreId \ 81 xmlSecOpenSSLX509StoreGetKlass() 82 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecOpenSSLX509StoreGetKlass(void); 83 XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLX509StoreFindCert (xmlSecKeyDataStorePtr store, 84 xmlChar *subjectName, 85 xmlChar *issuerName, 86 xmlChar *issuerSerial, 87 xmlChar *ski, 88 xmlSecKeyInfoCtx* keyInfoCtx); 89 XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLX509StoreVerify (xmlSecKeyDataStorePtr store, 90 XMLSEC_STACK_OF_X509* certs, 91 XMLSEC_STACK_OF_X509_CRL* crls, 92 xmlSecKeyInfoCtx* keyInfoCtx); 93 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCert (xmlSecKeyDataStorePtr store, 94 X509* cert, 95 xmlSecKeyDataType type); 96 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCrl (xmlSecKeyDataStorePtr store, 97 X509_CRL* crl); 98 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, 99 const char* path); 100 XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsFile(xmlSecKeyDataStorePtr store, 101 const char* filename); 102 103 #ifdef __cplusplus 104 } 105 #endif /* __cplusplus */ 106 107 #endif /* XMLSEC_NO_X509 */ 108 109 #endif /* __XMLSEC_OPENSSL_X509_H__ */ 110