
#include "../crypt.h"

#ifdef USE_JAVA

#include <jni.h>
#include <stdio.h>  //printf
#include <stdlib.h> //malloc, free

#undef cryptlib_crypt_ALGO_NONE
#define cryptlib_crypt_ALGO_NONE 0L
#undef cryptlib_crypt_ALGO_DES
#define cryptlib_crypt_ALGO_DES 1L
#undef cryptlib_crypt_ALGO_3DES
#define cryptlib_crypt_ALGO_3DES 2L
#undef cryptlib_crypt_ALGO_IDEA
#define cryptlib_crypt_ALGO_IDEA 3L
#undef cryptlib_crypt_ALGO_CAST
#define cryptlib_crypt_ALGO_CAST 4L
#undef cryptlib_crypt_ALGO_RC2
#define cryptlib_crypt_ALGO_RC2 5L
#undef cryptlib_crypt_ALGO_RC4
#define cryptlib_crypt_ALGO_RC4 6L
#undef cryptlib_crypt_ALGO_RC5
#define cryptlib_crypt_ALGO_RC5 7L
#undef cryptlib_crypt_ALGO_AES
#define cryptlib_crypt_ALGO_AES 8L
#undef cryptlib_crypt_ALGO_BLOWFISH
#define cryptlib_crypt_ALGO_BLOWFISH 9L
#undef cryptlib_crypt_ALGO_SKIPJACK
#define cryptlib_crypt_ALGO_SKIPJACK 10L
#undef cryptlib_crypt_ALGO_DH
#define cryptlib_crypt_ALGO_DH 100L
#undef cryptlib_crypt_ALGO_RSA
#define cryptlib_crypt_ALGO_RSA 101L
#undef cryptlib_crypt_ALGO_DSA
#define cryptlib_crypt_ALGO_DSA 102L
#undef cryptlib_crypt_ALGO_ELGAMAL
#define cryptlib_crypt_ALGO_ELGAMAL 103L
#undef cryptlib_crypt_ALGO_KEA
#define cryptlib_crypt_ALGO_KEA 104L
#undef cryptlib_crypt_ALGO_ECDSA
#define cryptlib_crypt_ALGO_ECDSA 105L
#undef cryptlib_crypt_ALGO_MD2
#define cryptlib_crypt_ALGO_MD2 200L
#undef cryptlib_crypt_ALGO_MD4
#define cryptlib_crypt_ALGO_MD4 201L
#undef cryptlib_crypt_ALGO_MD5
#define cryptlib_crypt_ALGO_MD5 202L
#undef cryptlib_crypt_ALGO_SHA
#define cryptlib_crypt_ALGO_SHA 203L
#undef cryptlib_crypt_ALGO_RIPEMD160
#define cryptlib_crypt_ALGO_RIPEMD160 204L
#undef cryptlib_crypt_ALGO_SHA2
#define cryptlib_crypt_ALGO_SHA2 205L
#undef cryptlib_crypt_ALGO_HMAC_MD5
#define cryptlib_crypt_ALGO_HMAC_MD5 300L
#undef cryptlib_crypt_ALGO_HMAC_SHA1
#define cryptlib_crypt_ALGO_HMAC_SHA1 301L
#undef cryptlib_crypt_ALGO_HMAC_SHA
#define cryptlib_crypt_ALGO_HMAC_SHA 301L
#undef cryptlib_crypt_ALGO_HMAC_RIPEMD160
#define cryptlib_crypt_ALGO_HMAC_RIPEMD160 302L
#undef cryptlib_crypt_ALGO_LAST
#define cryptlib_crypt_ALGO_LAST 303L
#undef cryptlib_crypt_ALGO_FIRST_CONVENTIONAL
#define cryptlib_crypt_ALGO_FIRST_CONVENTIONAL 1L
#undef cryptlib_crypt_ALGO_LAST_CONVENTIONAL
#define cryptlib_crypt_ALGO_LAST_CONVENTIONAL 99L
#undef cryptlib_crypt_ALGO_FIRST_PKC
#define cryptlib_crypt_ALGO_FIRST_PKC 100L
#undef cryptlib_crypt_ALGO_LAST_PKC
#define cryptlib_crypt_ALGO_LAST_PKC 199L
#undef cryptlib_crypt_ALGO_FIRST_HASH
#define cryptlib_crypt_ALGO_FIRST_HASH 200L
#undef cryptlib_crypt_ALGO_LAST_HASH
#define cryptlib_crypt_ALGO_LAST_HASH 299L
#undef cryptlib_crypt_ALGO_FIRST_MAC
#define cryptlib_crypt_ALGO_FIRST_MAC 300L
#undef cryptlib_crypt_ALGO_LAST_MAC
#define cryptlib_crypt_ALGO_LAST_MAC 399L
#undef cryptlib_crypt_MODE_NONE
#define cryptlib_crypt_MODE_NONE 0L
#undef cryptlib_crypt_MODE_ECB
#define cryptlib_crypt_MODE_ECB 1L
#undef cryptlib_crypt_MODE_CBC
#define cryptlib_crypt_MODE_CBC 2L
#undef cryptlib_crypt_MODE_CFB
#define cryptlib_crypt_MODE_CFB 3L
#undef cryptlib_crypt_MODE_OFB
#define cryptlib_crypt_MODE_OFB 4L
#undef cryptlib_crypt_MODE_LAST
#define cryptlib_crypt_MODE_LAST 5L
#undef cryptlib_crypt_KEYSET_NONE
#define cryptlib_crypt_KEYSET_NONE 0L
#undef cryptlib_crypt_KEYSET_FILE
#define cryptlib_crypt_KEYSET_FILE 1L
#undef cryptlib_crypt_KEYSET_HTTP
#define cryptlib_crypt_KEYSET_HTTP 2L
#undef cryptlib_crypt_KEYSET_LDAP
#define cryptlib_crypt_KEYSET_LDAP 3L
#undef cryptlib_crypt_KEYSET_ODBC
#define cryptlib_crypt_KEYSET_ODBC 4L
#undef cryptlib_crypt_KEYSET_DATABASE
#define cryptlib_crypt_KEYSET_DATABASE 5L
#undef cryptlib_crypt_KEYSET_PLUGIN
#define cryptlib_crypt_KEYSET_PLUGIN 6L
#undef cryptlib_crypt_KEYSET_ODBC_STORE
#define cryptlib_crypt_KEYSET_ODBC_STORE 7L
#undef cryptlib_crypt_KEYSET_DATABASE_STORE
#define cryptlib_crypt_KEYSET_DATABASE_STORE 8L
#undef cryptlib_crypt_KEYSET_PLUGIN_STORE
#define cryptlib_crypt_KEYSET_PLUGIN_STORE 9L
#undef cryptlib_crypt_KEYSET_LAST
#define cryptlib_crypt_KEYSET_LAST 10L
#undef cryptlib_crypt_DEVICE_NONE
#define cryptlib_crypt_DEVICE_NONE 0L
#undef cryptlib_crypt_DEVICE_FORTEZZA
#define cryptlib_crypt_DEVICE_FORTEZZA 1L
#undef cryptlib_crypt_DEVICE_PKCS11
#define cryptlib_crypt_DEVICE_PKCS11 2L
#undef cryptlib_crypt_DEVICE_CRYPTOAPI
#define cryptlib_crypt_DEVICE_CRYPTOAPI 3L
#undef cryptlib_crypt_DEVICE_LAST
#define cryptlib_crypt_DEVICE_LAST 4L
#undef cryptlib_crypt_CERTTYPE_NONE
#define cryptlib_crypt_CERTTYPE_NONE 0L
#undef cryptlib_crypt_CERTTYPE_CERTIFICATE
#define cryptlib_crypt_CERTTYPE_CERTIFICATE 1L
#undef cryptlib_crypt_CERTTYPE_ATTRIBUTE_CERT
#define cryptlib_crypt_CERTTYPE_ATTRIBUTE_CERT 2L
#undef cryptlib_crypt_CERTTYPE_CERTCHAIN
#define cryptlib_crypt_CERTTYPE_CERTCHAIN 3L
#undef cryptlib_crypt_CERTTYPE_CERTREQUEST
#define cryptlib_crypt_CERTTYPE_CERTREQUEST 4L
#undef cryptlib_crypt_CERTTYPE_REQUEST_CERT
#define cryptlib_crypt_CERTTYPE_REQUEST_CERT 5L
#undef cryptlib_crypt_CERTTYPE_REQUEST_REVOCATION
#define cryptlib_crypt_CERTTYPE_REQUEST_REVOCATION 6L
#undef cryptlib_crypt_CERTTYPE_CRL
#define cryptlib_crypt_CERTTYPE_CRL 7L
#undef cryptlib_crypt_CERTTYPE_CMS_ATTRIBUTES
#define cryptlib_crypt_CERTTYPE_CMS_ATTRIBUTES 8L
#undef cryptlib_crypt_CERTTYPE_RTCS_REQUEST
#define cryptlib_crypt_CERTTYPE_RTCS_REQUEST 9L
#undef cryptlib_crypt_CERTTYPE_RTCS_RESPONSE
#define cryptlib_crypt_CERTTYPE_RTCS_RESPONSE 10L
#undef cryptlib_crypt_CERTTYPE_OCSP_REQUEST
#define cryptlib_crypt_CERTTYPE_OCSP_REQUEST 11L
#undef cryptlib_crypt_CERTTYPE_OCSP_RESPONSE
#define cryptlib_crypt_CERTTYPE_OCSP_RESPONSE 12L
#undef cryptlib_crypt_CERTTYPE_PKIUSER
#define cryptlib_crypt_CERTTYPE_PKIUSER 13L
#undef cryptlib_crypt_CERTTYPE_LAST
#define cryptlib_crypt_CERTTYPE_LAST 14L
#undef cryptlib_crypt_FORMAT_NONE
#define cryptlib_crypt_FORMAT_NONE 0L
#undef cryptlib_crypt_FORMAT_AUTO
#define cryptlib_crypt_FORMAT_AUTO 1L
#undef cryptlib_crypt_FORMAT_CRYPTLIB
#define cryptlib_crypt_FORMAT_CRYPTLIB 2L
#undef cryptlib_crypt_FORMAT_CMS
#define cryptlib_crypt_FORMAT_CMS 3L
#undef cryptlib_crypt_FORMAT_PKCS7
#define cryptlib_crypt_FORMAT_PKCS7 3L
#undef cryptlib_crypt_FORMAT_SMIME
#define cryptlib_crypt_FORMAT_SMIME 4L
#undef cryptlib_crypt_FORMAT_PGP
#define cryptlib_crypt_FORMAT_PGP 5L
#undef cryptlib_crypt_FORMAT_LAST
#define cryptlib_crypt_FORMAT_LAST 6L
#undef cryptlib_crypt_SESSION_NONE
#define cryptlib_crypt_SESSION_NONE 0L
#undef cryptlib_crypt_SESSION_SSH
#define cryptlib_crypt_SESSION_SSH 1L
#undef cryptlib_crypt_SESSION_SSH_SERVER
#define cryptlib_crypt_SESSION_SSH_SERVER 2L
#undef cryptlib_crypt_SESSION_SSL
#define cryptlib_crypt_SESSION_SSL 3L
#undef cryptlib_crypt_SESSION_SSL_SERVER
#define cryptlib_crypt_SESSION_SSL_SERVER 4L
#undef cryptlib_crypt_SESSION_RTCS
#define cryptlib_crypt_SESSION_RTCS 5L
#undef cryptlib_crypt_SESSION_RTCS_SERVER
#define cryptlib_crypt_SESSION_RTCS_SERVER 6L
#undef cryptlib_crypt_SESSION_OCSP
#define cryptlib_crypt_SESSION_OCSP 7L
#undef cryptlib_crypt_SESSION_OCSP_SERVER
#define cryptlib_crypt_SESSION_OCSP_SERVER 8L
#undef cryptlib_crypt_SESSION_TSP
#define cryptlib_crypt_SESSION_TSP 9L
#undef cryptlib_crypt_SESSION_TSP_SERVER
#define cryptlib_crypt_SESSION_TSP_SERVER 10L
#undef cryptlib_crypt_SESSION_CMP
#define cryptlib_crypt_SESSION_CMP 11L
#undef cryptlib_crypt_SESSION_CMP_SERVER
#define cryptlib_crypt_SESSION_CMP_SERVER 12L
#undef cryptlib_crypt_SESSION_SCEP
#define cryptlib_crypt_SESSION_SCEP 13L
#undef cryptlib_crypt_SESSION_SCEP_SERVER
#define cryptlib_crypt_SESSION_SCEP_SERVER 14L
#undef cryptlib_crypt_SESSION_CERTSTORE_SERVER
#define cryptlib_crypt_SESSION_CERTSTORE_SERVER 15L
#undef cryptlib_crypt_SESSION_LAST
#define cryptlib_crypt_SESSION_LAST 16L
#undef cryptlib_crypt_USER_NONE
#define cryptlib_crypt_USER_NONE 0L
#undef cryptlib_crypt_USER_NORMAL
#define cryptlib_crypt_USER_NORMAL 1L
#undef cryptlib_crypt_USER_SO
#define cryptlib_crypt_USER_SO 2L
#undef cryptlib_crypt_USER_CA
#define cryptlib_crypt_USER_CA 3L
#undef cryptlib_crypt_USER_LAST
#define cryptlib_crypt_USER_LAST 4L
#undef cryptlib_crypt_ATTRIBUTE_NONE
#define cryptlib_crypt_ATTRIBUTE_NONE 0L
#undef cryptlib_crypt_PROPERTY_FIRST
#define cryptlib_crypt_PROPERTY_FIRST 1L
#undef cryptlib_crypt_PROPERTY_HIGHSECURITY
#define cryptlib_crypt_PROPERTY_HIGHSECURITY 2L
#undef cryptlib_crypt_PROPERTY_OWNER
#define cryptlib_crypt_PROPERTY_OWNER 3L
#undef cryptlib_crypt_PROPERTY_FORWARDCOUNT
#define cryptlib_crypt_PROPERTY_FORWARDCOUNT 4L
#undef cryptlib_crypt_PROPERTY_LOCKED
#define cryptlib_crypt_PROPERTY_LOCKED 5L
#undef cryptlib_crypt_PROPERTY_USAGECOUNT
#define cryptlib_crypt_PROPERTY_USAGECOUNT 6L
#undef cryptlib_crypt_PROPERTY_NONEXPORTABLE
#define cryptlib_crypt_PROPERTY_NONEXPORTABLE 7L
#undef cryptlib_crypt_PROPERTY_LAST
#define cryptlib_crypt_PROPERTY_LAST 8L
#undef cryptlib_crypt_GENERIC_FIRST
#define cryptlib_crypt_GENERIC_FIRST 9L
#undef cryptlib_crypt_ATTRIBUTE_ERRORTYPE
#define cryptlib_crypt_ATTRIBUTE_ERRORTYPE 10L
#undef cryptlib_crypt_ATTRIBUTE_ERRORLOCUS
#define cryptlib_crypt_ATTRIBUTE_ERRORLOCUS 11L
#undef cryptlib_crypt_ATTRIBUTE_INT_ERRORCODE
#define cryptlib_crypt_ATTRIBUTE_INT_ERRORCODE 12L
#undef cryptlib_crypt_ATTRIBUTE_INT_ERRORMESSAGE
#define cryptlib_crypt_ATTRIBUTE_INT_ERRORMESSAGE 13L
#undef cryptlib_crypt_ATTRIBUTE_CURRENT_GROUP
#define cryptlib_crypt_ATTRIBUTE_CURRENT_GROUP 14L
#undef cryptlib_crypt_ATTRIBUTE_CURRENT
#define cryptlib_crypt_ATTRIBUTE_CURRENT 15L
#undef cryptlib_crypt_ATTRIBUTE_CURRENT_INSTANCE
#define cryptlib_crypt_ATTRIBUTE_CURRENT_INSTANCE 16L
#undef cryptlib_crypt_ATTRIBUTE_BUFFERSIZE
#define cryptlib_crypt_ATTRIBUTE_BUFFERSIZE 17L
#undef cryptlib_crypt_GENERIC_LAST
#define cryptlib_crypt_GENERIC_LAST 18L
#undef cryptlib_crypt_OPTION_FIRST
#define cryptlib_crypt_OPTION_FIRST 100L
#undef cryptlib_crypt_OPTION_INFO_DESCRIPTION
#define cryptlib_crypt_OPTION_INFO_DESCRIPTION 101L
#undef cryptlib_crypt_OPTION_INFO_COPYRIGHT
#define cryptlib_crypt_OPTION_INFO_COPYRIGHT 102L
#undef cryptlib_crypt_OPTION_INFO_MAJORVERSION
#define cryptlib_crypt_OPTION_INFO_MAJORVERSION 103L
#undef cryptlib_crypt_OPTION_INFO_MINORVERSION
#define cryptlib_crypt_OPTION_INFO_MINORVERSION 104L
#undef cryptlib_crypt_OPTION_INFO_STEPPING
#define cryptlib_crypt_OPTION_INFO_STEPPING 105L
#undef cryptlib_crypt_OPTION_ENCR_ALGO
#define cryptlib_crypt_OPTION_ENCR_ALGO 106L
#undef cryptlib_crypt_OPTION_ENCR_HASH
#define cryptlib_crypt_OPTION_ENCR_HASH 107L
#undef cryptlib_crypt_OPTION_ENCR_MAC
#define cryptlib_crypt_OPTION_ENCR_MAC 108L
#undef cryptlib_crypt_OPTION_PKC_ALGO
#define cryptlib_crypt_OPTION_PKC_ALGO 109L
#undef cryptlib_crypt_OPTION_PKC_KEYSIZE
#define cryptlib_crypt_OPTION_PKC_KEYSIZE 110L
#undef cryptlib_crypt_OPTION_SIG_ALGO
#define cryptlib_crypt_OPTION_SIG_ALGO 111L
#undef cryptlib_crypt_OPTION_SIG_KEYSIZE
#define cryptlib_crypt_OPTION_SIG_KEYSIZE 112L
#undef cryptlib_crypt_OPTION_KEYING_ALGO
#define cryptlib_crypt_OPTION_KEYING_ALGO 113L
#undef cryptlib_crypt_OPTION_KEYING_ITERATIONS
#define cryptlib_crypt_OPTION_KEYING_ITERATIONS 114L
#undef cryptlib_crypt_OPTION_CERT_SIGNUNRECOGNISEDATTRIBUTES
#define cryptlib_crypt_OPTION_CERT_SIGNUNRECOGNISEDATTRIBUTES 115L
#undef cryptlib_crypt_OPTION_CERT_VALIDITY
#define cryptlib_crypt_OPTION_CERT_VALIDITY 116L
#undef cryptlib_crypt_OPTION_CERT_UPDATEINTERVAL
#define cryptlib_crypt_OPTION_CERT_UPDATEINTERVAL 117L
#undef cryptlib_crypt_OPTION_CERT_COMPLIANCELEVEL
#define cryptlib_crypt_OPTION_CERT_COMPLIANCELEVEL 118L
#undef cryptlib_crypt_OPTION_CERT_REQUIREPOLICY
#define cryptlib_crypt_OPTION_CERT_REQUIREPOLICY 119L
#undef cryptlib_crypt_OPTION_CMS_DEFAULTATTRIBUTES
#define cryptlib_crypt_OPTION_CMS_DEFAULTATTRIBUTES 120L
#undef cryptlib_crypt_OPTION_SMIME_DEFAULTATTRIBUTES
#define cryptlib_crypt_OPTION_SMIME_DEFAULTATTRIBUTES 120L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_OBJECTCLASS
#define cryptlib_crypt_OPTION_KEYS_LDAP_OBJECTCLASS 121L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_OBJECTTYPE
#define cryptlib_crypt_OPTION_KEYS_LDAP_OBJECTTYPE 122L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_FILTER
#define cryptlib_crypt_OPTION_KEYS_LDAP_FILTER 123L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_CACERTNAME
#define cryptlib_crypt_OPTION_KEYS_LDAP_CACERTNAME 124L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_CERTNAME
#define cryptlib_crypt_OPTION_KEYS_LDAP_CERTNAME 125L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_CRLNAME
#define cryptlib_crypt_OPTION_KEYS_LDAP_CRLNAME 126L
#undef cryptlib_crypt_OPTION_KEYS_LDAP_EMAILNAME
#define cryptlib_crypt_OPTION_KEYS_LDAP_EMAILNAME 127L
#undef cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR01
#define cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR01 128L
#undef cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR02
#define cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR02 129L
#undef cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR03
#define cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR03 130L
#undef cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR04
#define cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR04 131L
#undef cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR05
#define cryptlib_crypt_OPTION_DEVICE_PKCS11_DVR05 132L
#undef cryptlib_crypt_OPTION_DEVICE_PKCS11_HARDWAREONLY
#define cryptlib_crypt_OPTION_DEVICE_PKCS11_HARDWAREONLY 133L
#undef cryptlib_crypt_OPTION_NET_SOCKS_SERVER
#define cryptlib_crypt_OPTION_NET_SOCKS_SERVER 134L
#undef cryptlib_crypt_OPTION_NET_SOCKS_USERNAME
#define cryptlib_crypt_OPTION_NET_SOCKS_USERNAME 135L
#undef cryptlib_crypt_OPTION_NET_HTTP_PROXY
#define cryptlib_crypt_OPTION_NET_HTTP_PROXY 136L
#undef cryptlib_crypt_OPTION_NET_CONNECTTIMEOUT
#define cryptlib_crypt_OPTION_NET_CONNECTTIMEOUT 137L
#undef cryptlib_crypt_OPTION_NET_READTIMEOUT
#define cryptlib_crypt_OPTION_NET_READTIMEOUT 138L
#undef cryptlib_crypt_OPTION_NET_WRITETIMEOUT
#define cryptlib_crypt_OPTION_NET_WRITETIMEOUT 139L
#undef cryptlib_crypt_OPTION_MISC_ASYNCINIT
#define cryptlib_crypt_OPTION_MISC_ASYNCINIT 140L
#undef cryptlib_crypt_OPTION_MISC_SIDECHANNELPROTECTION
#define cryptlib_crypt_OPTION_MISC_SIDECHANNELPROTECTION 141L
#undef cryptlib_crypt_OPTION_CONFIGCHANGED
#define cryptlib_crypt_OPTION_CONFIGCHANGED 142L
#undef cryptlib_crypt_OPTION_SELFTESTOK
#define cryptlib_crypt_OPTION_SELFTESTOK 143L
#undef cryptlib_crypt_OPTION_LAST
#define cryptlib_crypt_OPTION_LAST 144L
#undef cryptlib_crypt_CTXINFO_FIRST
#define cryptlib_crypt_CTXINFO_FIRST 1000L
#undef cryptlib_crypt_CTXINFO_ALGO
#define cryptlib_crypt_CTXINFO_ALGO 1001L
#undef cryptlib_crypt_CTXINFO_MODE
#define cryptlib_crypt_CTXINFO_MODE 1002L
#undef cryptlib_crypt_CTXINFO_NAME_ALGO
#define cryptlib_crypt_CTXINFO_NAME_ALGO 1003L
#undef cryptlib_crypt_CTXINFO_NAME_MODE
#define cryptlib_crypt_CTXINFO_NAME_MODE 1004L
#undef cryptlib_crypt_CTXINFO_KEYSIZE
#define cryptlib_crypt_CTXINFO_KEYSIZE 1005L
#undef cryptlib_crypt_CTXINFO_BLOCKSIZE
#define cryptlib_crypt_CTXINFO_BLOCKSIZE 1006L
#undef cryptlib_crypt_CTXINFO_IVSIZE
#define cryptlib_crypt_CTXINFO_IVSIZE 1007L
#undef cryptlib_crypt_CTXINFO_KEYING_ALGO
#define cryptlib_crypt_CTXINFO_KEYING_ALGO 1008L
#undef cryptlib_crypt_CTXINFO_KEYING_ITERATIONS
#define cryptlib_crypt_CTXINFO_KEYING_ITERATIONS 1009L
#undef cryptlib_crypt_CTXINFO_KEYING_SALT
#define cryptlib_crypt_CTXINFO_KEYING_SALT 1010L
#undef cryptlib_crypt_CTXINFO_KEYING_VALUE
#define cryptlib_crypt_CTXINFO_KEYING_VALUE 1011L
#undef cryptlib_crypt_CTXINFO_KEY
#define cryptlib_crypt_CTXINFO_KEY 1012L
#undef cryptlib_crypt_CTXINFO_KEY_COMPONENTS
#define cryptlib_crypt_CTXINFO_KEY_COMPONENTS 1013L
#undef cryptlib_crypt_CTXINFO_IV
#define cryptlib_crypt_CTXINFO_IV 1014L
#undef cryptlib_crypt_CTXINFO_HASHVALUE
#define cryptlib_crypt_CTXINFO_HASHVALUE 1015L
#undef cryptlib_crypt_CTXINFO_LABEL
#define cryptlib_crypt_CTXINFO_LABEL 1016L
#undef cryptlib_crypt_CTXINFO_PERSISTENT
#define cryptlib_crypt_CTXINFO_PERSISTENT 1017L
#undef cryptlib_crypt_CTXINFO_LAST
#define cryptlib_crypt_CTXINFO_LAST 1018L
#undef cryptlib_crypt_CERTINFO_FIRST
#define cryptlib_crypt_CERTINFO_FIRST 2000L
#undef cryptlib_crypt_CERTINFO_SELFSIGNED
#define cryptlib_crypt_CERTINFO_SELFSIGNED 2001L
#undef cryptlib_crypt_CERTINFO_IMMUTABLE
#define cryptlib_crypt_CERTINFO_IMMUTABLE 2002L
#undef cryptlib_crypt_CERTINFO_XYZZY
#define cryptlib_crypt_CERTINFO_XYZZY 2003L
#undef cryptlib_crypt_CERTINFO_CERTTYPE
#define cryptlib_crypt_CERTINFO_CERTTYPE 2004L
#undef cryptlib_crypt_CERTINFO_FINGERPRINT
#define cryptlib_crypt_CERTINFO_FINGERPRINT 2005L
#undef cryptlib_crypt_CERTINFO_FINGERPRINT_MD5
#define cryptlib_crypt_CERTINFO_FINGERPRINT_MD5 2005L
#undef cryptlib_crypt_CERTINFO_FINGERPRINT_SHA
#define cryptlib_crypt_CERTINFO_FINGERPRINT_SHA 2006L
#undef cryptlib_crypt_CERTINFO_CURRENT_CERTIFICATE
#define cryptlib_crypt_CERTINFO_CURRENT_CERTIFICATE 2007L
#undef cryptlib_crypt_CERTINFO_TRUSTED_USAGE
#define cryptlib_crypt_CERTINFO_TRUSTED_USAGE 2008L
#undef cryptlib_crypt_CERTINFO_TRUSTED_IMPLICIT
#define cryptlib_crypt_CERTINFO_TRUSTED_IMPLICIT 2009L
#undef cryptlib_crypt_CERTINFO_SIGNATURELEVEL
#define cryptlib_crypt_CERTINFO_SIGNATURELEVEL 2010L
#undef cryptlib_crypt_CERTINFO_VERSION
#define cryptlib_crypt_CERTINFO_VERSION 2011L
#undef cryptlib_crypt_CERTINFO_SERIALNUMBER
#define cryptlib_crypt_CERTINFO_SERIALNUMBER 2012L
#undef cryptlib_crypt_CERTINFO_SUBJECTPUBLICKEYINFO
#define cryptlib_crypt_CERTINFO_SUBJECTPUBLICKEYINFO 2013L
#undef cryptlib_crypt_CERTINFO_CERTIFICATE
#define cryptlib_crypt_CERTINFO_CERTIFICATE 2014L
#undef cryptlib_crypt_CERTINFO_USERCERTIFICATE
#define cryptlib_crypt_CERTINFO_USERCERTIFICATE 2014L
#undef cryptlib_crypt_CERTINFO_CACERTIFICATE
#define cryptlib_crypt_CERTINFO_CACERTIFICATE 2015L
#undef cryptlib_crypt_CERTINFO_ISSUERNAME
#define cryptlib_crypt_CERTINFO_ISSUERNAME 2016L
#undef cryptlib_crypt_CERTINFO_VALIDFROM
#define cryptlib_crypt_CERTINFO_VALIDFROM 2017L
#undef cryptlib_crypt_CERTINFO_VALIDTO
#define cryptlib_crypt_CERTINFO_VALIDTO 2018L
#undef cryptlib_crypt_CERTINFO_SUBJECTNAME
#define cryptlib_crypt_CERTINFO_SUBJECTNAME 2019L
#undef cryptlib_crypt_CERTINFO_ISSUERUNIQUEID
#define cryptlib_crypt_CERTINFO_ISSUERUNIQUEID 2020L
#undef cryptlib_crypt_CERTINFO_SUBJECTUNIQUEID
#define cryptlib_crypt_CERTINFO_SUBJECTUNIQUEID 2021L
#undef cryptlib_crypt_CERTINFO_CERTREQUEST
#define cryptlib_crypt_CERTINFO_CERTREQUEST 2022L
#undef cryptlib_crypt_CERTINFO_THISUPDATE
#define cryptlib_crypt_CERTINFO_THISUPDATE 2023L
#undef cryptlib_crypt_CERTINFO_NEXTUPDATE
#define cryptlib_crypt_CERTINFO_NEXTUPDATE 2024L
#undef cryptlib_crypt_CERTINFO_REVOCATIONDATE
#define cryptlib_crypt_CERTINFO_REVOCATIONDATE 2025L
#undef cryptlib_crypt_CERTINFO_REVOCATIONSTATUS
#define cryptlib_crypt_CERTINFO_REVOCATIONSTATUS 2026L
#undef cryptlib_crypt_CERTINFO_CERTSTATUS
#define cryptlib_crypt_CERTINFO_CERTSTATUS 2027L
#undef cryptlib_crypt_CERTINFO_DN
#define cryptlib_crypt_CERTINFO_DN 2028L
#undef cryptlib_crypt_CERTINFO_PKIUSER_ID
#define cryptlib_crypt_CERTINFO_PKIUSER_ID 2029L
#undef cryptlib_crypt_CERTINFO_PKIUSER_ISSUEPASSWORD
#define cryptlib_crypt_CERTINFO_PKIUSER_ISSUEPASSWORD 2030L
#undef cryptlib_crypt_CERTINFO_PKIUSER_REVPASSWORD
#define cryptlib_crypt_CERTINFO_PKIUSER_REVPASSWORD 2031L
#undef cryptlib_crypt_CERTINFO_COUNTRYNAME
#define cryptlib_crypt_CERTINFO_COUNTRYNAME 2100L
#undef cryptlib_crypt_CERTINFO_STATEORPROVINCENAME
#define cryptlib_crypt_CERTINFO_STATEORPROVINCENAME 2101L
#undef cryptlib_crypt_CERTINFO_LOCALITYNAME
#define cryptlib_crypt_CERTINFO_LOCALITYNAME 2102L
#undef cryptlib_crypt_CERTINFO_ORGANIZATIONNAME
#define cryptlib_crypt_CERTINFO_ORGANIZATIONNAME 2103L
#undef cryptlib_crypt_CERTINFO_ORGANISATIONNAME
#define cryptlib_crypt_CERTINFO_ORGANISATIONNAME 2103L
#undef cryptlib_crypt_CERTINFO_ORGANIZATIONALUNITNAME
#define cryptlib_crypt_CERTINFO_ORGANIZATIONALUNITNAME 2104L
#undef cryptlib_crypt_CERTINFO_ORGANISATIONALUNITNAME
#define cryptlib_crypt_CERTINFO_ORGANISATIONALUNITNAME 2104L
#undef cryptlib_crypt_CERTINFO_COMMONNAME
#define cryptlib_crypt_CERTINFO_COMMONNAME 2105L
#undef cryptlib_crypt_CERTINFO_OTHERNAME_TYPEID
#define cryptlib_crypt_CERTINFO_OTHERNAME_TYPEID 2106L
#undef cryptlib_crypt_CERTINFO_OTHERNAME_VALUE
#define cryptlib_crypt_CERTINFO_OTHERNAME_VALUE 2107L
#undef cryptlib_crypt_CERTINFO_RFC822NAME
#define cryptlib_crypt_CERTINFO_RFC822NAME 2108L
#undef cryptlib_crypt_CERTINFO_EMAIL
#define cryptlib_crypt_CERTINFO_EMAIL 2108L
#undef cryptlib_crypt_CERTINFO_DNSNAME
#define cryptlib_crypt_CERTINFO_DNSNAME 2109L
#undef cryptlib_crypt_CERTINFO_DIRECTORYNAME
#define cryptlib_crypt_CERTINFO_DIRECTORYNAME 2110L
#undef cryptlib_crypt_CERTINFO_EDIPARTYNAME_NAMEASSIGNER
#define cryptlib_crypt_CERTINFO_EDIPARTYNAME_NAMEASSIGNER 2111L
#undef cryptlib_crypt_CERTINFO_EDIPARTYNAME_PARTYNAME
#define cryptlib_crypt_CERTINFO_EDIPARTYNAME_PARTYNAME 2112L
#undef cryptlib_crypt_CERTINFO_UNIFORMRESOURCEIDENTIFIER
#define cryptlib_crypt_CERTINFO_UNIFORMRESOURCEIDENTIFIER 2113L
#undef cryptlib_crypt_CERTINFO_IPADDRESS
#define cryptlib_crypt_CERTINFO_IPADDRESS 2114L
#undef cryptlib_crypt_CERTINFO_REGISTEREDID
#define cryptlib_crypt_CERTINFO_REGISTEREDID 2115L
#undef cryptlib_crypt_CERTINFO_CHALLENGEPASSWORD
#define cryptlib_crypt_CERTINFO_CHALLENGEPASSWORD 2200L
#undef cryptlib_crypt_CERTINFO_CRLEXTREASON
#define cryptlib_crypt_CERTINFO_CRLEXTREASON 2201L
#undef cryptlib_crypt_CERTINFO_KEYFEATURES
#define cryptlib_crypt_CERTINFO_KEYFEATURES 2202L
#undef cryptlib_crypt_CERTINFO_AUTHORITYINFOACCESS
#define cryptlib_crypt_CERTINFO_AUTHORITYINFOACCESS 2203L
#undef cryptlib_crypt_CERTINFO_AUTHORITYINFO_RTCS
#define cryptlib_crypt_CERTINFO_AUTHORITYINFO_RTCS 2204L
#undef cryptlib_crypt_CERTINFO_AUTHORITYINFO_OCSP
#define cryptlib_crypt_CERTINFO_AUTHORITYINFO_OCSP 2205L
#undef cryptlib_crypt_CERTINFO_AUTHORITYINFO_CAISSUERS
#define cryptlib_crypt_CERTINFO_AUTHORITYINFO_CAISSUERS 2206L
#undef cryptlib_crypt_CERTINFO_AUTHORITYINFO_CERTSTORE
#define cryptlib_crypt_CERTINFO_AUTHORITYINFO_CERTSTORE 2207L
#undef cryptlib_crypt_CERTINFO_AUTHORITYINFO_CRLS
#define cryptlib_crypt_CERTINFO_AUTHORITYINFO_CRLS 2208L
#undef cryptlib_crypt_CERTINFO_BIOMETRICINFO
#define cryptlib_crypt_CERTINFO_BIOMETRICINFO 2209L
#undef cryptlib_crypt_CERTINFO_BIOMETRICINFO_TYPE
#define cryptlib_crypt_CERTINFO_BIOMETRICINFO_TYPE 2210L
#undef cryptlib_crypt_CERTINFO_BIOMETRICINFO_HASHALGO
#define cryptlib_crypt_CERTINFO_BIOMETRICINFO_HASHALGO 2211L
#undef cryptlib_crypt_CERTINFO_BIOMETRICINFO_HASH
#define cryptlib_crypt_CERTINFO_BIOMETRICINFO_HASH 2212L
#undef cryptlib_crypt_CERTINFO_BIOMETRICINFO_URL
#define cryptlib_crypt_CERTINFO_BIOMETRICINFO_URL 2213L
#undef cryptlib_crypt_CERTINFO_QCSTATEMENT
#define cryptlib_crypt_CERTINFO_QCSTATEMENT 2214L
#undef cryptlib_crypt_CERTINFO_QCSTATEMENT_SEMANTICS
#define cryptlib_crypt_CERTINFO_QCSTATEMENT_SEMANTICS 2215L
#undef cryptlib_crypt_CERTINFO_QCSTATEMENT_REGISTRATIONAUTHORITY
#define cryptlib_crypt_CERTINFO_QCSTATEMENT_REGISTRATIONAUTHORITY 2216L
#undef cryptlib_crypt_CERTINFO_OCSP_NONCE
#define cryptlib_crypt_CERTINFO_OCSP_NONCE 2217L
#undef cryptlib_crypt_CERTINFO_OCSP_RESPONSE
#define cryptlib_crypt_CERTINFO_OCSP_RESPONSE 2218L
#undef cryptlib_crypt_CERTINFO_OCSP_RESPONSE_OCSP
#define cryptlib_crypt_CERTINFO_OCSP_RESPONSE_OCSP 2219L
#undef cryptlib_crypt_CERTINFO_OCSP_NOCHECK
#define cryptlib_crypt_CERTINFO_OCSP_NOCHECK 2220L
#undef cryptlib_crypt_CERTINFO_OCSP_ARCHIVECUTOFF
#define cryptlib_crypt_CERTINFO_OCSP_ARCHIVECUTOFF 2221L
#undef cryptlib_crypt_CERTINFO_SUBJECTINFOACCESS
#define cryptlib_crypt_CERTINFO_SUBJECTINFOACCESS 2222L
#undef cryptlib_crypt_CERTINFO_SUBJECTINFO_CAREPOSITORY
#define cryptlib_crypt_CERTINFO_SUBJECTINFO_CAREPOSITORY 2223L
#undef cryptlib_crypt_CERTINFO_SUBJECTINFO_TIMESTAMPING
#define cryptlib_crypt_CERTINFO_SUBJECTINFO_TIMESTAMPING 2224L
#undef cryptlib_crypt_CERTINFO_SIGG_DATEOFCERTGEN
#define cryptlib_crypt_CERTINFO_SIGG_DATEOFCERTGEN 2225L
#undef cryptlib_crypt_CERTINFO_SIGG_PROCURATION
#define cryptlib_crypt_CERTINFO_SIGG_PROCURATION 2226L
#undef cryptlib_crypt_CERTINFO_SIGG_PROCURE_COUNTRY
#define cryptlib_crypt_CERTINFO_SIGG_PROCURE_COUNTRY 2227L
#undef cryptlib_crypt_CERTINFO_SIGG_PROCURE_TYPEOFSUBSTITUTION
#define cryptlib_crypt_CERTINFO_SIGG_PROCURE_TYPEOFSUBSTITUTION 2228L
#undef cryptlib_crypt_CERTINFO_SIGG_PROCURE_SIGNINGFOR
#define cryptlib_crypt_CERTINFO_SIGG_PROCURE_SIGNINGFOR 2229L
#undef cryptlib_crypt_CERTINFO_SIGG_MONETARYLIMIT
#define cryptlib_crypt_CERTINFO_SIGG_MONETARYLIMIT 2230L
#undef cryptlib_crypt_CERTINFO_SIGG_MONETARY_CURRENCY
#define cryptlib_crypt_CERTINFO_SIGG_MONETARY_CURRENCY 2231L
#undef cryptlib_crypt_CERTINFO_SIGG_MONETARY_AMOUNT
#define cryptlib_crypt_CERTINFO_SIGG_MONETARY_AMOUNT 2232L
#undef cryptlib_crypt_CERTINFO_SIGG_MONETARY_EXPONENT
#define cryptlib_crypt_CERTINFO_SIGG_MONETARY_EXPONENT 2233L
#undef cryptlib_crypt_CERTINFO_SIGG_RESTRICTION
#define cryptlib_crypt_CERTINFO_SIGG_RESTRICTION 2234L
#undef cryptlib_crypt_CERTINFO_STRONGEXTRANET
#define cryptlib_crypt_CERTINFO_STRONGEXTRANET 2235L
#undef cryptlib_crypt_CERTINFO_STRONGEXTRANET_ZONE
#define cryptlib_crypt_CERTINFO_STRONGEXTRANET_ZONE 2236L
#undef cryptlib_crypt_CERTINFO_STRONGEXTRANET_ID
#define cryptlib_crypt_CERTINFO_STRONGEXTRANET_ID 2237L
#undef cryptlib_crypt_CERTINFO_SUBJECTDIRECTORYATTRIBUTES
#define cryptlib_crypt_CERTINFO_SUBJECTDIRECTORYATTRIBUTES 2238L
#undef cryptlib_crypt_CERTINFO_SUBJECTDIR_TYPE
#define cryptlib_crypt_CERTINFO_SUBJECTDIR_TYPE 2239L
#undef cryptlib_crypt_CERTINFO_SUBJECTDIR_VALUES
#define cryptlib_crypt_CERTINFO_SUBJECTDIR_VALUES 2240L
#undef cryptlib_crypt_CERTINFO_SUBJECTKEYIDENTIFIER
#define cryptlib_crypt_CERTINFO_SUBJECTKEYIDENTIFIER 2241L
#undef cryptlib_crypt_CERTINFO_KEYUSAGE
#define cryptlib_crypt_CERTINFO_KEYUSAGE 2242L
#undef cryptlib_crypt_CERTINFO_PRIVATEKEYUSAGEPERIOD
#define cryptlib_crypt_CERTINFO_PRIVATEKEYUSAGEPERIOD 2243L
#undef cryptlib_crypt_CERTINFO_PRIVATEKEY_NOTBEFORE
#define cryptlib_crypt_CERTINFO_PRIVATEKEY_NOTBEFORE 2244L
#undef cryptlib_crypt_CERTINFO_PRIVATEKEY_NOTAFTER
#define cryptlib_crypt_CERTINFO_PRIVATEKEY_NOTAFTER 2245L
#undef cryptlib_crypt_CERTINFO_SUBJECTALTNAME
#define cryptlib_crypt_CERTINFO_SUBJECTALTNAME 2246L
#undef cryptlib_crypt_CERTINFO_ISSUERALTNAME
#define cryptlib_crypt_CERTINFO_ISSUERALTNAME 2247L
#undef cryptlib_crypt_CERTINFO_BASICCONSTRAINTS
#define cryptlib_crypt_CERTINFO_BASICCONSTRAINTS 2248L
#undef cryptlib_crypt_CERTINFO_CA
#define cryptlib_crypt_CERTINFO_CA 2249L
#undef cryptlib_crypt_CERTINFO_AUTHORITY
#define cryptlib_crypt_CERTINFO_AUTHORITY 2249L
#undef cryptlib_crypt_CERTINFO_PATHLENCONSTRAINT
#define cryptlib_crypt_CERTINFO_PATHLENCONSTRAINT 2250L
#undef cryptlib_crypt_CERTINFO_CRLNUMBER
#define cryptlib_crypt_CERTINFO_CRLNUMBER 2251L
#undef cryptlib_crypt_CERTINFO_CRLREASON
#define cryptlib_crypt_CERTINFO_CRLREASON 2252L
#undef cryptlib_crypt_CERTINFO_HOLDINSTRUCTIONCODE
#define cryptlib_crypt_CERTINFO_HOLDINSTRUCTIONCODE 2253L
#undef cryptlib_crypt_CERTINFO_INVALIDITYDATE
#define cryptlib_crypt_CERTINFO_INVALIDITYDATE 2254L
#undef cryptlib_crypt_CERTINFO_DELTACRLINDICATOR
#define cryptlib_crypt_CERTINFO_DELTACRLINDICATOR 2255L
#undef cryptlib_crypt_CERTINFO_ISSUINGDISTRIBUTIONPOINT
#define cryptlib_crypt_CERTINFO_ISSUINGDISTRIBUTIONPOINT 2256L
#undef cryptlib_crypt_CERTINFO_ISSUINGDIST_FULLNAME
#define cryptlib_crypt_CERTINFO_ISSUINGDIST_FULLNAME 2257L
#undef cryptlib_crypt_CERTINFO_ISSUINGDIST_USERCERTSONLY
#define cryptlib_crypt_CERTINFO_ISSUINGDIST_USERCERTSONLY 2258L
#undef cryptlib_crypt_CERTINFO_ISSUINGDIST_CACERTSONLY
#define cryptlib_crypt_CERTINFO_ISSUINGDIST_CACERTSONLY 2259L
#undef cryptlib_crypt_CERTINFO_ISSUINGDIST_SOMEREASONSONLY
#define cryptlib_crypt_CERTINFO_ISSUINGDIST_SOMEREASONSONLY 2260L
#undef cryptlib_crypt_CERTINFO_ISSUINGDIST_INDIRECTCRL
#define cryptlib_crypt_CERTINFO_ISSUINGDIST_INDIRECTCRL 2261L
#undef cryptlib_crypt_CERTINFO_CERTIFICATEISSUER
#define cryptlib_crypt_CERTINFO_CERTIFICATEISSUER 2262L
#undef cryptlib_crypt_CERTINFO_NAMECONSTRAINTS
#define cryptlib_crypt_CERTINFO_NAMECONSTRAINTS 2263L
#undef cryptlib_crypt_CERTINFO_PERMITTEDSUBTREES
#define cryptlib_crypt_CERTINFO_PERMITTEDSUBTREES 2264L
#undef cryptlib_crypt_CERTINFO_EXCLUDEDSUBTREES
#define cryptlib_crypt_CERTINFO_EXCLUDEDSUBTREES 2265L
#undef cryptlib_crypt_CERTINFO_CRLDISTRIBUTIONPOINT
#define cryptlib_crypt_CERTINFO_CRLDISTRIBUTIONPOINT 2266L
#undef cryptlib_crypt_CERTINFO_CRLDIST_FULLNAME
#define cryptlib_crypt_CERTINFO_CRLDIST_FULLNAME 2267L
#undef cryptlib_crypt_CERTINFO_CRLDIST_REASONS
#define cryptlib_crypt_CERTINFO_CRLDIST_REASONS 2268L
#undef cryptlib_crypt_CERTINFO_CRLDIST_CRLISSUER
#define cryptlib_crypt_CERTINFO_CRLDIST_CRLISSUER 2269L
#undef cryptlib_crypt_CERTINFO_CERTIFICATEPOLICIES
#define cryptlib_crypt_CERTINFO_CERTIFICATEPOLICIES 2270L
#undef cryptlib_crypt_CERTINFO_CERTPOLICYID
#define cryptlib_crypt_CERTINFO_CERTPOLICYID 2271L
#undef cryptlib_crypt_CERTINFO_CERTPOLICY_CPSURI
#define cryptlib_crypt_CERTINFO_CERTPOLICY_CPSURI 2272L
#undef cryptlib_crypt_CERTINFO_CERTPOLICY_ORGANIZATION
#define cryptlib_crypt_CERTINFO_CERTPOLICY_ORGANIZATION 2273L
#undef cryptlib_crypt_CERTINFO_CERTPOLICY_NOTICENUMBERS
#define cryptlib_crypt_CERTINFO_CERTPOLICY_NOTICENUMBERS 2274L
#undef cryptlib_crypt_CERTINFO_CERTPOLICY_EXPLICITTEXT
#define cryptlib_crypt_CERTINFO_CERTPOLICY_EXPLICITTEXT 2275L
#undef cryptlib_crypt_CERTINFO_POLICYMAPPINGS
#define cryptlib_crypt_CERTINFO_POLICYMAPPINGS 2276L
#undef cryptlib_crypt_CERTINFO_ISSUERDOMAINPOLICY
#define cryptlib_crypt_CERTINFO_ISSUERDOMAINPOLICY 2277L
#undef cryptlib_crypt_CERTINFO_SUBJECTDOMAINPOLICY
#define cryptlib_crypt_CERTINFO_SUBJECTDOMAINPOLICY 2278L
#undef cryptlib_crypt_CERTINFO_AUTHORITYKEYIDENTIFIER
#define cryptlib_crypt_CERTINFO_AUTHORITYKEYIDENTIFIER 2279L
#undef cryptlib_crypt_CERTINFO_AUTHORITY_KEYIDENTIFIER
#define cryptlib_crypt_CERTINFO_AUTHORITY_KEYIDENTIFIER 2280L
#undef cryptlib_crypt_CERTINFO_AUTHORITY_CERTISSUER
#define cryptlib_crypt_CERTINFO_AUTHORITY_CERTISSUER 2281L
#undef cryptlib_crypt_CERTINFO_AUTHORITY_CERTSERIALNUMBER
#define cryptlib_crypt_CERTINFO_AUTHORITY_CERTSERIALNUMBER 2282L
#undef cryptlib_crypt_CERTINFO_POLICYCONSTRAINTS
#define cryptlib_crypt_CERTINFO_POLICYCONSTRAINTS 2283L
#undef cryptlib_crypt_CERTINFO_REQUIREEXPLICITPOLICY
#define cryptlib_crypt_CERTINFO_REQUIREEXPLICITPOLICY 2284L
#undef cryptlib_crypt_CERTINFO_INHIBITPOLICYMAPPING
#define cryptlib_crypt_CERTINFO_INHIBITPOLICYMAPPING 2285L
#undef cryptlib_crypt_CERTINFO_EXTKEYUSAGE
#define cryptlib_crypt_CERTINFO_EXTKEYUSAGE 2286L
#undef cryptlib_crypt_CERTINFO_EXTKEY_MS_INDIVIDUALCODESIGNING
#define cryptlib_crypt_CERTINFO_EXTKEY_MS_INDIVIDUALCODESIGNING 2287L
#undef cryptlib_crypt_CERTINFO_EXTKEY_MS_COMMERCIALCODESIGNING
#define cryptlib_crypt_CERTINFO_EXTKEY_MS_COMMERCIALCODESIGNING 2288L
#undef cryptlib_crypt_CERTINFO_EXTKEY_MS_CERTTRUSTLISTSIGNING
#define cryptlib_crypt_CERTINFO_EXTKEY_MS_CERTTRUSTLISTSIGNING 2289L
#undef cryptlib_crypt_CERTINFO_EXTKEY_MS_TIMESTAMPSIGNING
#define cryptlib_crypt_CERTINFO_EXTKEY_MS_TIMESTAMPSIGNING 2290L
#undef cryptlib_crypt_CERTINFO_EXTKEY_MS_SERVERGATEDCRYPTO
#define cryptlib_crypt_CERTINFO_EXTKEY_MS_SERVERGATEDCRYPTO 2291L
#undef cryptlib_crypt_CERTINFO_EXTKEY_MS_ENCRYPTEDFILESYSTEM
#define cryptlib_crypt_CERTINFO_EXTKEY_MS_ENCRYPTEDFILESYSTEM 2292L
#undef cryptlib_crypt_CERTINFO_EXTKEY_SERVERAUTH
#define cryptlib_crypt_CERTINFO_EXTKEY_SERVERAUTH 2293L
#undef cryptlib_crypt_CERTINFO_EXTKEY_CLIENTAUTH
#define cryptlib_crypt_CERTINFO_EXTKEY_CLIENTAUTH 2294L
#undef cryptlib_crypt_CERTINFO_EXTKEY_CODESIGNING
#define cryptlib_crypt_CERTINFO_EXTKEY_CODESIGNING 2295L
#undef cryptlib_crypt_CERTINFO_EXTKEY_EMAILPROTECTION
#define cryptlib_crypt_CERTINFO_EXTKEY_EMAILPROTECTION 2296L
#undef cryptlib_crypt_CERTINFO_EXTKEY_IPSECENDSYSTEM
#define cryptlib_crypt_CERTINFO_EXTKEY_IPSECENDSYSTEM 2297L
#undef cryptlib_crypt_CERTINFO_EXTKEY_IPSECTUNNEL
#define cryptlib_crypt_CERTINFO_EXTKEY_IPSECTUNNEL 2298L
#undef cryptlib_crypt_CERTINFO_EXTKEY_IPSECUSER
#define cryptlib_crypt_CERTINFO_EXTKEY_IPSECUSER 2299L
#undef cryptlib_crypt_CERTINFO_EXTKEY_TIMESTAMPING
#define cryptlib_crypt_CERTINFO_EXTKEY_TIMESTAMPING 2300L
#undef cryptlib_crypt_CERTINFO_EXTKEY_OCSPSIGNING
#define cryptlib_crypt_CERTINFO_EXTKEY_OCSPSIGNING 2301L
#undef cryptlib_crypt_CERTINFO_EXTKEY_DIRECTORYSERVICE
#define cryptlib_crypt_CERTINFO_EXTKEY_DIRECTORYSERVICE 2302L
#undef cryptlib_crypt_CERTINFO_EXTKEY_ANYKEYUSAGE
#define cryptlib_crypt_CERTINFO_EXTKEY_ANYKEYUSAGE 2303L
#undef cryptlib_crypt_CERTINFO_EXTKEY_NS_SERVERGATEDCRYPTO
#define cryptlib_crypt_CERTINFO_EXTKEY_NS_SERVERGATEDCRYPTO 2304L
#undef cryptlib_crypt_CERTINFO_EXTKEY_VS_SERVERGATEDCRYPTO_CA
#define cryptlib_crypt_CERTINFO_EXTKEY_VS_SERVERGATEDCRYPTO_CA 2305L
#undef cryptlib_crypt_CERTINFO_FRESHESTCRL
#define cryptlib_crypt_CERTINFO_FRESHESTCRL 2306L
#undef cryptlib_crypt_CERTINFO_FRESHESTCRL_FULLNAME
#define cryptlib_crypt_CERTINFO_FRESHESTCRL_FULLNAME 2307L
#undef cryptlib_crypt_CERTINFO_FRESHESTCRL_REASONS
#define cryptlib_crypt_CERTINFO_FRESHESTCRL_REASONS 2308L
#undef cryptlib_crypt_CERTINFO_FRESHESTCRL_CRLISSUER
#define cryptlib_crypt_CERTINFO_FRESHESTCRL_CRLISSUER 2309L
#undef cryptlib_crypt_CERTINFO_INHIBITANYPOLICY
#define cryptlib_crypt_CERTINFO_INHIBITANYPOLICY 2310L
#undef cryptlib_crypt_CERTINFO_NS_CERTTYPE
#define cryptlib_crypt_CERTINFO_NS_CERTTYPE 2311L
#undef cryptlib_crypt_CERTINFO_NS_BASEURL
#define cryptlib_crypt_CERTINFO_NS_BASEURL 2312L
#undef cryptlib_crypt_CERTINFO_NS_REVOCATIONURL
#define cryptlib_crypt_CERTINFO_NS_REVOCATIONURL 2313L
#undef cryptlib_crypt_CERTINFO_NS_CAREVOCATIONURL
#define cryptlib_crypt_CERTINFO_NS_CAREVOCATIONURL 2314L
#undef cryptlib_crypt_CERTINFO_NS_CERTRENEWALURL
#define cryptlib_crypt_CERTINFO_NS_CERTRENEWALURL 2315L
#undef cryptlib_crypt_CERTINFO_NS_CAPOLICYURL
#define cryptlib_crypt_CERTINFO_NS_CAPOLICYURL 2316L
#undef cryptlib_crypt_CERTINFO_NS_SSLSERVERNAME
#define cryptlib_crypt_CERTINFO_NS_SSLSERVERNAME 2317L
#undef cryptlib_crypt_CERTINFO_NS_COMMENT
#define cryptlib_crypt_CERTINFO_NS_COMMENT 2318L
#undef cryptlib_crypt_CERTINFO_SET_HASHEDROOTKEY
#define cryptlib_crypt_CERTINFO_SET_HASHEDROOTKEY 2319L
#undef cryptlib_crypt_CERTINFO_SET_ROOTKEYTHUMBPRINT
#define cryptlib_crypt_CERTINFO_SET_ROOTKEYTHUMBPRINT 2320L
#undef cryptlib_crypt_CERTINFO_SET_CERTIFICATETYPE
#define cryptlib_crypt_CERTINFO_SET_CERTIFICATETYPE 2321L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTDATA
#define cryptlib_crypt_CERTINFO_SET_MERCHANTDATA 2322L
#undef cryptlib_crypt_CERTINFO_SET_MERID
#define cryptlib_crypt_CERTINFO_SET_MERID 2323L
#undef cryptlib_crypt_CERTINFO_SET_MERACQUIRERBIN
#define cryptlib_crypt_CERTINFO_SET_MERACQUIRERBIN 2324L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTLANGUAGE
#define cryptlib_crypt_CERTINFO_SET_MERCHANTLANGUAGE 2325L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTNAME
#define cryptlib_crypt_CERTINFO_SET_MERCHANTNAME 2326L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTCITY
#define cryptlib_crypt_CERTINFO_SET_MERCHANTCITY 2327L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTSTATEPROVINCE
#define cryptlib_crypt_CERTINFO_SET_MERCHANTSTATEPROVINCE 2328L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTPOSTALCODE
#define cryptlib_crypt_CERTINFO_SET_MERCHANTPOSTALCODE 2329L
#undef cryptlib_crypt_CERTINFO_SET_MERCHANTCOUNTRYNAME
#define cryptlib_crypt_CERTINFO_SET_MERCHANTCOUNTRYNAME 2330L
#undef cryptlib_crypt_CERTINFO_SET_MERCOUNTRY
#define cryptlib_crypt_CERTINFO_SET_MERCOUNTRY 2331L
#undef cryptlib_crypt_CERTINFO_SET_MERAUTHFLAG
#define cryptlib_crypt_CERTINFO_SET_MERAUTHFLAG 2332L
#undef cryptlib_crypt_CERTINFO_SET_CERTCARDREQUIRED
#define cryptlib_crypt_CERTINFO_SET_CERTCARDREQUIRED 2333L
#undef cryptlib_crypt_CERTINFO_SET_TUNNELING
#define cryptlib_crypt_CERTINFO_SET_TUNNELING 2334L
#undef cryptlib_crypt_CERTINFO_SET_TUNNELLING
#define cryptlib_crypt_CERTINFO_SET_TUNNELLING 2334L
#undef cryptlib_crypt_CERTINFO_SET_TUNNELINGFLAG
#define cryptlib_crypt_CERTINFO_SET_TUNNELINGFLAG 2335L
#undef cryptlib_crypt_CERTINFO_SET_TUNNELLINGFLAG
#define cryptlib_crypt_CERTINFO_SET_TUNNELLINGFLAG 2335L
#undef cryptlib_crypt_CERTINFO_SET_TUNNELINGALGID
#define cryptlib_crypt_CERTINFO_SET_TUNNELINGALGID 2336L
#undef cryptlib_crypt_CERTINFO_SET_TUNNELLINGALGID
#define cryptlib_crypt_CERTINFO_SET_TUNNELLINGALGID 2336L
#undef cryptlib_crypt_CERTINFO_CMS_CONTENTTYPE
#define cryptlib_crypt_CERTINFO_CMS_CONTENTTYPE 2500L
#undef cryptlib_crypt_CERTINFO_CMS_MESSAGEDIGEST
#define cryptlib_crypt_CERTINFO_CMS_MESSAGEDIGEST 2501L
#undef cryptlib_crypt_CERTINFO_CMS_SIGNINGTIME
#define cryptlib_crypt_CERTINFO_CMS_SIGNINGTIME 2502L
#undef cryptlib_crypt_CERTINFO_CMS_COUNTERSIGNATURE
#define cryptlib_crypt_CERTINFO_CMS_COUNTERSIGNATURE 2503L
#undef cryptlib_crypt_CERTINFO_CMS_SIGNINGDESCRIPTION
#define cryptlib_crypt_CERTINFO_CMS_SIGNINGDESCRIPTION 2504L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAPABILITIES
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAPABILITIES 2505L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_3DES
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_3DES 2506L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_AES
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_AES 2507L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_CAST128
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_CAST128 2508L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_IDEA
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_IDEA 2509L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_RC2
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_RC2 2510L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_RC5
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_RC5 2511L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_SKIPJACK
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_SKIPJACK 2512L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_DES
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_DES 2513L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_PREFERSIGNEDDATA
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_PREFERSIGNEDDATA 2514L
#undef cryptlib_crypt_CERTINFO_CMS_SMIMECAP_CANNOTDECRYPTANY
#define cryptlib_crypt_CERTINFO_CMS_SMIMECAP_CANNOTDECRYPTANY 2515L
#undef cryptlib_crypt_CERTINFO_CMS_RECEIPTREQUEST
#define cryptlib_crypt_CERTINFO_CMS_RECEIPTREQUEST 2516L
#undef cryptlib_crypt_CERTINFO_CMS_RECEIPT_CONTENTIDENTIFIER
#define cryptlib_crypt_CERTINFO_CMS_RECEIPT_CONTENTIDENTIFIER 2517L
#undef cryptlib_crypt_CERTINFO_CMS_RECEIPT_FROM
#define cryptlib_crypt_CERTINFO_CMS_RECEIPT_FROM 2518L
#undef cryptlib_crypt_CERTINFO_CMS_RECEIPT_TO
#define cryptlib_crypt_CERTINFO_CMS_RECEIPT_TO 2519L
#undef cryptlib_crypt_CERTINFO_CMS_SECURITYLABEL
#define cryptlib_crypt_CERTINFO_CMS_SECURITYLABEL 2520L
#undef cryptlib_crypt_CERTINFO_CMS_SECLABEL_POLICY
#define cryptlib_crypt_CERTINFO_CMS_SECLABEL_POLICY 2521L
#undef cryptlib_crypt_CERTINFO_CMS_SECLABEL_CLASSIFICATION
#define cryptlib_crypt_CERTINFO_CMS_SECLABEL_CLASSIFICATION 2522L
#undef cryptlib_crypt_CERTINFO_CMS_SECLABEL_PRIVACYMARK
#define cryptlib_crypt_CERTINFO_CMS_SECLABEL_PRIVACYMARK 2523L
#undef cryptlib_crypt_CERTINFO_CMS_SECLABEL_CATTYPE
#define cryptlib_crypt_CERTINFO_CMS_SECLABEL_CATTYPE 2524L
#undef cryptlib_crypt_CERTINFO_CMS_SECLABEL_CATVALUE
#define cryptlib_crypt_CERTINFO_CMS_SECLABEL_CATVALUE 2525L
#undef cryptlib_crypt_CERTINFO_CMS_MLEXPANSIONHISTORY
#define cryptlib_crypt_CERTINFO_CMS_MLEXPANSIONHISTORY 2526L
#undef cryptlib_crypt_CERTINFO_CMS_MLEXP_ENTITYIDENTIFIER
#define cryptlib_crypt_CERTINFO_CMS_MLEXP_ENTITYIDENTIFIER 2527L
#undef cryptlib_crypt_CERTINFO_CMS_MLEXP_TIME
#define cryptlib_crypt_CERTINFO_CMS_MLEXP_TIME 2528L
#undef cryptlib_crypt_CERTINFO_CMS_MLEXP_NONE
#define cryptlib_crypt_CERTINFO_CMS_MLEXP_NONE 2529L
#undef cryptlib_crypt_CERTINFO_CMS_MLEXP_INSTEADOF
#define cryptlib_crypt_CERTINFO_CMS_MLEXP_INSTEADOF 2530L
#undef cryptlib_crypt_CERTINFO_CMS_MLEXP_INADDITIONTO
#define cryptlib_crypt_CERTINFO_CMS_MLEXP_INADDITIONTO 2531L
#undef cryptlib_crypt_CERTINFO_CMS_CONTENTHINTS
#define cryptlib_crypt_CERTINFO_CMS_CONTENTHINTS 2532L
#undef cryptlib_crypt_CERTINFO_CMS_CONTENTHINT_DESCRIPTION
#define cryptlib_crypt_CERTINFO_CMS_CONTENTHINT_DESCRIPTION 2533L
#undef cryptlib_crypt_CERTINFO_CMS_CONTENTHINT_TYPE
#define cryptlib_crypt_CERTINFO_CMS_CONTENTHINT_TYPE 2534L
#undef cryptlib_crypt_CERTINFO_CMS_EQUIVALENTLABEL
#define cryptlib_crypt_CERTINFO_CMS_EQUIVALENTLABEL 2535L
#undef cryptlib_crypt_CERTINFO_CMS_EQVLABEL_POLICY
#define cryptlib_crypt_CERTINFO_CMS_EQVLABEL_POLICY 2536L
#undef cryptlib_crypt_CERTINFO_CMS_EQVLABEL_CLASSIFICATION
#define cryptlib_crypt_CERTINFO_CMS_EQVLABEL_CLASSIFICATION 2537L
#undef cryptlib_crypt_CERTINFO_CMS_EQVLABEL_PRIVACYMARK
#define cryptlib_crypt_CERTINFO_CMS_EQVLABEL_PRIVACYMARK 2538L
#undef cryptlib_crypt_CERTINFO_CMS_EQVLABEL_CATTYPE
#define cryptlib_crypt_CERTINFO_CMS_EQVLABEL_CATTYPE 2539L
#undef cryptlib_crypt_CERTINFO_CMS_EQVLABEL_CATVALUE
#define cryptlib_crypt_CERTINFO_CMS_EQVLABEL_CATVALUE 2540L
#undef cryptlib_crypt_CERTINFO_CMS_SIGNINGCERTIFICATE
#define cryptlib_crypt_CERTINFO_CMS_SIGNINGCERTIFICATE 2541L
#undef cryptlib_crypt_CERTINFO_CMS_SIGNINGCERT_ESSCERTID
#define cryptlib_crypt_CERTINFO_CMS_SIGNINGCERT_ESSCERTID 2542L
#undef cryptlib_crypt_CERTINFO_CMS_SIGNINGCERT_POLICIES
#define cryptlib_crypt_CERTINFO_CMS_SIGNINGCERT_POLICIES 2543L
#undef cryptlib_crypt_CERTINFO_CMS_SIGNATUREPOLICYID
#define cryptlib_crypt_CERTINFO_CMS_SIGNATUREPOLICYID 2544L
#undef cryptlib_crypt_CERTINFO_CMS_SIGPOLICYID
#define cryptlib_crypt_CERTINFO_CMS_SIGPOLICYID 2545L
#undef cryptlib_crypt_CERTINFO_CMS_SIGPOLICYHASH
#define cryptlib_crypt_CERTINFO_CMS_SIGPOLICYHASH 2546L
#undef cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_CPSURI
#define cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_CPSURI 2547L
#undef cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_ORGANIZATION
#define cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_ORGANIZATION 2548L
#undef cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_NOTICENUMBERS
#define cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_NOTICENUMBERS 2549L
#undef cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_EXPLICITTEXT
#define cryptlib_crypt_CERTINFO_CMS_SIGPOLICY_EXPLICITTEXT 2550L
#undef cryptlib_crypt_CERTINFO_CMS_SIGTYPEIDENTIFIER
#define cryptlib_crypt_CERTINFO_CMS_SIGTYPEIDENTIFIER 2551L
#undef cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_ORIGINATORSIG
#define cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_ORIGINATORSIG 2552L
#undef cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_DOMAINSIG
#define cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_DOMAINSIG 2553L
#undef cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_ADDITIONALATTRIBUTES
#define cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_ADDITIONALATTRIBUTES 2554L
#undef cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_REVIEWSIG
#define cryptlib_crypt_CERTINFO_CMS_SIGTYPEID_REVIEWSIG 2555L
#undef cryptlib_crypt_CERTINFO_CMS_NONCE
#define cryptlib_crypt_CERTINFO_CMS_NONCE 2556L
#undef cryptlib_crypt_CERTINFO_SCEP_MESSAGETYPE
#define cryptlib_crypt_CERTINFO_SCEP_MESSAGETYPE 2557L
#undef cryptlib_crypt_CERTINFO_SCEP_PKISTATUS
#define cryptlib_crypt_CERTINFO_SCEP_PKISTATUS 2558L
#undef cryptlib_crypt_CERTINFO_SCEP_FAILINFO
#define cryptlib_crypt_CERTINFO_SCEP_FAILINFO 2559L
#undef cryptlib_crypt_CERTINFO_SCEP_SENDERNONCE
#define cryptlib_crypt_CERTINFO_SCEP_SENDERNONCE 2560L
#undef cryptlib_crypt_CERTINFO_SCEP_RECIPIENTNONCE
#define cryptlib_crypt_CERTINFO_SCEP_RECIPIENTNONCE 2561L
#undef cryptlib_crypt_CERTINFO_SCEP_TRANSACTIONID
#define cryptlib_crypt_CERTINFO_SCEP_TRANSACTIONID 2562L
#undef cryptlib_crypt_CERTINFO_CMS_SPCAGENCYINFO
#define cryptlib_crypt_CERTINFO_CMS_SPCAGENCYINFO 2563L
#undef cryptlib_crypt_CERTINFO_CMS_SPCAGENCYURL
#define cryptlib_crypt_CERTINFO_CMS_SPCAGENCYURL 2564L
#undef cryptlib_crypt_CERTINFO_CMS_SPCSTATEMENTTYPE
#define cryptlib_crypt_CERTINFO_CMS_SPCSTATEMENTTYPE 2565L
#undef cryptlib_crypt_CERTINFO_CMS_SPCSTMT_INDIVIDUALCODESIGNING
#define cryptlib_crypt_CERTINFO_CMS_SPCSTMT_INDIVIDUALCODESIGNING 2566L
#undef cryptlib_crypt_CERTINFO_CMS_SPCSTMT_COMMERCIALCODESIGNING
#define cryptlib_crypt_CERTINFO_CMS_SPCSTMT_COMMERCIALCODESIGNING 2567L
#undef cryptlib_crypt_CERTINFO_CMS_SPCOPUSINFO
#define cryptlib_crypt_CERTINFO_CMS_SPCOPUSINFO 2568L
#undef cryptlib_crypt_CERTINFO_CMS_SPCOPUSINFO_NAME
#define cryptlib_crypt_CERTINFO_CMS_SPCOPUSINFO_NAME 2569L
#undef cryptlib_crypt_CERTINFO_CMS_SPCOPUSINFO_URL
#define cryptlib_crypt_CERTINFO_CMS_SPCOPUSINFO_URL 2570L
#undef cryptlib_crypt_CERTINFO_LAST
#define cryptlib_crypt_CERTINFO_LAST 2571L
#undef cryptlib_crypt_KEYINFO_FIRST
#define cryptlib_crypt_KEYINFO_FIRST 3000L
#undef cryptlib_crypt_KEYINFO_QUERY
#define cryptlib_crypt_KEYINFO_QUERY 3001L
#undef cryptlib_crypt_KEYINFO_QUERY_REQUESTS
#define cryptlib_crypt_KEYINFO_QUERY_REQUESTS 3002L
#undef cryptlib_crypt_KEYINFO_LAST
#define cryptlib_crypt_KEYINFO_LAST 3003L
#undef cryptlib_crypt_DEVINFO_FIRST
#define cryptlib_crypt_DEVINFO_FIRST 4000L
#undef cryptlib_crypt_DEVINFO_INITIALISE
#define cryptlib_crypt_DEVINFO_INITIALISE 4001L
#undef cryptlib_crypt_DEVINFO_INITIALIZE
#define cryptlib_crypt_DEVINFO_INITIALIZE 4001L
#undef cryptlib_crypt_DEVINFO_AUTHENT_USER
#define cryptlib_crypt_DEVINFO_AUTHENT_USER 4002L
#undef cryptlib_crypt_DEVINFO_AUTHENT_SUPERVISOR
#define cryptlib_crypt_DEVINFO_AUTHENT_SUPERVISOR 4003L
#undef cryptlib_crypt_DEVINFO_SET_AUTHENT_USER
#define cryptlib_crypt_DEVINFO_SET_AUTHENT_USER 4004L
#undef cryptlib_crypt_DEVINFO_SET_AUTHENT_SUPERVISOR
#define cryptlib_crypt_DEVINFO_SET_AUTHENT_SUPERVISOR 4005L
#undef cryptlib_crypt_DEVINFO_ZEROISE
#define cryptlib_crypt_DEVINFO_ZEROISE 4006L
#undef cryptlib_crypt_DEVINFO_ZEROIZE
#define cryptlib_crypt_DEVINFO_ZEROIZE 4006L
#undef cryptlib_crypt_DEVINFO_LOGGEDIN
#define cryptlib_crypt_DEVINFO_LOGGEDIN 4007L
#undef cryptlib_crypt_DEVINFO_LABEL
#define cryptlib_crypt_DEVINFO_LABEL 4008L
#undef cryptlib_crypt_DEVINFO_LAST
#define cryptlib_crypt_DEVINFO_LAST 4009L
#undef cryptlib_crypt_ENVINFO_FIRST
#define cryptlib_crypt_ENVINFO_FIRST 5000L
#undef cryptlib_crypt_ENVINFO_DATASIZE
#define cryptlib_crypt_ENVINFO_DATASIZE 5001L
#undef cryptlib_crypt_ENVINFO_COMPRESSION
#define cryptlib_crypt_ENVINFO_COMPRESSION 5002L
#undef cryptlib_crypt_ENVINFO_CONTENTTYPE
#define cryptlib_crypt_ENVINFO_CONTENTTYPE 5003L
#undef cryptlib_crypt_ENVINFO_DETACHEDSIGNATURE
#define cryptlib_crypt_ENVINFO_DETACHEDSIGNATURE 5004L
#undef cryptlib_crypt_ENVINFO_SIGNATURE_RESULT
#define cryptlib_crypt_ENVINFO_SIGNATURE_RESULT 5005L
#undef cryptlib_crypt_ENVINFO_MAC
#define cryptlib_crypt_ENVINFO_MAC 5006L
#undef cryptlib_crypt_ENVINFO_PASSWORD
#define cryptlib_crypt_ENVINFO_PASSWORD 5007L
#undef cryptlib_crypt_ENVINFO_KEY
#define cryptlib_crypt_ENVINFO_KEY 5008L
#undef cryptlib_crypt_ENVINFO_SIGNATURE
#define cryptlib_crypt_ENVINFO_SIGNATURE 5009L
#undef cryptlib_crypt_ENVINFO_SIGNATURE_EXTRADATA
#define cryptlib_crypt_ENVINFO_SIGNATURE_EXTRADATA 5010L
#undef cryptlib_crypt_ENVINFO_RECIPIENT
#define cryptlib_crypt_ENVINFO_RECIPIENT 5011L
#undef cryptlib_crypt_ENVINFO_PUBLICKEY
#define cryptlib_crypt_ENVINFO_PUBLICKEY 5012L
#undef cryptlib_crypt_ENVINFO_PRIVATEKEY
#define cryptlib_crypt_ENVINFO_PRIVATEKEY 5013L
#undef cryptlib_crypt_ENVINFO_PRIVATEKEY_LABEL
#define cryptlib_crypt_ENVINFO_PRIVATEKEY_LABEL 5014L
#undef cryptlib_crypt_ENVINFO_ORIGINATOR
#define cryptlib_crypt_ENVINFO_ORIGINATOR 5015L
#undef cryptlib_crypt_ENVINFO_SESSIONKEY
#define cryptlib_crypt_ENVINFO_SESSIONKEY 5016L
#undef cryptlib_crypt_ENVINFO_HASH
#define cryptlib_crypt_ENVINFO_HASH 5017L
#undef cryptlib_crypt_ENVINFO_TIMESTAMP
#define cryptlib_crypt_ENVINFO_TIMESTAMP 5018L
#undef cryptlib_crypt_ENVINFO_KEYSET_SIGCHECK
#define cryptlib_crypt_ENVINFO_KEYSET_SIGCHECK 5019L
#undef cryptlib_crypt_ENVINFO_KEYSET_ENCRYPT
#define cryptlib_crypt_ENVINFO_KEYSET_ENCRYPT 5020L
#undef cryptlib_crypt_ENVINFO_KEYSET_DECRYPT
#define cryptlib_crypt_ENVINFO_KEYSET_DECRYPT 5021L
#undef cryptlib_crypt_ENVINFO_LAST
#define cryptlib_crypt_ENVINFO_LAST 5022L
#undef cryptlib_crypt_SESSINFO_FIRST
#define cryptlib_crypt_SESSINFO_FIRST 6000L
#undef cryptlib_crypt_SESSINFO_ACTIVE
#define cryptlib_crypt_SESSINFO_ACTIVE 6001L
#undef cryptlib_crypt_SESSINFO_CONNECTIONACTIVE
#define cryptlib_crypt_SESSINFO_CONNECTIONACTIVE 6002L
#undef cryptlib_crypt_SESSINFO_USERNAME
#define cryptlib_crypt_SESSINFO_USERNAME 6003L
#undef cryptlib_crypt_SESSINFO_PASSWORD
#define cryptlib_crypt_SESSINFO_PASSWORD 6004L
#undef cryptlib_crypt_SESSINFO_PRIVATEKEY
#define cryptlib_crypt_SESSINFO_PRIVATEKEY 6005L
#undef cryptlib_crypt_SESSINFO_KEYSET
#define cryptlib_crypt_SESSINFO_KEYSET 6006L
#undef cryptlib_crypt_SESSINFO_AUTHRESPONSE
#define cryptlib_crypt_SESSINFO_AUTHRESPONSE 6007L
#undef cryptlib_crypt_SESSINFO_SERVER_NAME
#define cryptlib_crypt_SESSINFO_SERVER_NAME 6008L
#undef cryptlib_crypt_SESSINFO_SERVER_PORT
#define cryptlib_crypt_SESSINFO_SERVER_PORT 6009L
#undef cryptlib_crypt_SESSINFO_SERVER_FINGERPRINT
#define cryptlib_crypt_SESSINFO_SERVER_FINGERPRINT 6010L
#undef cryptlib_crypt_SESSINFO_CLIENT_NAME
#define cryptlib_crypt_SESSINFO_CLIENT_NAME 6011L
#undef cryptlib_crypt_SESSINFO_CLIENT_PORT
#define cryptlib_crypt_SESSINFO_CLIENT_PORT 6012L
#undef cryptlib_crypt_SESSINFO_SESSION
#define cryptlib_crypt_SESSINFO_SESSION 6013L
#undef cryptlib_crypt_SESSINFO_NETWORKSOCKET
#define cryptlib_crypt_SESSINFO_NETWORKSOCKET 6014L
#undef cryptlib_crypt_SESSINFO_VERSION
#define cryptlib_crypt_SESSINFO_VERSION 6015L
#undef cryptlib_crypt_SESSINFO_REQUEST
#define cryptlib_crypt_SESSINFO_REQUEST 6016L
#undef cryptlib_crypt_SESSINFO_RESPONSE
#define cryptlib_crypt_SESSINFO_RESPONSE 6017L
#undef cryptlib_crypt_SESSINFO_CACERTIFICATE
#define cryptlib_crypt_SESSINFO_CACERTIFICATE 6018L
#undef cryptlib_crypt_SESSINFO_TSP_MSGIMPRINT
#define cryptlib_crypt_SESSINFO_TSP_MSGIMPRINT 6019L
#undef cryptlib_crypt_SESSINFO_CMP_REQUESTTYPE
#define cryptlib_crypt_SESSINFO_CMP_REQUESTTYPE 6020L
#undef cryptlib_crypt_SESSINFO_CMP_PKIBOOT
#define cryptlib_crypt_SESSINFO_CMP_PKIBOOT 6021L
#undef cryptlib_crypt_SESSINFO_CMP_PRIVKEYSET
#define cryptlib_crypt_SESSINFO_CMP_PRIVKEYSET 6022L
#undef cryptlib_crypt_SESSINFO_SSH_CHANNEL
#define cryptlib_crypt_SESSINFO_SSH_CHANNEL 6023L
#undef cryptlib_crypt_SESSINFO_SSH_CHANNEL_TYPE
#define cryptlib_crypt_SESSINFO_SSH_CHANNEL_TYPE 6024L
#undef cryptlib_crypt_SESSINFO_SSH_CHANNEL_ARG1
#define cryptlib_crypt_SESSINFO_SSH_CHANNEL_ARG1 6025L
#undef cryptlib_crypt_SESSINFO_SSH_CHANNEL_ARG2
#define cryptlib_crypt_SESSINFO_SSH_CHANNEL_ARG2 6026L
#undef cryptlib_crypt_SESSINFO_SSH_CHANNEL_ACTIVE
#define cryptlib_crypt_SESSINFO_SSH_CHANNEL_ACTIVE 6027L
#undef cryptlib_crypt_SESSINFO_LAST
#define cryptlib_crypt_SESSINFO_LAST 6028L
#undef cryptlib_crypt_USERINFO_FIRST
#define cryptlib_crypt_USERINFO_FIRST 7000L
#undef cryptlib_crypt_USERINFO_PASSWORD
#define cryptlib_crypt_USERINFO_PASSWORD 7001L
#undef cryptlib_crypt_USERINFO_CAKEY_CERTSIGN
#define cryptlib_crypt_USERINFO_CAKEY_CERTSIGN 7002L
#undef cryptlib_crypt_USERINFO_CAKEY_CRLSIGN
#define cryptlib_crypt_USERINFO_CAKEY_CRLSIGN 7003L
#undef cryptlib_crypt_USERINFO_CAKEY_RTCSSIGN
#define cryptlib_crypt_USERINFO_CAKEY_RTCSSIGN 7004L
#undef cryptlib_crypt_USERINFO_CAKEY_OCSPSIGN
#define cryptlib_crypt_USERINFO_CAKEY_OCSPSIGN 7005L
#undef cryptlib_crypt_USERINFO_LAST
#define cryptlib_crypt_USERINFO_LAST 7006L
#undef cryptlib_crypt_ATTRIBUTE_LAST
#define cryptlib_crypt_ATTRIBUTE_LAST 7006L
#undef cryptlib_crypt_KEYUSAGE_NONE
#define cryptlib_crypt_KEYUSAGE_NONE 0L
#undef cryptlib_crypt_KEYUSAGE_DIGITALSIGNATURE
#define cryptlib_crypt_KEYUSAGE_DIGITALSIGNATURE 1L
#undef cryptlib_crypt_KEYUSAGE_NONREPUDIATION
#define cryptlib_crypt_KEYUSAGE_NONREPUDIATION 2L
#undef cryptlib_crypt_KEYUSAGE_KEYENCIPHERMENT
#define cryptlib_crypt_KEYUSAGE_KEYENCIPHERMENT 4L
#undef cryptlib_crypt_KEYUSAGE_DATAENCIPHERMENT
#define cryptlib_crypt_KEYUSAGE_DATAENCIPHERMENT 8L
#undef cryptlib_crypt_KEYUSAGE_KEYAGREEMENT
#define cryptlib_crypt_KEYUSAGE_KEYAGREEMENT 16L
#undef cryptlib_crypt_KEYUSAGE_KEYCERTSIGN
#define cryptlib_crypt_KEYUSAGE_KEYCERTSIGN 32L
#undef cryptlib_crypt_KEYUSAGE_CRLSIGN
#define cryptlib_crypt_KEYUSAGE_CRLSIGN 64L
#undef cryptlib_crypt_KEYUSAGE_ENCIPHERONLY
#define cryptlib_crypt_KEYUSAGE_ENCIPHERONLY 128L
#undef cryptlib_crypt_KEYUSAGE_DECIPHERONLY
#define cryptlib_crypt_KEYUSAGE_DECIPHERONLY 256L
#undef cryptlib_crypt_KEYUSAGE_LAST
#define cryptlib_crypt_KEYUSAGE_LAST 512L
#undef cryptlib_crypt_CRLREASON_UNSPECIFIED
#define cryptlib_crypt_CRLREASON_UNSPECIFIED 0L
#undef cryptlib_crypt_CRLREASON_KEYCOMPROMISE
#define cryptlib_crypt_CRLREASON_KEYCOMPROMISE 1L
#undef cryptlib_crypt_CRLREASON_CACOMPROMISE
#define cryptlib_crypt_CRLREASON_CACOMPROMISE 2L
#undef cryptlib_crypt_CRLREASON_AFFILIATIONCHANGED
#define cryptlib_crypt_CRLREASON_AFFILIATIONCHANGED 3L
#undef cryptlib_crypt_CRLREASON_SUPERSEDED
#define cryptlib_crypt_CRLREASON_SUPERSEDED 4L
#undef cryptlib_crypt_CRLREASON_CESSATIONOFOPERATION
#define cryptlib_crypt_CRLREASON_CESSATIONOFOPERATION 5L
#undef cryptlib_crypt_CRLREASON_CERTIFICATEHOLD
#define cryptlib_crypt_CRLREASON_CERTIFICATEHOLD 6L
#undef cryptlib_crypt_CRLREASON_REMOVEFROMCRL
#define cryptlib_crypt_CRLREASON_REMOVEFROMCRL 8L
#undef cryptlib_crypt_CRLREASON_PRIVILEGEWITHDRAWN
#define cryptlib_crypt_CRLREASON_PRIVILEGEWITHDRAWN 9L
#undef cryptlib_crypt_CRLREASON_AACOMPROMISE
#define cryptlib_crypt_CRLREASON_AACOMPROMISE 10L
#undef cryptlib_crypt_CRLREASON_LAST
#define cryptlib_crypt_CRLREASON_LAST 11L
#undef cryptlib_crypt_CRLREASON_NEVERVALID
#define cryptlib_crypt_CRLREASON_NEVERVALID 20L
#undef cryptlib_crypt_CRLEXTREASON_LAST
#define cryptlib_crypt_CRLEXTREASON_LAST 21L
#undef cryptlib_crypt_CRLREASONFLAG_UNUSED
#define cryptlib_crypt_CRLREASONFLAG_UNUSED 1L
#undef cryptlib_crypt_CRLREASONFLAG_KEYCOMPROMISE
#define cryptlib_crypt_CRLREASONFLAG_KEYCOMPROMISE 2L
#undef cryptlib_crypt_CRLREASONFLAG_CACOMPROMISE
#define cryptlib_crypt_CRLREASONFLAG_CACOMPROMISE 4L
#undef cryptlib_crypt_CRLREASONFLAG_AFFILIATIONCHANGED
#define cryptlib_crypt_CRLREASONFLAG_AFFILIATIONCHANGED 8L
#undef cryptlib_crypt_CRLREASONFLAG_SUPERSEDED
#define cryptlib_crypt_CRLREASONFLAG_SUPERSEDED 16L
#undef cryptlib_crypt_CRLREASONFLAG_CESSATIONOFOPERATION
#define cryptlib_crypt_CRLREASONFLAG_CESSATIONOFOPERATION 32L
#undef cryptlib_crypt_CRLREASONFLAG_CERTIFICATEHOLD
#define cryptlib_crypt_CRLREASONFLAG_CERTIFICATEHOLD 64L
#undef cryptlib_crypt_CRLREASONFLAG_LAST
#define cryptlib_crypt_CRLREASONFLAG_LAST 128L
#undef cryptlib_crypt_HOLDINSTRUCTION_NONE
#define cryptlib_crypt_HOLDINSTRUCTION_NONE 0L
#undef cryptlib_crypt_HOLDINSTRUCTION_CALLISSUER
#define cryptlib_crypt_HOLDINSTRUCTION_CALLISSUER 1L
#undef cryptlib_crypt_HOLDINSTRUCTION_REJECT
#define cryptlib_crypt_HOLDINSTRUCTION_REJECT 2L
#undef cryptlib_crypt_HOLDINSTRUCTION_PICKUPTOKEN
#define cryptlib_crypt_HOLDINSTRUCTION_PICKUPTOKEN 3L
#undef cryptlib_crypt_HOLDINSTRUCTION_LAST
#define cryptlib_crypt_HOLDINSTRUCTION_LAST 4L
#undef cryptlib_crypt_COMPLIANCELEVEL_OBLIVIOUS
#define cryptlib_crypt_COMPLIANCELEVEL_OBLIVIOUS 0L
#undef cryptlib_crypt_COMPLIANCELEVEL_REDUCED
#define cryptlib_crypt_COMPLIANCELEVEL_REDUCED 1L
#undef cryptlib_crypt_COMPLIANCELEVEL_STANDARD
#define cryptlib_crypt_COMPLIANCELEVEL_STANDARD 2L
#undef cryptlib_crypt_COMPLIANCELEVEL_PKIX_PARTIAL
#define cryptlib_crypt_COMPLIANCELEVEL_PKIX_PARTIAL 3L
#undef cryptlib_crypt_COMPLIANCELEVEL_PKIX_FULL
#define cryptlib_crypt_COMPLIANCELEVEL_PKIX_FULL 4L
#undef cryptlib_crypt_COMPLIANCELEVEL_LAST
#define cryptlib_crypt_COMPLIANCELEVEL_LAST 5L
#undef cryptlib_crypt_NS_CERTTYPE_SSLCLIENT
#define cryptlib_crypt_NS_CERTTYPE_SSLCLIENT 1L
#undef cryptlib_crypt_NS_CERTTYPE_SSLSERVER
#define cryptlib_crypt_NS_CERTTYPE_SSLSERVER 2L
#undef cryptlib_crypt_NS_CERTTYPE_SMIME
#define cryptlib_crypt_NS_CERTTYPE_SMIME 4L
#undef cryptlib_crypt_NS_CERTTYPE_OBJECTSIGNING
#define cryptlib_crypt_NS_CERTTYPE_OBJECTSIGNING 8L
#undef cryptlib_crypt_NS_CERTTYPE_RESERVED
#define cryptlib_crypt_NS_CERTTYPE_RESERVED 16L
#undef cryptlib_crypt_NS_CERTTYPE_SSLCA
#define cryptlib_crypt_NS_CERTTYPE_SSLCA 32L
#undef cryptlib_crypt_NS_CERTTYPE_SMIMECA
#define cryptlib_crypt_NS_CERTTYPE_SMIMECA 64L
#undef cryptlib_crypt_NS_CERTTYPE_OBJECTSIGNINGCA
#define cryptlib_crypt_NS_CERTTYPE_OBJECTSIGNINGCA 128L
#undef cryptlib_crypt_NS_CERTTYPE_LAST
#define cryptlib_crypt_NS_CERTTYPE_LAST 256L
#undef cryptlib_crypt_SET_CERTTYPE_CARD
#define cryptlib_crypt_SET_CERTTYPE_CARD 1L
#undef cryptlib_crypt_SET_CERTTYPE_MER
#define cryptlib_crypt_SET_CERTTYPE_MER 2L
#undef cryptlib_crypt_SET_CERTTYPE_PGWY
#define cryptlib_crypt_SET_CERTTYPE_PGWY 4L
#undef cryptlib_crypt_SET_CERTTYPE_CCA
#define cryptlib_crypt_SET_CERTTYPE_CCA 8L
#undef cryptlib_crypt_SET_CERTTYPE_MCA
#define cryptlib_crypt_SET_CERTTYPE_MCA 16L
#undef cryptlib_crypt_SET_CERTTYPE_PCA
#define cryptlib_crypt_SET_CERTTYPE_PCA 32L
#undef cryptlib_crypt_SET_CERTTYPE_GCA
#define cryptlib_crypt_SET_CERTTYPE_GCA 64L
#undef cryptlib_crypt_SET_CERTTYPE_BCA
#define cryptlib_crypt_SET_CERTTYPE_BCA 128L
#undef cryptlib_crypt_SET_CERTTYPE_RCA
#define cryptlib_crypt_SET_CERTTYPE_RCA 256L
#undef cryptlib_crypt_SET_CERTTYPE_ACQ
#define cryptlib_crypt_SET_CERTTYPE_ACQ 512L
#undef cryptlib_crypt_SET_CERTTYPE_LAST
#define cryptlib_crypt_SET_CERTTYPE_LAST 1024L
#undef cryptlib_crypt_CONTENT_NONE
#define cryptlib_crypt_CONTENT_NONE 0L
#undef cryptlib_crypt_CONTENT_DATA
#define cryptlib_crypt_CONTENT_DATA 1L
#undef cryptlib_crypt_CONTENT_SIGNEDDATA
#define cryptlib_crypt_CONTENT_SIGNEDDATA 2L
#undef cryptlib_crypt_CONTENT_ENVELOPEDDATA
#define cryptlib_crypt_CONTENT_ENVELOPEDDATA 3L
#undef cryptlib_crypt_CONTENT_SIGNEDANDENVELOPEDDATA
#define cryptlib_crypt_CONTENT_SIGNEDANDENVELOPEDDATA 4L
#undef cryptlib_crypt_CONTENT_DIGESTEDDATA
#define cryptlib_crypt_CONTENT_DIGESTEDDATA 5L
#undef cryptlib_crypt_CONTENT_ENCRYPTEDDATA
#define cryptlib_crypt_CONTENT_ENCRYPTEDDATA 6L
#undef cryptlib_crypt_CONTENT_COMPRESSEDDATA
#define cryptlib_crypt_CONTENT_COMPRESSEDDATA 7L
#undef cryptlib_crypt_CONTENT_TSTINFO
#define cryptlib_crypt_CONTENT_TSTINFO 8L
#undef cryptlib_crypt_CONTENT_SPCINDIRECTDATACONTEXT
#define cryptlib_crypt_CONTENT_SPCINDIRECTDATACONTEXT 9L
#undef cryptlib_crypt_CONTENT_RTCSREQUEST
#define cryptlib_crypt_CONTENT_RTCSREQUEST 10L
#undef cryptlib_crypt_CONTENT_RTCSRESPONSE
#define cryptlib_crypt_CONTENT_RTCSRESPONSE 11L
#undef cryptlib_crypt_CONTENT_RTCSRESPONSE_EXT
#define cryptlib_crypt_CONTENT_RTCSRESPONSE_EXT 12L
#undef cryptlib_crypt_CONTENT_LAST
#define cryptlib_crypt_CONTENT_LAST 13L
#undef cryptlib_crypt_CLASSIFICATION_UNMARKED
#define cryptlib_crypt_CLASSIFICATION_UNMARKED 0L
#undef cryptlib_crypt_CLASSIFICATION_UNCLASSIFIED
#define cryptlib_crypt_CLASSIFICATION_UNCLASSIFIED 1L
#undef cryptlib_crypt_CLASSIFICATION_RESTRICTED
#define cryptlib_crypt_CLASSIFICATION_RESTRICTED 2L
#undef cryptlib_crypt_CLASSIFICATION_CONFIDENTIAL
#define cryptlib_crypt_CLASSIFICATION_CONFIDENTIAL 3L
#undef cryptlib_crypt_CLASSIFICATION_SECRET
#define cryptlib_crypt_CLASSIFICATION_SECRET 4L
#undef cryptlib_crypt_CLASSIFICATION_TOP_SECRET
#define cryptlib_crypt_CLASSIFICATION_TOP_SECRET 5L
#undef cryptlib_crypt_CLASSIFICATION_LAST
#define cryptlib_crypt_CLASSIFICATION_LAST 255L
#undef cryptlib_crypt_CERTSTATUS_VALID
#define cryptlib_crypt_CERTSTATUS_VALID 0L
#undef cryptlib_crypt_CERTSTATUS_NOTVALID
#define cryptlib_crypt_CERTSTATUS_NOTVALID 1L
#undef cryptlib_crypt_CERTSTATUS_NONAUTHORITATIVE
#define cryptlib_crypt_CERTSTATUS_NONAUTHORITATIVE 2L
#undef cryptlib_crypt_CERTSTATUS_UNKNOWN
#define cryptlib_crypt_CERTSTATUS_UNKNOWN 3L
#undef cryptlib_crypt_OCSPSTATUS_NOTREVOKED
#define cryptlib_crypt_OCSPSTATUS_NOTREVOKED 0L
#undef cryptlib_crypt_OCSPSTATUS_REVOKED
#define cryptlib_crypt_OCSPSTATUS_REVOKED 1L
#undef cryptlib_crypt_OCSPSTATUS_UNKNOWN
#define cryptlib_crypt_OCSPSTATUS_UNKNOWN 2L
#undef cryptlib_crypt_SIGNATURELEVEL_NONE
#define cryptlib_crypt_SIGNATURELEVEL_NONE 0L
#undef cryptlib_crypt_SIGNATURELEVEL_SIGNERCERT
#define cryptlib_crypt_SIGNATURELEVEL_SIGNERCERT 1L
#undef cryptlib_crypt_SIGNATURELEVEL_ALL
#define cryptlib_crypt_SIGNATURELEVEL_ALL 2L
#undef cryptlib_crypt_SIGNATURELEVEL_LAST
#define cryptlib_crypt_SIGNATURELEVEL_LAST 3L
#undef cryptlib_crypt_CERTFORMAT_NONE
#define cryptlib_crypt_CERTFORMAT_NONE 0L
#undef cryptlib_crypt_CERTFORMAT_CERTIFICATE
#define cryptlib_crypt_CERTFORMAT_CERTIFICATE 1L
#undef cryptlib_crypt_CERTFORMAT_CERTCHAIN
#define cryptlib_crypt_CERTFORMAT_CERTCHAIN 2L
#undef cryptlib_crypt_CERTFORMAT_TEXT_CERTIFICATE
#define cryptlib_crypt_CERTFORMAT_TEXT_CERTIFICATE 3L
#undef cryptlib_crypt_CERTFORMAT_TEXT_CERTCHAIN
#define cryptlib_crypt_CERTFORMAT_TEXT_CERTCHAIN 4L
#undef cryptlib_crypt_CERTFORMAT_XML_CERTIFICATE
#define cryptlib_crypt_CERTFORMAT_XML_CERTIFICATE 5L
#undef cryptlib_crypt_CERTFORMAT_XML_CERTCHAIN
#define cryptlib_crypt_CERTFORMAT_XML_CERTCHAIN 6L
#undef cryptlib_crypt_CERTFORMAT_LAST
#define cryptlib_crypt_CERTFORMAT_LAST 7L
#undef cryptlib_crypt_REQUESTTYPE_NONE
#define cryptlib_crypt_REQUESTTYPE_NONE 0L
#undef cryptlib_crypt_REQUESTTYPE_INITIALISATION
#define cryptlib_crypt_REQUESTTYPE_INITIALISATION 1L
#undef cryptlib_crypt_REQUESTTYPE_INITIALIZATION
#define cryptlib_crypt_REQUESTTYPE_INITIALIZATION 1L
#undef cryptlib_crypt_REQUESTTYPE_CERTIFICATE
#define cryptlib_crypt_REQUESTTYPE_CERTIFICATE 2L
#undef cryptlib_crypt_REQUESTTYPE_KEYUPDATE
#define cryptlib_crypt_REQUESTTYPE_KEYUPDATE 3L
#undef cryptlib_crypt_REQUESTTYPE_REVOCATION
#define cryptlib_crypt_REQUESTTYPE_REVOCATION 4L
#undef cryptlib_crypt_REQUESTTYPE_PKIBOOT
#define cryptlib_crypt_REQUESTTYPE_PKIBOOT 5L
#undef cryptlib_crypt_REQUESTTYPE_LAST
#define cryptlib_crypt_REQUESTTYPE_LAST 6L
#undef cryptlib_crypt_KEYID_NONE
#define cryptlib_crypt_KEYID_NONE 0L
#undef cryptlib_crypt_KEYID_NAME
#define cryptlib_crypt_KEYID_NAME 1L
#undef cryptlib_crypt_KEYID_URI
#define cryptlib_crypt_KEYID_URI 2L
#undef cryptlib_crypt_KEYID_EMAIL
#define cryptlib_crypt_KEYID_EMAIL 2L
#undef cryptlib_crypt_KEYID_LAST
#define cryptlib_crypt_KEYID_LAST 3L
#undef cryptlib_crypt_OBJECT_NONE
#define cryptlib_crypt_OBJECT_NONE 0L
#undef cryptlib_crypt_OBJECT_ENCRYPTED_KEY
#define cryptlib_crypt_OBJECT_ENCRYPTED_KEY 1L
#undef cryptlib_crypt_OBJECT_PKCENCRYPTED_KEY
#define cryptlib_crypt_OBJECT_PKCENCRYPTED_KEY 2L
#undef cryptlib_crypt_OBJECT_KEYAGREEMENT
#define cryptlib_crypt_OBJECT_KEYAGREEMENT 3L
#undef cryptlib_crypt_OBJECT_SIGNATURE
#define cryptlib_crypt_OBJECT_SIGNATURE 4L
#undef cryptlib_crypt_OBJECT_LAST
#define cryptlib_crypt_OBJECT_LAST 5L
#undef cryptlib_crypt_ERRTYPE_NONE
#define cryptlib_crypt_ERRTYPE_NONE 0L
#undef cryptlib_crypt_ERRTYPE_ATTR_SIZE
#define cryptlib_crypt_ERRTYPE_ATTR_SIZE 1L
#undef cryptlib_crypt_ERRTYPE_ATTR_VALUE
#define cryptlib_crypt_ERRTYPE_ATTR_VALUE 2L
#undef cryptlib_crypt_ERRTYPE_ATTR_ABSENT
#define cryptlib_crypt_ERRTYPE_ATTR_ABSENT 3L
#undef cryptlib_crypt_ERRTYPE_ATTR_PRESENT
#define cryptlib_crypt_ERRTYPE_ATTR_PRESENT 4L
#undef cryptlib_crypt_ERRTYPE_CONSTRAINT
#define cryptlib_crypt_ERRTYPE_CONSTRAINT 5L
#undef cryptlib_crypt_ERRTYPE_ISSUERCONSTRAINT
#define cryptlib_crypt_ERRTYPE_ISSUERCONSTRAINT 6L
#undef cryptlib_crypt_ERRTYPE_LAST
#define cryptlib_crypt_ERRTYPE_LAST 7L
#undef cryptlib_crypt_CERTACTION_NONE
#define cryptlib_crypt_CERTACTION_NONE 0L
#undef cryptlib_crypt_CERTACTION_CREATE
#define cryptlib_crypt_CERTACTION_CREATE 1L
#undef cryptlib_crypt_CERTACTION_CONNECT
#define cryptlib_crypt_CERTACTION_CONNECT 2L
#undef cryptlib_crypt_CERTACTION_DISCONNECT
#define cryptlib_crypt_CERTACTION_DISCONNECT 3L
#undef cryptlib_crypt_CERTACTION_ERROR
#define cryptlib_crypt_CERTACTION_ERROR 4L
#undef cryptlib_crypt_CERTACTION_ADDUSER
#define cryptlib_crypt_CERTACTION_ADDUSER 5L
#undef cryptlib_crypt_CERTACTION_DELETEUSER
#define cryptlib_crypt_CERTACTION_DELETEUSER 6L
#undef cryptlib_crypt_CERTACTION_REQUEST_CERT
#define cryptlib_crypt_CERTACTION_REQUEST_CERT 7L
#undef cryptlib_crypt_CERTACTION_REQUEST_RENEWAL
#define cryptlib_crypt_CERTACTION_REQUEST_RENEWAL 8L
#undef cryptlib_crypt_CERTACTION_REQUEST_REVOCATION
#define cryptlib_crypt_CERTACTION_REQUEST_REVOCATION 9L
#undef cryptlib_crypt_CERTACTION_CERT_CREATION
#define cryptlib_crypt_CERTACTION_CERT_CREATION 10L
#undef cryptlib_crypt_CERTACTION_CERT_CREATION_COMPLETE
#define cryptlib_crypt_CERTACTION_CERT_CREATION_COMPLETE 11L
#undef cryptlib_crypt_CERTACTION_CERT_CREATION_DROP
#define cryptlib_crypt_CERTACTION_CERT_CREATION_DROP 12L
#undef cryptlib_crypt_CERTACTION_CERT_CREATION_REVERSE
#define cryptlib_crypt_CERTACTION_CERT_CREATION_REVERSE 13L
#undef cryptlib_crypt_CERTACTION_RESTART_CLEANUP
#define cryptlib_crypt_CERTACTION_RESTART_CLEANUP 14L
#undef cryptlib_crypt_CERTACTION_RESTART_REVOKE_CERT
#define cryptlib_crypt_CERTACTION_RESTART_REVOKE_CERT 15L
#undef cryptlib_crypt_CERTACTION_ISSUE_CERT
#define cryptlib_crypt_CERTACTION_ISSUE_CERT 16L
#undef cryptlib_crypt_CERTACTION_ISSUE_CRL
#define cryptlib_crypt_CERTACTION_ISSUE_CRL 17L
#undef cryptlib_crypt_CERTACTION_REVOKE_CERT
#define cryptlib_crypt_CERTACTION_REVOKE_CERT 18L
#undef cryptlib_crypt_CERTACTION_EXPIRE_CERT
#define cryptlib_crypt_CERTACTION_EXPIRE_CERT 19L
#undef cryptlib_crypt_CERTACTION_CLEANUP
#define cryptlib_crypt_CERTACTION_CLEANUP 20L
#undef cryptlib_crypt_CERTACTION_LAST
#define cryptlib_crypt_CERTACTION_LAST 21L
#undef cryptlib_crypt_MAX_KEYSIZE
#define cryptlib_crypt_MAX_KEYSIZE 256L
#undef cryptlib_crypt_MAX_IVSIZE
#define cryptlib_crypt_MAX_IVSIZE 32L
#undef cryptlib_crypt_MAX_PKCSIZE
#define cryptlib_crypt_MAX_PKCSIZE 512L
#undef cryptlib_crypt_MAX_PKCSIZE_ECC
#define cryptlib_crypt_MAX_PKCSIZE_ECC 32L
#undef cryptlib_crypt_MAX_HASHSIZE
#define cryptlib_crypt_MAX_HASHSIZE 32L
#undef cryptlib_crypt_MAX_TEXTSIZE
#define cryptlib_crypt_MAX_TEXTSIZE 64L
#undef cryptlib_crypt_USE_DEFAULT
#define cryptlib_crypt_USE_DEFAULT -100L
#undef cryptlib_crypt_UNUSED
#define cryptlib_crypt_UNUSED -101L
#undef cryptlib_crypt_CURSOR_FIRST
#define cryptlib_crypt_CURSOR_FIRST -200L
#undef cryptlib_crypt_CURSOR_PREVIOUS
#define cryptlib_crypt_CURSOR_PREVIOUS -201L
#undef cryptlib_crypt_CURSOR_NEXT
#define cryptlib_crypt_CURSOR_NEXT -202L
#undef cryptlib_crypt_CURSOR_LAST
#define cryptlib_crypt_CURSOR_LAST -203L
#undef cryptlib_crypt_RANDOM_FASTPOLL
#define cryptlib_crypt_RANDOM_FASTPOLL -300L
#undef cryptlib_crypt_RANDOM_SLOWPOLL
#define cryptlib_crypt_RANDOM_SLOWPOLL -301L
#undef cryptlib_crypt_KEYTYPE_PRIVATE
#define cryptlib_crypt_KEYTYPE_PRIVATE 0L
#undef cryptlib_crypt_KEYTYPE_PUBLIC
#define cryptlib_crypt_KEYTYPE_PUBLIC 1L
#undef cryptlib_crypt_KEYOPT_NONE
#define cryptlib_crypt_KEYOPT_NONE 0L
#undef cryptlib_crypt_KEYOPT_READONLY
#define cryptlib_crypt_KEYOPT_READONLY 1L
#undef cryptlib_crypt_KEYOPT_CREATE
#define cryptlib_crypt_KEYOPT_CREATE 2L
#undef cryptlib_crypt_KEYOPT_LAST
#define cryptlib_crypt_KEYOPT_LAST 3L
#undef cryptlib_crypt_OK
#define cryptlib_crypt_OK 0L
#undef cryptlib_crypt_ERROR_PARAM1
#define cryptlib_crypt_ERROR_PARAM1 -1L
#undef cryptlib_crypt_ERROR_PARAM2
#define cryptlib_crypt_ERROR_PARAM2 -2L
#undef cryptlib_crypt_ERROR_PARAM3
#define cryptlib_crypt_ERROR_PARAM3 -3L
#undef cryptlib_crypt_ERROR_PARAM4
#define cryptlib_crypt_ERROR_PARAM4 -4L
#undef cryptlib_crypt_ERROR_PARAM5
#define cryptlib_crypt_ERROR_PARAM5 -5L
#undef cryptlib_crypt_ERROR_PARAM6
#define cryptlib_crypt_ERROR_PARAM6 -6L
#undef cryptlib_crypt_ERROR_PARAM7
#define cryptlib_crypt_ERROR_PARAM7 -7L
#undef cryptlib_crypt_ERROR_MEMORY
#define cryptlib_crypt_ERROR_MEMORY -10L
#undef cryptlib_crypt_ERROR_NOTINITED
#define cryptlib_crypt_ERROR_NOTINITED -11L
#undef cryptlib_crypt_ERROR_INITED
#define cryptlib_crypt_ERROR_INITED -12L
#undef cryptlib_crypt_ERROR_NOSECURE
#define cryptlib_crypt_ERROR_NOSECURE -13L
#undef cryptlib_crypt_ERROR_RANDOM
#define cryptlib_crypt_ERROR_RANDOM -14L
#undef cryptlib_crypt_ERROR_FAILED
#define cryptlib_crypt_ERROR_FAILED -15L
#undef cryptlib_crypt_ERROR_INTERNAL
#define cryptlib_crypt_ERROR_INTERNAL -16L
#undef cryptlib_crypt_ERROR_NOTAVAIL
#define cryptlib_crypt_ERROR_NOTAVAIL -20L
#undef cryptlib_crypt_ERROR_PERMISSION
#define cryptlib_crypt_ERROR_PERMISSION -21L
#undef cryptlib_crypt_ERROR_WRONGKEY
#define cryptlib_crypt_ERROR_WRONGKEY -22L
#undef cryptlib_crypt_ERROR_INCOMPLETE
#define cryptlib_crypt_ERROR_INCOMPLETE -23L
#undef cryptlib_crypt_ERROR_COMPLETE
#define cryptlib_crypt_ERROR_COMPLETE -24L
#undef cryptlib_crypt_ERROR_TIMEOUT
#define cryptlib_crypt_ERROR_TIMEOUT -25L
#undef cryptlib_crypt_ERROR_INVALID
#define cryptlib_crypt_ERROR_INVALID -26L
#undef cryptlib_crypt_ERROR_SIGNALLED
#define cryptlib_crypt_ERROR_SIGNALLED -27L
#undef cryptlib_crypt_ERROR_OVERFLOW
#define cryptlib_crypt_ERROR_OVERFLOW -30L
#undef cryptlib_crypt_ERROR_UNDERFLOW
#define cryptlib_crypt_ERROR_UNDERFLOW -31L
#undef cryptlib_crypt_ERROR_BADDATA
#define cryptlib_crypt_ERROR_BADDATA -32L
#undef cryptlib_crypt_ERROR_SIGNATURE
#define cryptlib_crypt_ERROR_SIGNATURE -33L
#undef cryptlib_crypt_ERROR_OPEN
#define cryptlib_crypt_ERROR_OPEN -40L
#undef cryptlib_crypt_ERROR_READ
#define cryptlib_crypt_ERROR_READ -41L
#undef cryptlib_crypt_ERROR_WRITE
#define cryptlib_crypt_ERROR_WRITE -42L
#undef cryptlib_crypt_ERROR_NOTFOUND
#define cryptlib_crypt_ERROR_NOTFOUND -43L
#undef cryptlib_crypt_ERROR_DUPLICATE
#define cryptlib_crypt_ERROR_DUPLICATE -44L
#undef cryptlib_crypt_ENVELOPE_RESOURCE
#define cryptlib_crypt_ENVELOPE_RESOURCE -50L


