@@ -163,7 +163,12 @@ static PyObject* PyXmlSec_KeyFromFile(PyObject* self, PyObject* args, PyObject*
163163 if (is_content ) {
164164 key -> handle = xmlSecCryptoAppKeyLoadMemory ((const xmlSecByte * )data , (xmlSecSize )data_size , format , password , NULL , NULL );
165165 } else {
166- key -> handle = xmlSecCryptoAppKeyLoadEx (data , xmlSecKeyDataTypePrivate , format , password , NULL , NULL );
166+ #if XMLSEC_VERSION_HEX >= 0x10303
167+ // from version 1.3.3 (inclusive)
168+ key -> handle = xmlSecCryptoAppKeyLoadEx (data , xmlSecKeyDataTypePrivate , format , password , NULL , NULL );
169+ #else
170+ key -> handle = xmlSecCryptoAppKeyLoad (data , format , password , NULL , NULL );
171+ #endif
167172 }
168173 Py_END_ALLOW_THREADS ;
169174
@@ -206,8 +211,12 @@ static PyObject* PyXmlSec_KeyFromEngine(PyObject* self, PyObject* args, PyObject
206211 if ((key = PyXmlSec_NewKey1 ((PyTypeObject * )self )) == NULL ) goto ON_FAIL ;
207212
208213 Py_BEGIN_ALLOW_THREADS ;
209- key -> handle = xmlSecCryptoAppKeyLoadEx (engine_and_key_id , xmlSecKeyDataTypePrivate , xmlSecKeyDataFormatEngine , NULL , xmlSecCryptoAppGetDefaultPwdCallback (),
210- (void * )engine_and_key_id );
214+ #if XMLSEC_VERSION_HEX >= 0x10303
215+ // from version 1.3.3 (inclusive)
216+ key -> handle = xmlSecCryptoAppKeyLoadEx (engine_and_key_id , xmlSecKeyDataTypePrivate , xmlSecKeyDataFormatEngine , NULL , xmlSecCryptoAppGetDefaultPwdCallback (), (void * )engine_and_key_id );
217+ #else
218+ key -> handle = xmlSecCryptoAppKeyLoad (engine_and_key_id , xmlSecKeyDataFormatEngine , NULL , xmlSecCryptoAppGetDefaultPwdCallback (), (void * )engine_and_key_id );
219+ #endif
211220 Py_END_ALLOW_THREADS ;
212221
213222 if (key -> handle == NULL ) {
0 commit comments