/* Helper Functions */

int processStatus(JNIEnv *env, jint status)
{
    jclass exClass;
    jmethodID exConstructor;
    jthrowable obj;

    if (status >= cryptlib_crypt_OK)
        return 1;

    exClass = (*env)->FindClass(env, "cryptlib/CryptException");
    if (exClass == 0)
    {
        printf("java_jni.c:processStatus - no class?!\n");
        return 0;
    }

    exConstructor = (*env)->GetMethodID(env, exClass, "<init>", "(I)V");
    if (exConstructor == 0)
    {
        printf("java_jni.c:processStatus - no constructor?!\n");
        return 0;
    }

    obj = (*env)->NewObject(env, exClass, exConstructor, status);
    if (obj == 0)
    {
        printf("java_jni.c:processStatus - no object?!\n");
        return 0;
    }

    if ((*env)->Throw(env, obj) < 0)
    {
        printf("java_jni.c:processStatus - failed to throw?!\n");
        return 0;
    }
    return 0;
}

jobject processStatusReturnCryptQueryInfo(JNIEnv *env, int status, CRYPT_QUERY_INFO returnValue)
{
    jclass exClass;
    jmethodID exConstructor;
    jstring algoName;
    jobject obj;

    if (status < cryptlib_crypt_OK)
        return NULL;

    exClass = (*env)->FindClass(env, "cryptlib/CRYPT_QUERY_INFO");
    if (exClass == 0)
    {
        printf("java_jni.c:processStatusReturnCryptQueryInfo - no class?!\n");
        return NULL;
    }

    exConstructor = (*env)->GetMethodID(env, exClass, "<init>", "(Ljava/lang/String;IIII)V");
    if (exConstructor == 0)
    {
        printf("java_jni.c:processStatusReturnCryptQueryInfo - no constructor?!\n");
        return NULL;
    }

    algoName = (*env)->NewStringUTF(env, returnValue.algoName);

    obj = (*env)->NewObject(env, exClass, exConstructor, algoName, returnValue.blockSize, returnValue.minKeySize, returnValue.keySize, returnValue.maxKeySize);
    if (obj == 0)
    {
        printf("java_jni.c:processStatusReturnCryptQueryInfo - no object?!\n");
        return NULL;
    }

    return obj;
}

jobject processStatusReturnCryptObjectInfo(JNIEnv *env, int status, CRYPT_OBJECT_INFO returnValue)
{
    jclass exClass;
    jmethodID exConstructor;
    jbyteArray salt;
    jobject obj;

    if (status < cryptlib_crypt_OK)
        return NULL;

    exClass = (*env)->FindClass(env, "cryptlib/CRYPT_OBJECT_INFO");
    if (exClass == 0)
    {
        printf("java_jni.c:processStatusReturnCryptObjectInfo - no class?!\n");
        return NULL;
    }

    exConstructor = (*env)->GetMethodID(env, exClass, "<init>", "(IIII[B)V");
    if (exConstructor == 0)
    {
        printf("java_jni.c:processStatusReturnCryptObjectInfo - no constructor?!\n");
        return NULL;
    }

    salt = (*env)->NewByteArray(env, returnValue.saltSize);
    (*env)->SetByteArrayRegion(env, salt, 0, returnValue.saltSize, returnValue.salt);

    obj = (*env)->NewObject(env, exClass, exConstructor, returnValue.objectType, returnValue.cryptAlgo, returnValue.cryptMode, returnValue.hashAlgo, salt);
    if (obj == 0)
    {
        printf("java_jni.c:processStatusReturnCryptObjectInfo - no object?!\n");
        return NULL;
    }

    return obj;
}

int checkIndicesArray(JNIEnv *env, jbyteArray array, int sequenceOffset, int sequenceLength)
{
    jsize arrayLength;
    jclass exClass;

    if (array == NULL)
    {
        if (sequenceOffset == 0)
            return 1;
        else
        {
            exClass = (*env)->FindClass(env, "java/lang/ArrayIndexOutOfBoundsException");
            if (exClass == 0)
                printf("java_jni.c:checkIndicesArray - no class?!\n");
            else
            if ((*env)->ThrowNew(env, exClass, "") < 0)
                printf("java_jni.c:checkIndicesArray - failed to throw?!\n");
            return 0;
        }
    }

    arrayLength = (*env)->GetArrayLength(env, array);

    if (sequenceOffset < 0 ||
        sequenceOffset >= arrayLength ||
        sequenceOffset + sequenceLength > arrayLength)
    {
        exClass = (*env)->FindClass(env, "java/lang/ArrayIndexOutOfBoundsException");
        if (exClass == 0)
            printf("java_jni.c:checkIndicesArray - no class?!\n");
        else
        if ((*env)->ThrowNew(env, exClass, "") < 0)
            printf("java_jni.c:checkIndicesArray - failed to throw?!\n");
        return 0;
    }
    return 1;
}

int getPointerArray(JNIEnv* env, jbyteArray array, jbyte** bytesPtrPtr)
{
    jboolean isCopy;

    if (array == NULL)
    {
        (*bytesPtrPtr) = NULL;
        return 1;
    }

    (*bytesPtrPtr) = (*env)->GetByteArrayElements(env, array, &isCopy);

    if (*bytesPtrPtr == NULL)
    {
        printf("java_jni.c:getPointer - failed to get elements of array?!\n");
        return 0;
    }
    return 1;
}

void releasePointerArray(JNIEnv* env,jbyteArray array, jbyte* bytesPtr)
{
    if (bytesPtr == NULL)
        return;
    (*env)->ReleaseByteArrayElements(env, array, bytesPtr, 0);
}

int checkIndicesNIO(JNIEnv *env, jobject byteBuffer, int sequenceOffset, int sequenceLength)
{
    jlong byteBufferLength;
    jclass exClass;

    if (byteBuffer == NULL)
    {
        if (sequenceOffset == 0)
            return 1;
        else
        {
            exClass = (*env)->FindClass(env, "java/lang/ArrayIndexOutOfBoundsException");
            if (exClass == 0)
                printf("java_jni.c:checkIndicesNIO - no class?!\n");
            else
            if ((*env)->ThrowNew(env, exClass, "") < 0)
                printf("java_jni.c:checkIndicesNIO - failed to throw?!\n");
            return 0;
        }
    }

    byteBufferLength = (*env)->GetDirectBufferCapacity(env, byteBuffer);
    if (byteBufferLength == -1)
    {
        exClass = (*env)->FindClass(env, "java/lang/UnsupportedOperationException");
        if (exClass == 0)
            printf("java_jni.c:checkIndicesNIO - no class?!\n");
        else
        if ((*env)->ThrowNew(env, exClass,
"Either a non-direct ByteBuffer was passed or your JVM doesn't support JNI access to direct ByteBuffers") < 0)
            printf("java_jni.c:checkIndicesNIO - failed to throw?!\n");
        return 0;
    }

    if (sequenceOffset < 0 ||
        sequenceOffset >= byteBufferLength ||
        sequenceOffset + sequenceLength > byteBufferLength)
    {
        exClass = (*env)->FindClass(env, "java/lang/ArrayIndexOutOfBoundsException");
        if (exClass == 0)
            printf("java_jni.c:checkIndicesNIO - no class?!\n");
        else
        if ((*env)->ThrowNew(env, exClass, "") < 0)
            printf("java_jni.c:checkIndicesNIO - failed to throw?!\n");
        return 0;
    }
    return 1;
}

int getPointerNIO(JNIEnv* env, jobject byteBuffer, jbyte** bytesPtrPtr)
{
    jclass exClass;

    if (byteBuffer == NULL)
    {
        (*bytesPtrPtr) = NULL;
        return 1;
    }

    (*bytesPtrPtr) = (*env)->GetDirectBufferAddress(env, byteBuffer);

    if (*bytesPtrPtr == NULL)
    {
        exClass = (*env)->FindClass(env, "java/lang/UnsupportedOperationException");
        if (exClass == 0)
            printf("java_jni.c:getPointerNIO - no class?!\n");
        else
        if ((*env)->ThrowNew(env, exClass, "Your JVM doesn't support JNI access to direct ByteBuffers") < 0)
            printf("java_jni.c:getPointerNIO - failed to throw?!\n");
        return 0;
    }
    return 1;
}

void releasePointerNIO(JNIEnv* env,jbyteArray array, jbyte* bytesPtr)
{
}

int getPointerString(JNIEnv* env, jstring str, jbyte** bytesPtrPtr)
{
   jboolean isCopy;
   jsize strLength;
   const jbyte* rawBytesPtr;
   jclass exClass;
#ifdef __WINCE__
   int status;
#endif // __WINCE__


   if (str == NULL)
   {
       (*bytesPtrPtr) = NULL;
       return 1;
   }

   rawBytesPtr = (*env)->GetStringUTFChars(env, str, &isCopy);

   if (rawBytesPtr == NULL)
   {
       printf("java_jni.c:getPointerString - failed to get elements of String?!\n");
       return 0;
   }

   strLength = (*env)->GetStringUTFLength(env, str);

#ifdef __WINCE__
   (*bytesPtrPtr) = (jbyte*)malloc(strLength*2+2); // this is unicode, therefore \0 is two bytes long
#else
   (*bytesPtrPtr) = (jbyte*)malloc(strLength+1);
#endif // __WINCE__

   if (*bytesPtrPtr == NULL)
   {
       exClass = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
       if (exClass == 0)
           printf("java_jni.c:getPointerString - no class?!\n");
       else
       if ((*env)->ThrowNew(env, exClass, "") < 0)
           printf("java_jni.c:getPointerString - failed to throw?!\n");
       (*env)->ReleaseStringUTFChars(env, str, rawBytesPtr);
       return 0;
   }

#ifdef __WINCE__
   status = asciiToUnicode (*bytesPtrPtr, rawBytesPtr, strLength+1);
   if (status == CRYPT_ERROR_BADDATA) {
       (*env)->ReleaseStringUTFChars(env, str, rawBytesPtr);
       return 0;
   }
#else
   memcpy(*bytesPtrPtr, rawBytesPtr, strLength);
   (*bytesPtrPtr)[strLength] = 0;
#endif // __WINCE__

   (*env)->ReleaseStringUTFChars(env, str, rawBytesPtr);

   return 1;
} 

void releasePointerString(JNIEnv* env, jstring str, jbyte* bytesPtr)
{
    if (bytesPtr == NULL)
        return;
    free(bytesPtr);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Init
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_Init
  (JNIEnv * env, jclass cryptClass)
{
	int status = 0;
	
	status = cryptInit();
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    End
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_End
  (JNIEnv * env, jclass cryptClass)
{
	int status = 0;
	
	status = cryptEnd();
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    QueryCapability
 * Signature: (I)Lcryptlib/CRYPT_QUERY_INFO;
 */
JNIEXPORT jobject JNICALL Java_cryptlib_crypt_QueryCapability
  (JNIEnv * env, jclass cryptClass, jint cryptAlgo)
{
	int status = 0;
	CRYPT_QUERY_INFO cryptQueryInfo;
	
	status = cryptQueryCapability(cryptAlgo, &cryptQueryInfo);
	
	return(processStatusReturnCryptQueryInfo(env, status, cryptQueryInfo));
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateContext
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateContext
  (JNIEnv * env, jclass cryptClass, jint cryptUser, jint cryptAlgo)
{
	int status = 0;
	jint cryptContext = 0;
	
	status = cryptCreateContext(&cryptContext, cryptUser, cryptAlgo);
	
	processStatus(env, status);
	return(cryptContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DestroyContext
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DestroyContext
  (JNIEnv * env, jclass cryptClass, jint cryptContext)
{
	int status = 0;
	
	status = cryptDestroyContext(cryptContext);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DestroyObject
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DestroyObject
  (JNIEnv * env, jclass cryptClass, jint cryptObject)
{
	int status = 0;
	
	status = cryptDestroyObject(cryptObject);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GenerateKey
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_GenerateKey
  (JNIEnv * env, jclass cryptClass, jint cryptContext)
{
	int status = 0;
	
	status = cryptGenerateKey(cryptContext);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GenerateKeyAsync
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_GenerateKeyAsync
  (JNIEnv * env, jclass cryptClass, jint cryptContext)
{
	int status = 0;
	
	status = cryptGenerateKeyAsync(cryptContext);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AsyncQuery
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AsyncQuery
  (JNIEnv * env, jclass cryptClass, jint cryptObject)
{
	int status = 0;
	
	status = cryptAsyncQuery(cryptObject);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AsyncCancel
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AsyncCancel
  (JNIEnv * env, jclass cryptClass, jint cryptObject)
{
	int status = 0;
	
	status = cryptAsyncCancel(cryptObject);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Encrypt
 * Signature: (ILjava/nio/ByteBuffer;II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_Encrypt__ILjava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint cryptContext, jobject buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jbyte* bufferPtr = 0;
	
	if (!checkIndicesNIO(env, buffer, bufferOffset, length))
		goto finish;
	
	if (!getPointerNIO(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptEncrypt(cryptContext, bufferPtr + bufferOffset, length);
	
	finish:
	releasePointerNIO(env, buffer, bufferPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Encrypt
 * Signature: (I[BII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_Encrypt__I_3BII
  (JNIEnv * env, jclass cryptClass, jint cryptContext, jbyteArray buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jbyte* bufferPtr = 0;
	
	if (!checkIndicesArray(env, buffer, bufferOffset, length))
		goto finish;
	
	if (!getPointerArray(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptEncrypt(cryptContext, bufferPtr + bufferOffset, length);
	
	finish:
	releasePointerArray(env, buffer, bufferPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Decrypt
 * Signature: (ILjava/nio/ByteBuffer;II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_Decrypt__ILjava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint cryptContext, jobject buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jbyte* bufferPtr = 0;
	
	if (!checkIndicesNIO(env, buffer, bufferOffset, length))
		goto finish;
	
	if (!getPointerNIO(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptDecrypt(cryptContext, bufferPtr + bufferOffset, length);
	
	finish:
	releasePointerNIO(env, buffer, bufferPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Decrypt
 * Signature: (I[BII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_Decrypt__I_3BII
  (JNIEnv * env, jclass cryptClass, jint cryptContext, jbyteArray buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jbyte* bufferPtr = 0;
	
	if (!checkIndicesArray(env, buffer, bufferOffset, length))
		goto finish;
	
	if (!getPointerArray(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptDecrypt(cryptContext, bufferPtr + bufferOffset, length);
	
	finish:
	releasePointerArray(env, buffer, bufferPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    SetAttribute
 * Signature: (III)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_SetAttribute
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType, jint value)
{
	int status = 0;
	
	status = cryptSetAttribute(cryptHandle, attributeType, value);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    SetAttributeString
 * Signature: (IILjava/nio/ByteBuffer;II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_SetAttributeString__IILjava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType, jobject value, jint valueOffset, jint valueLength)
{
	int status = 0;
	jbyte* valuePtr = 0;
	
	if (!checkIndicesNIO(env, value, valueOffset, valueLength))
		goto finish;
	
	if (!getPointerNIO(env, value, &valuePtr))
		goto finish;
	
	status = cryptSetAttributeString(cryptHandle, attributeType, valuePtr + valueOffset, valueLength);
	
	finish:
	releasePointerNIO(env, value, valuePtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    SetAttributeString
 * Signature: (II[BII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_SetAttributeString__II_3BII
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType, jbyteArray value, jint valueOffset, jint valueLength)
{
	int status = 0;
	jbyte* valuePtr = 0;
	
	if (!checkIndicesArray(env, value, valueOffset, valueLength))
		goto finish;
	
	if (!getPointerArray(env, value, &valuePtr))
		goto finish;
	
	status = cryptSetAttributeString(cryptHandle, attributeType, valuePtr + valueOffset, valueLength);
	
	finish:
	releasePointerArray(env, value, valuePtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetAttribute
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetAttribute
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType)
{
	int status = 0;
	jint value = 0;
	
	status = cryptGetAttribute(cryptHandle, attributeType, &value);
	
	processStatus(env, status);
	return(value);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetAttributeString
 * Signature: (IILjava/nio/ByteBuffer;I)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetAttributeString__IILjava_nio_ByteBuffer_2I
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType, jobject value, jint valueOffset)
{
	int status = 0;
	jint valueLength = 0;
	jbyte* valuePtr = 0;
	
	if (!processStatus(env, cryptGetAttributeString(cryptHandle, attributeType, NULL, &valueLength)))
		goto finish;
	
	if (!checkIndicesNIO(env, value, valueOffset, valueLength))
		goto finish;
	
	if (!getPointerNIO(env, value, &valuePtr))
		goto finish;
	
	status = cryptGetAttributeString(cryptHandle, attributeType, valuePtr + valueOffset, &valueLength);
	
	finish:
	releasePointerNIO(env, value, valuePtr);
	processStatus(env, status);
	return(valueLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetAttributeString
 * Signature: (II[BI)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetAttributeString__II_3BI
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType, jbyteArray value, jint valueOffset)
{
	int status = 0;
	jint valueLength = 0;
	jbyte* valuePtr = 0;
	
	if (!processStatus(env, cryptGetAttributeString(cryptHandle, attributeType, NULL, &valueLength)))
		goto finish;
	
	if (!checkIndicesArray(env, value, valueOffset, valueLength))
		goto finish;
	
	if (!getPointerArray(env, value, &valuePtr))
		goto finish;
	
	status = cryptGetAttributeString(cryptHandle, attributeType, valuePtr + valueOffset, &valueLength);
	
	finish:
	releasePointerArray(env, value, valuePtr);
	processStatus(env, status);
	return(valueLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeleteAttribute
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DeleteAttribute
  (JNIEnv * env, jclass cryptClass, jint cryptHandle, jint attributeType)
{
	int status = 0;
	
	status = cryptDeleteAttribute(cryptHandle, attributeType);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddRandom
 * Signature: (Ljava/nio/ByteBuffer;II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddRandom__Ljava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jobject randomData, jint randomDataOffset, jint randomDataLength)
{
	int status = 0;
	jbyte* randomDataPtr = 0;
	
	if (!checkIndicesNIO(env, randomData, randomDataOffset, randomDataLength))
		goto finish;
	
	if (!getPointerNIO(env, randomData, &randomDataPtr))
		goto finish;
	
	status = cryptAddRandom(randomDataPtr + randomDataOffset, randomDataLength);
	
	finish:
	releasePointerNIO(env, randomData, randomDataPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddRandom
 * Signature: ([BII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddRandom___3BII
  (JNIEnv * env, jclass cryptClass, jbyteArray randomData, jint randomDataOffset, jint randomDataLength)
{
	int status = 0;
	jbyte* randomDataPtr = 0;
	
	if (!checkIndicesArray(env, randomData, randomDataOffset, randomDataLength))
		goto finish;
	
	if (!getPointerArray(env, randomData, &randomDataPtr))
		goto finish;
	
	status = cryptAddRandom(randomDataPtr + randomDataOffset, randomDataLength);
	
	finish:
	releasePointerArray(env, randomData, randomDataPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddRandom
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddRandom__I
  (JNIEnv * env, jclass cryptClass, jint pollType)
{
	int status = 0;
	
	status = cryptAddRandom(NULL, pollType);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    QueryObject
 * Signature: (Ljava/nio/ByteBuffer;II)Lcryptlib/CRYPT_OBJECT_INFO;
 */
JNIEXPORT jobject JNICALL Java_cryptlib_crypt_QueryObject__Ljava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jobject objectData, jint objectDataOffset, jint objectDataLength)
{
	int status = 0;
	CRYPT_OBJECT_INFO cryptObjectInfo;
	jbyte* objectDataPtr = 0;
	
	if (!checkIndicesNIO(env, objectData, objectDataOffset, objectDataLength))
		goto finish;
	
	if (!getPointerNIO(env, objectData, &objectDataPtr))
		goto finish;
	
	status = cryptQueryObject(objectDataPtr + objectDataOffset, objectDataLength, &cryptObjectInfo);
	
	finish:
	releasePointerNIO(env, objectData, objectDataPtr);
	return(processStatusReturnCryptObjectInfo(env, status, cryptObjectInfo));
}

/*
 * Class:     cryptlib_crypt
 * Method:    QueryObject
 * Signature: ([BII)Lcryptlib/CRYPT_OBJECT_INFO;
 */
JNIEXPORT jobject JNICALL Java_cryptlib_crypt_QueryObject___3BII
  (JNIEnv * env, jclass cryptClass, jbyteArray objectData, jint objectDataOffset, jint objectDataLength)
{
	int status = 0;
	CRYPT_OBJECT_INFO cryptObjectInfo;
	jbyte* objectDataPtr = 0;
	
	if (!checkIndicesArray(env, objectData, objectDataOffset, objectDataLength))
		goto finish;
	
	if (!getPointerArray(env, objectData, &objectDataPtr))
		goto finish;
	
	status = cryptQueryObject(objectDataPtr + objectDataOffset, objectDataLength, &cryptObjectInfo);
	
	finish:
	releasePointerArray(env, objectData, objectDataPtr);
	return(processStatusReturnCryptObjectInfo(env, status, cryptObjectInfo));
}

/*
 * Class:     cryptlib_crypt
 * Method:    ExportKey
 * Signature: (Ljava/nio/ByteBuffer;IIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ExportKey__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject encryptedKey, jint encryptedKeyOffset, jint encryptedKeyMaxLength, jint exportKey, jint sessionKeyContext)
{
	int status = 0;
	jint encryptedKeyLength = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!processStatus(env, cryptExportKey(NULL, encryptedKeyMaxLength, &encryptedKeyLength, exportKey, sessionKeyContext)))
		goto finish;
	
	if (!checkIndicesNIO(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerNIO(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptExportKey(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyMaxLength, &encryptedKeyLength, exportKey, sessionKeyContext);
	
	finish:
	releasePointerNIO(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
	return(encryptedKeyLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ExportKey
 * Signature: ([BIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ExportKey___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray encryptedKey, jint encryptedKeyOffset, jint encryptedKeyMaxLength, jint exportKey, jint sessionKeyContext)
{
	int status = 0;
	jint encryptedKeyLength = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!processStatus(env, cryptExportKey(NULL, encryptedKeyMaxLength, &encryptedKeyLength, exportKey, sessionKeyContext)))
		goto finish;
	
	if (!checkIndicesArray(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerArray(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptExportKey(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyMaxLength, &encryptedKeyLength, exportKey, sessionKeyContext);
	
	finish:
	releasePointerArray(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
	return(encryptedKeyLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ExportKeyEx
 * Signature: (Ljava/nio/ByteBuffer;IIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ExportKeyEx__Ljava_nio_ByteBuffer_2IIIII
  (JNIEnv * env, jclass cryptClass, jobject encryptedKey, jint encryptedKeyOffset, jint encryptedKeyMaxLength, jint formatType, jint exportKey, jint sessionKeyContext)
{
	int status = 0;
	jint encryptedKeyLength = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!processStatus(env, cryptExportKeyEx(NULL, encryptedKeyMaxLength, &encryptedKeyLength, formatType, exportKey, sessionKeyContext)))
		goto finish;
	
	if (!checkIndicesNIO(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerNIO(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptExportKeyEx(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyMaxLength, &encryptedKeyLength, formatType, exportKey, sessionKeyContext);
	
	finish:
	releasePointerNIO(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
	return(encryptedKeyLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ExportKeyEx
 * Signature: ([BIIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ExportKeyEx___3BIIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray encryptedKey, jint encryptedKeyOffset, jint encryptedKeyMaxLength, jint formatType, jint exportKey, jint sessionKeyContext)
{
	int status = 0;
	jint encryptedKeyLength = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!processStatus(env, cryptExportKeyEx(NULL, encryptedKeyMaxLength, &encryptedKeyLength, formatType, exportKey, sessionKeyContext)))
		goto finish;
	
	if (!checkIndicesArray(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerArray(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptExportKeyEx(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyMaxLength, &encryptedKeyLength, formatType, exportKey, sessionKeyContext);
	
	finish:
	releasePointerArray(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
	return(encryptedKeyLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ImportKey
 * Signature: (Ljava/nio/ByteBuffer;IIII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_ImportKey__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject encryptedKey, jint encryptedKeyOffset, jint encryptedKeyLength, jint importKey, jint sessionKeyContext)
{
	int status = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!checkIndicesNIO(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerNIO(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptImportKey(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyLength, importKey, sessionKeyContext);
	
	finish:
	releasePointerNIO(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ImportKey
 * Signature: ([BIIII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_ImportKey___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray encryptedKey, jint encryptedKeyOffset, jint encryptedKeyLength, jint importKey, jint sessionKeyContext)
{
	int status = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!checkIndicesArray(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerArray(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptImportKey(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyLength, importKey, sessionKeyContext);
	
	finish:
	releasePointerArray(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ImportKeyEx
 * Signature: (Ljava/nio/ByteBuffer;IIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ImportKeyEx__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject encryptedKey, jint encryptedKeyOffset, jint encryptedKeyLength, jint importKey, jint sessionKeyContext)
{
	int status = 0;
	jint returnedContext = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!checkIndicesNIO(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerNIO(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptImportKeyEx(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyLength, importKey, sessionKeyContext, &returnedContext);
	
	finish:
	releasePointerNIO(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
	return(returnedContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ImportKeyEx
 * Signature: ([BIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ImportKeyEx___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray encryptedKey, jint encryptedKeyOffset, jint encryptedKeyLength, jint importKey, jint sessionKeyContext)
{
	int status = 0;
	jint returnedContext = 0;
	jbyte* encryptedKeyPtr = 0;
	
	if (!checkIndicesArray(env, encryptedKey, encryptedKeyOffset, encryptedKeyLength))
		goto finish;
	
	if (!getPointerArray(env, encryptedKey, &encryptedKeyPtr))
		goto finish;
	
	status = cryptImportKeyEx(encryptedKeyPtr + encryptedKeyOffset, encryptedKeyLength, importKey, sessionKeyContext, &returnedContext);
	
	finish:
	releasePointerArray(env, encryptedKey, encryptedKeyPtr);
	processStatus(env, status);
	return(returnedContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateSignature
 * Signature: (Ljava/nio/ByteBuffer;IIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateSignature__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject signature, jint signatureOffset, jint signatureMaxLength, jint signContext, jint hashContext)
{
	int status = 0;
	jint signatureLength = 0;
	jbyte* signaturePtr = 0;
	
	if (!processStatus(env, cryptCreateSignature(NULL, signatureMaxLength, &signatureLength, signContext, hashContext)))
		goto finish;
	
	if (!checkIndicesNIO(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerNIO(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCreateSignature(signaturePtr + signatureOffset, signatureMaxLength, &signatureLength, signContext, hashContext);
	
	finish:
	releasePointerNIO(env, signature, signaturePtr);
	processStatus(env, status);
	return(signatureLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateSignature
 * Signature: ([BIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateSignature___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray signature, jint signatureOffset, jint signatureMaxLength, jint signContext, jint hashContext)
{
	int status = 0;
	jint signatureLength = 0;
	jbyte* signaturePtr = 0;
	
	if (!processStatus(env, cryptCreateSignature(NULL, signatureMaxLength, &signatureLength, signContext, hashContext)))
		goto finish;
	
	if (!checkIndicesArray(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerArray(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCreateSignature(signaturePtr + signatureOffset, signatureMaxLength, &signatureLength, signContext, hashContext);
	
	finish:
	releasePointerArray(env, signature, signaturePtr);
	processStatus(env, status);
	return(signatureLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateSignatureEx
 * Signature: (Ljava/nio/ByteBuffer;IIIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateSignatureEx__Ljava_nio_ByteBuffer_2IIIIII
  (JNIEnv * env, jclass cryptClass, jobject signature, jint signatureOffset, jint signatureMaxLength, jint formatType, jint signContext, jint hashContext, jint extraData)
{
	int status = 0;
	jint signatureLength = 0;
	jbyte* signaturePtr = 0;
	
	if (!processStatus(env, cryptCreateSignatureEx(NULL, signatureMaxLength, &signatureLength, formatType, signContext, hashContext, extraData)))
		goto finish;
	
	if (!checkIndicesNIO(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerNIO(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCreateSignatureEx(signaturePtr + signatureOffset, signatureMaxLength, &signatureLength, formatType, signContext, hashContext, extraData);
	
	finish:
	releasePointerNIO(env, signature, signaturePtr);
	processStatus(env, status);
	return(signatureLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateSignatureEx
 * Signature: ([BIIIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateSignatureEx___3BIIIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray signature, jint signatureOffset, jint signatureMaxLength, jint formatType, jint signContext, jint hashContext, jint extraData)
{
	int status = 0;
	jint signatureLength = 0;
	jbyte* signaturePtr = 0;
	
	if (!processStatus(env, cryptCreateSignatureEx(NULL, signatureMaxLength, &signatureLength, formatType, signContext, hashContext, extraData)))
		goto finish;
	
	if (!checkIndicesArray(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerArray(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCreateSignatureEx(signaturePtr + signatureOffset, signatureMaxLength, &signatureLength, formatType, signContext, hashContext, extraData);
	
	finish:
	releasePointerArray(env, signature, signaturePtr);
	processStatus(env, status);
	return(signatureLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CheckSignature
 * Signature: (Ljava/nio/ByteBuffer;IIII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_CheckSignature__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject signature, jint signatureOffset, jint signatureLength, jint sigCheckKey, jint hashContext)
{
	int status = 0;
	jbyte* signaturePtr = 0;
	
	if (!checkIndicesNIO(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerNIO(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCheckSignature(signaturePtr + signatureOffset, signatureLength, sigCheckKey, hashContext);
	
	finish:
	releasePointerNIO(env, signature, signaturePtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CheckSignature
 * Signature: ([BIIII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_CheckSignature___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray signature, jint signatureOffset, jint signatureLength, jint sigCheckKey, jint hashContext)
{
	int status = 0;
	jbyte* signaturePtr = 0;
	
	if (!checkIndicesArray(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerArray(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCheckSignature(signaturePtr + signatureOffset, signatureLength, sigCheckKey, hashContext);
	
	finish:
	releasePointerArray(env, signature, signaturePtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CheckSignatureEx
 * Signature: (Ljava/nio/ByteBuffer;IIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CheckSignatureEx__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject signature, jint signatureOffset, jint signatureLength, jint sigCheckKey, jint hashContext)
{
	int status = 0;
	jint extraData = 0;
	jbyte* signaturePtr = 0;
	
	if (!checkIndicesNIO(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerNIO(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCheckSignatureEx(signaturePtr + signatureOffset, signatureLength, sigCheckKey, hashContext, &extraData);
	
	finish:
	releasePointerNIO(env, signature, signaturePtr);
	processStatus(env, status);
	return(extraData);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CheckSignatureEx
 * Signature: ([BIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CheckSignatureEx___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray signature, jint signatureOffset, jint signatureLength, jint sigCheckKey, jint hashContext)
{
	int status = 0;
	jint extraData = 0;
	jbyte* signaturePtr = 0;
	
	if (!checkIndicesArray(env, signature, signatureOffset, signatureLength))
		goto finish;
	
	if (!getPointerArray(env, signature, &signaturePtr))
		goto finish;
	
	status = cryptCheckSignatureEx(signaturePtr + signatureOffset, signatureLength, sigCheckKey, hashContext, &extraData);
	
	finish:
	releasePointerArray(env, signature, signaturePtr);
	processStatus(env, status);
	return(extraData);
}

/*
 * Class:     cryptlib_crypt
 * Method:    KeysetOpen
 * Signature: (IILjava/lang/String;I)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_KeysetOpen
  (JNIEnv * env, jclass cryptClass, jint cryptUser, jint keysetType, jstring name, jint options)
{
	int status = 0;
	jint keyset = 0;
	jbyte* namePtr = 0;
	
	if (!getPointerString(env, name, &namePtr))
		goto finish;
	
	status = cryptKeysetOpen(&keyset, cryptUser, keysetType, namePtr, options);
	
	finish:
	releasePointerString(env, name, namePtr);
	processStatus(env, status);
	return(keyset);
}

/*
 * Class:     cryptlib_crypt
 * Method:    KeysetClose
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_KeysetClose
  (JNIEnv * env, jclass cryptClass, jint keyset)
{
	int status = 0;
	
	status = cryptKeysetClose(keyset);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetPublicKey
 * Signature: (IILjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetPublicKey
  (JNIEnv * env, jclass cryptClass, jint keyset, jint keyIDtype, jstring keyID)
{
	int status = 0;
	jint cryptContext = 0;
	jbyte* keyIDPtr = 0;
	
	if (!getPointerString(env, keyID, &keyIDPtr))
		goto finish;
	
	status = cryptGetPublicKey(keyset, &cryptContext, keyIDtype, keyIDPtr);
	
	finish:
	releasePointerString(env, keyID, keyIDPtr);
	processStatus(env, status);
	return(cryptContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetPrivateKey
 * Signature: (IILjava/lang/String;Ljava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetPrivateKey
  (JNIEnv * env, jclass cryptClass, jint keyset, jint keyIDtype, jstring keyID, jstring password)
{
	int status = 0;
	jint cryptContext = 0;
	jbyte* keyIDPtr = 0;
	jbyte* passwordPtr = 0;
	
	if (!getPointerString(env, keyID, &keyIDPtr))
		goto finish;
	if (!getPointerString(env, password, &passwordPtr))
		goto finish;
	
	status = cryptGetPrivateKey(keyset, &cryptContext, keyIDtype, keyIDPtr, passwordPtr);
	
	finish:
	releasePointerString(env, keyID, keyIDPtr);
	releasePointerString(env, password, passwordPtr);
	processStatus(env, status);
	return(cryptContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetKey
 * Signature: (IILjava/lang/String;Ljava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetKey
  (JNIEnv * env, jclass cryptClass, jint keyset, jint keyIDtype, jstring keyID, jstring password)
{
	int status = 0;
	jint cryptContext = 0;
	jbyte* keyIDPtr = 0;
	jbyte* passwordPtr = 0;
	
	if (!getPointerString(env, keyID, &keyIDPtr))
		goto finish;
	if (!getPointerString(env, password, &passwordPtr))
		goto finish;
	
	status = cryptGetKey(keyset, &cryptContext, keyIDtype, keyIDPtr, passwordPtr);
	
	finish:
	releasePointerString(env, keyID, keyIDPtr);
	releasePointerString(env, password, passwordPtr);
	processStatus(env, status);
	return(cryptContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddPublicKey
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddPublicKey
  (JNIEnv * env, jclass cryptClass, jint keyset, jint certificate)
{
	int status = 0;
	
	status = cryptAddPublicKey(keyset, certificate);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddPrivateKey
 * Signature: (IILjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddPrivateKey
  (JNIEnv * env, jclass cryptClass, jint keyset, jint cryptKey, jstring password)
{
	int status = 0;
	jbyte* passwordPtr = 0;
	
	if (!getPointerString(env, password, &passwordPtr))
		goto finish;
	
	status = cryptAddPrivateKey(keyset, cryptKey, passwordPtr);
	
	finish:
	releasePointerString(env, password, passwordPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeleteKey
 * Signature: (IILjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DeleteKey
  (JNIEnv * env, jclass cryptClass, jint keyset, jint keyIDtype, jstring keyID)
{
	int status = 0;
	jbyte* keyIDPtr = 0;
	
	if (!getPointerString(env, keyID, &keyIDPtr))
		goto finish;
	
	status = cryptDeleteKey(keyset, keyIDtype, keyIDPtr);
	
	finish:
	releasePointerString(env, keyID, keyIDPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateCert
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateCert
  (JNIEnv * env, jclass cryptClass, jint cryptUser, jint certType)
{
	int status = 0;
	jint certificate = 0;
	
	status = cryptCreateCert(&certificate, cryptUser, certType);
	
	processStatus(env, status);
	return(certificate);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DestroyCert
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DestroyCert
  (JNIEnv * env, jclass cryptClass, jint certificate)
{
	int status = 0;
	
	status = cryptDestroyCert(certificate);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetCertExtension
 * Signature: (ILjava/lang/String;Ljava/nio/ByteBuffer;II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetCertExtension__ILjava_lang_String_2Ljava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint certificate, jstring oid, jobject extension, jint extensionOffset, jint extensionMaxLength)
{
	int status = 0;
	jint extensionLength = 0;
	jint criticalFlag = 0;
	jbyte* oidPtr = 0;
	jbyte* extensionPtr = 0;
	
	if (!getPointerString(env, oid, &oidPtr))
		goto finish;
	
	if (!processStatus(env, cryptGetCertExtension(certificate, oidPtr, &criticalFlag, NULL, extensionMaxLength, &extensionLength)))
		goto finish;
	
	if (!checkIndicesNIO(env, extension, extensionOffset, extensionLength))
		goto finish;
	
	if (!getPointerNIO(env, extension, &extensionPtr))
		goto finish;
	
	status = cryptGetCertExtension(certificate, oidPtr, &criticalFlag, extensionPtr + extensionOffset, extensionMaxLength, &extensionLength);
	
	finish:
	releasePointerNIO(env, extension, extensionPtr);
	releasePointerString(env, oid, oidPtr);
	processStatus(env, status);
	return(extensionLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    GetCertExtension
 * Signature: (ILjava/lang/String;[BII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_GetCertExtension__ILjava_lang_String_2_3BII
  (JNIEnv * env, jclass cryptClass, jint certificate, jstring oid, jbyteArray extension, jint extensionOffset, jint extensionMaxLength)
{
	int status = 0;
	jint extensionLength = 0;
	jint criticalFlag = 0;
	jbyte* oidPtr = 0;
	jbyte* extensionPtr = 0;
	
	if (!getPointerString(env, oid, &oidPtr))
		goto finish;
	
	if (!processStatus(env, cryptGetCertExtension(certificate, oidPtr, &criticalFlag, NULL, extensionMaxLength, &extensionLength)))
		goto finish;
	
	if (!checkIndicesArray(env, extension, extensionOffset, extensionLength))
		goto finish;
	
	if (!getPointerArray(env, extension, &extensionPtr))
		goto finish;
	
	status = cryptGetCertExtension(certificate, oidPtr, &criticalFlag, extensionPtr + extensionOffset, extensionMaxLength, &extensionLength);
	
	finish:
	releasePointerArray(env, extension, extensionPtr);
	releasePointerString(env, oid, oidPtr);
	processStatus(env, status);
	return(extensionLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddCertExtension
 * Signature: (ILjava/lang/String;ILjava/nio/ByteBuffer;II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddCertExtension__ILjava_lang_String_2ILjava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint certificate, jstring oid, jint criticalFlag, jobject extension, jint extensionOffset, jint extensionLength)
{
	int status = 0;
	jbyte* oidPtr = 0;
	jbyte* extensionPtr = 0;
	
	if (!getPointerString(env, oid, &oidPtr))
		goto finish;
	
	if (!checkIndicesNIO(env, extension, extensionOffset, extensionLength))
		goto finish;
	
	if (!getPointerNIO(env, extension, &extensionPtr))
		goto finish;
	
	status = cryptAddCertExtension(certificate, oidPtr, criticalFlag, extensionPtr + extensionOffset, extensionLength);
	
	finish:
	releasePointerNIO(env, extension, extensionPtr);
	releasePointerString(env, oid, oidPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    AddCertExtension
 * Signature: (ILjava/lang/String;I[BII)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_AddCertExtension__ILjava_lang_String_2I_3BII
  (JNIEnv * env, jclass cryptClass, jint certificate, jstring oid, jint criticalFlag, jbyteArray extension, jint extensionOffset, jint extensionLength)
{
	int status = 0;
	jbyte* oidPtr = 0;
	jbyte* extensionPtr = 0;
	
	if (!getPointerString(env, oid, &oidPtr))
		goto finish;
	
	if (!checkIndicesArray(env, extension, extensionOffset, extensionLength))
		goto finish;
	
	if (!getPointerArray(env, extension, &extensionPtr))
		goto finish;
	
	status = cryptAddCertExtension(certificate, oidPtr, criticalFlag, extensionPtr + extensionOffset, extensionLength);
	
	finish:
	releasePointerArray(env, extension, extensionPtr);
	releasePointerString(env, oid, oidPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeleteCertExtension
 * Signature: (ILjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DeleteCertExtension
  (JNIEnv * env, jclass cryptClass, jint certificate, jstring oid)
{
	int status = 0;
	jbyte* oidPtr = 0;
	
	if (!getPointerString(env, oid, &oidPtr))
		goto finish;
	
	status = cryptDeleteCertExtension(certificate, oidPtr);
	
	finish:
	releasePointerString(env, oid, oidPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    SignCert
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_SignCert
  (JNIEnv * env, jclass cryptClass, jint certificate, jint signContext)
{
	int status = 0;
	
	status = cryptSignCert(certificate, signContext);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CheckCert
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_CheckCert
  (JNIEnv * env, jclass cryptClass, jint certificate, jint sigCheckKey)
{
	int status = 0;
	
	status = cryptCheckCert(certificate, sigCheckKey);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ImportCert
 * Signature: (Ljava/nio/ByteBuffer;III)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ImportCert__Ljava_nio_ByteBuffer_2III
  (JNIEnv * env, jclass cryptClass, jobject certObject, jint certObjectOffset, jint certObjectLength, jint cryptUser)
{
	int status = 0;
	jint certificate = 0;
	jbyte* certObjectPtr = 0;
	
	if (!checkIndicesNIO(env, certObject, certObjectOffset, certObjectLength))
		goto finish;
	
	if (!getPointerNIO(env, certObject, &certObjectPtr))
		goto finish;
	
	status = cryptImportCert(certObjectPtr + certObjectOffset, certObjectLength, cryptUser, &certificate);
	
	finish:
	releasePointerNIO(env, certObject, certObjectPtr);
	processStatus(env, status);
	return(certificate);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ImportCert
 * Signature: ([BIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ImportCert___3BIII
  (JNIEnv * env, jclass cryptClass, jbyteArray certObject, jint certObjectOffset, jint certObjectLength, jint cryptUser)
{
	int status = 0;
	jint certificate = 0;
	jbyte* certObjectPtr = 0;
	
	if (!checkIndicesArray(env, certObject, certObjectOffset, certObjectLength))
		goto finish;
	
	if (!getPointerArray(env, certObject, &certObjectPtr))
		goto finish;
	
	status = cryptImportCert(certObjectPtr + certObjectOffset, certObjectLength, cryptUser, &certificate);
	
	finish:
	releasePointerArray(env, certObject, certObjectPtr);
	processStatus(env, status);
	return(certificate);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ExportCert
 * Signature: (Ljava/nio/ByteBuffer;IIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ExportCert__Ljava_nio_ByteBuffer_2IIII
  (JNIEnv * env, jclass cryptClass, jobject certObject, jint certObjectOffset, jint certObjectMaxLength, jint certFormatType, jint certificate)
{
	int status = 0;
	jint certObjectLength = 0;
	jbyte* certObjectPtr = 0;
	
	if (!processStatus(env, cryptExportCert(NULL, certObjectMaxLength, &certObjectLength, certFormatType, certificate)))
		goto finish;
	
	if (!checkIndicesNIO(env, certObject, certObjectOffset, certObjectLength))
		goto finish;
	
	if (!getPointerNIO(env, certObject, &certObjectPtr))
		goto finish;
	
	status = cryptExportCert(certObjectPtr + certObjectOffset, certObjectMaxLength, &certObjectLength, certFormatType, certificate);
	
	finish:
	releasePointerNIO(env, certObject, certObjectPtr);
	processStatus(env, status);
	return(certObjectLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    ExportCert
 * Signature: ([BIIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_ExportCert___3BIIII
  (JNIEnv * env, jclass cryptClass, jbyteArray certObject, jint certObjectOffset, jint certObjectMaxLength, jint certFormatType, jint certificate)
{
	int status = 0;
	jint certObjectLength = 0;
	jbyte* certObjectPtr = 0;
	
	if (!processStatus(env, cryptExportCert(NULL, certObjectMaxLength, &certObjectLength, certFormatType, certificate)))
		goto finish;
	
	if (!checkIndicesArray(env, certObject, certObjectOffset, certObjectLength))
		goto finish;
	
	if (!getPointerArray(env, certObject, &certObjectPtr))
		goto finish;
	
	status = cryptExportCert(certObjectPtr + certObjectOffset, certObjectMaxLength, &certObjectLength, certFormatType, certificate);
	
	finish:
	releasePointerArray(env, certObject, certObjectPtr);
	processStatus(env, status);
	return(certObjectLength);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CAAddItem
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_CAAddItem
  (JNIEnv * env, jclass cryptClass, jint keyset, jint certificate)
{
	int status = 0;
	
	status = cryptCAAddItem(keyset, certificate);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CAGetItem
 * Signature: (IIILjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CAGetItem
  (JNIEnv * env, jclass cryptClass, jint keyset, jint certType, jint keyIDtype, jstring keyID)
{
	int status = 0;
	jint certificate = 0;
	jbyte* keyIDPtr = 0;
	
	if (!getPointerString(env, keyID, &keyIDPtr))
		goto finish;
	
	status = cryptCAGetItem(keyset, &certificate, certType, keyIDtype, keyIDPtr);
	
	finish:
	releasePointerString(env, keyID, keyIDPtr);
	processStatus(env, status);
	return(certificate);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CADeleteItem
 * Signature: (IIILjava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_CADeleteItem
  (JNIEnv * env, jclass cryptClass, jint keyset, jint certType, jint keyIDtype, jstring keyID)
{
	int status = 0;
	jbyte* keyIDPtr = 0;
	
	if (!getPointerString(env, keyID, &keyIDPtr))
		goto finish;
	
	status = cryptCADeleteItem(keyset, certType, keyIDtype, keyIDPtr);
	
	finish:
	releasePointerString(env, keyID, keyIDPtr);
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CACertManagement
 * Signature: (IIII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CACertManagement
  (JNIEnv * env, jclass cryptClass, jint action, jint keyset, jint caKey, jint certRequest)
{
	int status = 0;
	jint certificate = 0;
	
	status = cryptCACertManagement(&certificate, action, keyset, caKey, certRequest);
	
	processStatus(env, status);
	return(certificate);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateEnvelope
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateEnvelope
  (JNIEnv * env, jclass cryptClass, jint cryptUser, jint formatType)
{
	int status = 0;
	jint envelope = 0;
	
	status = cryptCreateEnvelope(&envelope, cryptUser, formatType);
	
	processStatus(env, status);
	return(envelope);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DestroyEnvelope
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DestroyEnvelope
  (JNIEnv * env, jclass cryptClass, jint envelope)
{
	int status = 0;
	
	status = cryptDestroyEnvelope(envelope);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    CreateSession
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_CreateSession
  (JNIEnv * env, jclass cryptClass, jint cryptUser, jint formatType)
{
	int status = 0;
	jint session = 0;
	
	status = cryptCreateSession(&session, cryptUser, formatType);
	
	processStatus(env, status);
	return(session);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DestroySession
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DestroySession
  (JNIEnv * env, jclass cryptClass, jint session)
{
	int status = 0;
	
	status = cryptDestroySession(session);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    PushData
 * Signature: (ILjava/nio/ByteBuffer;II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_PushData__ILjava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint envelope, jobject buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jint bytesCopied = 0;
	jbyte* bufferPtr = 0;
	
	if (!checkIndicesNIO(env, buffer, bufferOffset, length))
		goto finish;
	
	if (!getPointerNIO(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptPushData(envelope, bufferPtr + bufferOffset, length, &bytesCopied);
	
	finish:
	releasePointerNIO(env, buffer, bufferPtr);
	processStatus(env, status);
	return(bytesCopied);
}

/*
 * Class:     cryptlib_crypt
 * Method:    PushData
 * Signature: (I[BII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_PushData__I_3BII
  (JNIEnv * env, jclass cryptClass, jint envelope, jbyteArray buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jint bytesCopied = 0;
	jbyte* bufferPtr = 0;
	
	if (!checkIndicesArray(env, buffer, bufferOffset, length))
		goto finish;
	
	if (!getPointerArray(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptPushData(envelope, bufferPtr + bufferOffset, length, &bytesCopied);
	
	finish:
	releasePointerArray(env, buffer, bufferPtr);
	processStatus(env, status);
	return(bytesCopied);
}

/*
 * Class:     cryptlib_crypt
 * Method:    FlushData
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_FlushData
  (JNIEnv * env, jclass cryptClass, jint envelope)
{
	int status = 0;
	
	status = cryptFlushData(envelope);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    PopData
 * Signature: (ILjava/nio/ByteBuffer;II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_PopData__ILjava_nio_ByteBuffer_2II
  (JNIEnv * env, jclass cryptClass, jint envelope, jobject buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jint bytesCopied = 0;
	jbyte* bufferPtr = 0;
	
	//CryptPopData is a special case that doesn't have the length querying call
	
	if (!checkIndicesNIO(env, buffer, bufferOffset, bytesCopied))
		goto finish;
	
	if (!getPointerNIO(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptPopData(envelope, bufferPtr + bufferOffset, length, &bytesCopied);
	
	finish:
	releasePointerNIO(env, buffer, bufferPtr);
	processStatus(env, status);
	return(bytesCopied);
}

/*
 * Class:     cryptlib_crypt
 * Method:    PopData
 * Signature: (I[BII)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_PopData__I_3BII
  (JNIEnv * env, jclass cryptClass, jint envelope, jbyteArray buffer, jint bufferOffset, jint length)
{
	int status = 0;
	jint bytesCopied = 0;
	jbyte* bufferPtr = 0;
	
	//CryptPopData is a special case that doesn't have the length querying call
	
	if (!checkIndicesArray(env, buffer, bufferOffset, bytesCopied))
		goto finish;
	
	if (!getPointerArray(env, buffer, &bufferPtr))
		goto finish;
	
	status = cryptPopData(envelope, bufferPtr + bufferOffset, length, &bytesCopied);
	
	finish:
	releasePointerArray(env, buffer, bufferPtr);
	processStatus(env, status);
	return(bytesCopied);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeviceOpen
 * Signature: (IILjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_DeviceOpen
  (JNIEnv * env, jclass cryptClass, jint cryptUser, jint deviceType, jstring name)
{
	int status = 0;
	jint device = 0;
	jbyte* namePtr = 0;
	
	if (!getPointerString(env, name, &namePtr))
		goto finish;
	
	status = cryptDeviceOpen(&device, cryptUser, deviceType, namePtr);
	
	finish:
	releasePointerString(env, name, namePtr);
	processStatus(env, status);
	return(device);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeviceClose
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_DeviceClose
  (JNIEnv * env, jclass cryptClass, jint device)
{
	int status = 0;
	
	status = cryptDeviceClose(device);
	
	processStatus(env, status);
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeviceQueryCapability
 * Signature: (II)Lcryptlib/CRYPT_QUERY_INFO;
 */
JNIEXPORT jobject JNICALL Java_cryptlib_crypt_DeviceQueryCapability
  (JNIEnv * env, jclass cryptClass, jint device, jint cryptAlgo)
{
	int status = 0;
	CRYPT_QUERY_INFO cryptQueryInfo;
	
	status = cryptDeviceQueryCapability(device, cryptAlgo, &cryptQueryInfo);
	
	return(processStatusReturnCryptQueryInfo(env, status, cryptQueryInfo));
}

/*
 * Class:     cryptlib_crypt
 * Method:    DeviceCreateContext
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_DeviceCreateContext
  (JNIEnv * env, jclass cryptClass, jint device, jint cryptAlgo)
{
	int status = 0;
	jint cryptContext = 0;
	
	status = cryptDeviceCreateContext(device, &cryptContext, cryptAlgo);
	
	processStatus(env, status);
	return(cryptContext);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Login
 * Signature: (Ljava/lang/String;Ljava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_cryptlib_crypt_Login
  (JNIEnv * env, jclass cryptClass, jstring name, jstring password)
{
	int status = 0;
	jint user = 0;
	jbyte* namePtr = 0;
	jbyte* passwordPtr = 0;
	
	if (!getPointerString(env, name, &namePtr))
		goto finish;
	if (!getPointerString(env, password, &passwordPtr))
		goto finish;
	
	status = cryptLogin(&user, namePtr, passwordPtr);
	
	finish:
	releasePointerString(env, name, namePtr);
	releasePointerString(env, password, passwordPtr);
	processStatus(env, status);
	return(user);
}

/*
 * Class:     cryptlib_crypt
 * Method:    Logout
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_cryptlib_crypt_Logout
  (JNIEnv * env, jclass cryptClass, jint user)
{
	int status = 0;
	
	status = cryptLogout(user);
	
	processStatus(env, status);
}



#endif /* USE_JAVA */
