📄 cryptlib.pas
字号:
unit cryptlib;interface{***************************************************************************** ** Cryptlib external API interface ** Copyright Peter Gutmann 1997-2005 ** ** adapted for Delphi Version 5 (32 bit) and Kylix Version 3 ** by W. Gothier *****************************************************************************}{------------------------------------------------------------------------------ This file has been created automatically by a perl script from the file: "cryptlib.h" dated Mon Jul 18 02:47:56 2005, filesize = 82445. Please check twice that the file matches the version of cryptlib.h in your cryptlib source! If this is not the right version, try to download an update from "http://www.sogot.de/cryptlib/". If the filesize or file creation date do not match, then please do not complain about problems. Published by W. Gothier, mailto: cryptlib@gothier.net if you find errors in this file.-------------------------------------------------------------------------------}{$A+} {Set Alignment on}{$F+} {Force function calls to FAR}{$Z+} {Force all enumeration values to Integer size}const {$IFDEF WIN32} cryptlibname = 'CL32.DLL'; { dynamic linkname for Windows (Delphi) } {$ELSE} cryptlibname = 'libcl.so'; { library name for Unix/Linux (Kylix) } { symbolic link should be used for libcl.so -> libcl.so.3.x.y } {$ENDIF}{***************************************************************************** ** Algorithm and Object Types ** *****************************************************************************}{ Algorithm and mode types }type CRYPT_ALGO_TYPE = Integer;const { Algorithms } { No encryption } CRYPT_ALGO_NONE = 0; { No encryption } { Conventional encryption } CRYPT_ALGO_DES = 1; { DES } CRYPT_ALGO_3DES = 2; { Triple DES } CRYPT_ALGO_IDEA = 3; { IDEA } CRYPT_ALGO_CAST = 4; { CAST-128 } CRYPT_ALGO_RC2 = 5; { RC2 } CRYPT_ALGO_RC4 = 6; { RC4 } CRYPT_ALGO_RC5 = 7; { RC5 } CRYPT_ALGO_AES = 8; { AES } CRYPT_ALGO_BLOWFISH = 9; { Blowfish } CRYPT_ALGO_SKIPJACK = 10; { Skipjack } { Public-key encryption } CRYPT_ALGO_DH = 100; { Diffie-Hellman } CRYPT_ALGO_RSA = 101; { RSA } CRYPT_ALGO_DSA = 102; { DSA } CRYPT_ALGO_ELGAMAL = 103; { ElGamal } CRYPT_ALGO_KEA = 104; { KEA } { Hash algorithms } CRYPT_ALGO_MD2 = 200; { MD2 } CRYPT_ALGO_MD4 = 201; { MD4 } CRYPT_ALGO_MD5 = 202; { MD5 } CRYPT_ALGO_SHA = 203; { SHA/SHA1 } CRYPT_ALGO_RIPEMD160 = 204; { RIPE-MD 160 } CRYPT_ALGO_SHA2 = 205; { SHA2 (SHA-256/384/512)} { MAC's } CRYPT_ALGO_HMAC_MD5 = 300; { HMAC-MD5 } CRYPT_ALGO_HMAC_SHA = 301; { HMAC-SHA } CRYPT_ALGO_HMAC_RIPEMD160 = 302; { HMAC-RIPEMD-160 } { Vendors may want to use their own algorithms that aren't part of the general cryptlib suite. The following values are for vendor-defined algorithms, and can be used just like the named algorithm types (it's up to the vendor to keep track of what _VENDOR1 actually corresponds to) } CRYPT_ALGO_LAST = 303; { Last possible crypt algo value } { In order that we can scan through a range of algorithms with cryptQueryCapability(), we define the following boundary points for each algorithm class } CRYPT_ALGO_FIRST_CONVENTIONAL = 1; { = CRYPT_ALGO_DES } CRYPT_ALGO_LAST_CONVENTIONAL = 99; CRYPT_ALGO_FIRST_PKC = 100; { = CRYPT_ALGO_DH } CRYPT_ALGO_LAST_PKC = 199; CRYPT_ALGO_FIRST_HASH = 200; { = CRYPT_ALGO_MD2 } CRYPT_ALGO_LAST_HASH = 299; CRYPT_ALGO_FIRST_MAC = 300; { = CRYPT_ALGO_HMAC_MD5 } CRYPT_ALGO_LAST_MAC = 399; { End of mac algo.range } type CRYPT_MODE_TYPE = ( { Block cipher modes } CRYPT_MODE_NONE, { No encryption mode } CRYPT_MODE_ECB, { ECB } CRYPT_MODE_CBC, { CBC } CRYPT_MODE_CFB, { CFB } CRYPT_MODE_OFB, { OFB } CRYPT_MODE_LAST { Last possible crypt mode value } );{ Keyset subtypes } CRYPT_KEYSET_TYPE = ( { Keyset types } CRYPT_KEYSET_NONE, { No keyset type } CRYPT_KEYSET_FILE, { Generic flat file keyset } CRYPT_KEYSET_HTTP, { Web page containing cert/CRL } CRYPT_KEYSET_LDAP, { LDAP directory service } CRYPT_KEYSET_ODBC, { Generic ODBC interface } CRYPT_KEYSET_DATABASE, { Generic RDBMS interface } CRYPT_KEYSET_PLUGIN, { Generic database plugin } CRYPT_KEYSET_ODBC_STORE, { ODBC certificate store } CRYPT_KEYSET_DATABASE_STORE, { Database certificate store } CRYPT_KEYSET_PLUGIN_STORE, { Database plugin certificate store } CRYPT_KEYSET_LAST { Last possible keyset type } );{ Device subtypes } CRYPT_DEVICE_TYPE = ( { Crypto device types } CRYPT_DEVICE_NONE, { No crypto device } CRYPT_DEVICE_FORTEZZA, { Fortezza card } CRYPT_DEVICE_PKCS11, { PKCS #11 crypto token } CRYPT_DEVICE_CRYPTOAPI, { Microsoft CryptoAPI } CRYPT_DEVICE_LAST { Last possible crypto device type } );{ Certificate subtypes } CRYPT_CERTTYPE_TYPE = ( { Certificate object types } CRYPT_CERTTYPE_NONE, { No certificate type } CRYPT_CERTTYPE_CERTIFICATE, { Certificate } CRYPT_CERTTYPE_ATTRIBUTE_CERT, { Attribute certificate } CRYPT_CERTTYPE_CERTCHAIN, { PKCS #7 certificate chain } CRYPT_CERTTYPE_CERTREQUEST, { PKCS #10 certification request } CRYPT_CERTTYPE_REQUEST_CERT, { CRMF certification request } CRYPT_CERTTYPE_REQUEST_REVOCATION, { CRMF revocation request } CRYPT_CERTTYPE_CRL, { CRL } CRYPT_CERTTYPE_CMS_ATTRIBUTES, { CMS attributes } CRYPT_CERTTYPE_RTCS_REQUEST, { RTCS request } CRYPT_CERTTYPE_RTCS_RESPONSE, { RTCS response } CRYPT_CERTTYPE_OCSP_REQUEST, { OCSP request } CRYPT_CERTTYPE_OCSP_RESPONSE, { OCSP response } CRYPT_CERTTYPE_PKIUSER, { PKI user information } CRYPT_CERTTYPE_LAST { Last possible cert.type } );{ Envelope/data format subtypes } CRYPT_FORMAT_TYPE = ( CRYPT_FORMAT_NONE, { No format type } CRYPT_FORMAT_AUTO, { Deenv, auto-determine type } CRYPT_FORMAT_CRYPTLIB, { cryptlib native format } CRYPT_FORMAT_CMS, { PKCS #7 / CMS / S/MIME fmt.} CRYPT_FORMAT_SMIME, { As CMS with MSG-style behaviour } CRYPT_FORMAT_PGP, { PGP format } CRYPT_FORMAT_LAST { Last possible format type } );const CRYPT_FORMAT_PKCS7: CRYPT_FORMAT_TYPE = CRYPT_FORMAT_CMS;{ Session subtypes }type CRYPT_SESSION_TYPE = ( CRYPT_SESSION_NONE, { No session type } CRYPT_SESSION_SSH, { SSH } CRYPT_SESSION_SSH_SERVER, { SSH server } CRYPT_SESSION_SSL, { SSL/TLS } CRYPT_SESSION_SSL_SERVER, { SSL/TLS server } CRYPT_SESSION_RTCS, { RTCS } CRYPT_SESSION_RTCS_SERVER, { RTCS server } CRYPT_SESSION_OCSP, { OCSP } CRYPT_SESSION_OCSP_SERVER, { OCSP server } CRYPT_SESSION_TSP, { TSP } CRYPT_SESSION_TSP_SERVER, { TSP server } CRYPT_SESSION_CMP, { CMP } CRYPT_SESSION_CMP_SERVER, { CMP server } CRYPT_SESSION_SCEP, { SCEP } CRYPT_SESSION_SCEP_SERVER, { SCEP server } CRYPT_SESSION_CERTSTORE_SERVER, { HTTP cert store interface } CRYPT_SESSION_LAST { Last possible session type } );{ User subtypes } CRYPT_USER_TYPE = ( CRYPT_USER_NONE, { No user type } CRYPT_USER_NORMAL, { Normal user } CRYPT_USER_SO, { Security officer } CRYPT_USER_CA, { CA user } CRYPT_USER_LAST { Last possible user type } );{***************************************************************************** ** Attribute Types ** *****************************************************************************}{ Attribute types. These are arranged in the following order: PROPERTY - Object property ATTRIBUTE - Generic attributes OPTION - Global or object-specific config.option CTXINFO - Context-specific attribute CERTINFO - Certificate-specific attribute KEYINFO - Keyset-specific attribute DEVINFO - Device-specific attribute ENVINFO - Envelope-specific attribute SESSINFO - Session-specific attribute USERINFO - User-specific attribute } CRYPT_ATTRIBUTE_TYPE = Integer;const CRYPT_ATTRIBUTE_NONE = 0; { Non-value } { Used internally } CRYPT_PROPERTY_FIRST = 1; {*******************} { Object attributes } {*******************} { Object properties } CRYPT_PROPERTY_HIGHSECURITY = 2; { Owned+non-forwardcount+locked } CRYPT_PROPERTY_OWNER = 3; { Object owner } CRYPT_PROPERTY_FORWARDCOUNT = 4; { No.of times object can be forwarded } CRYPT_PROPERTY_LOCKED = 5; { Whether properties can be chged/read } CRYPT_PROPERTY_USAGECOUNT = 6; { Usage count before object expires } CRYPT_PROPERTY_NONEXPORTABLE = 7; { Whether key is nonexp.from context } { Used internally } CRYPT_PROPERTY_LAST = 8; CRYPT_GENERIC_FIRST = 9; { Extended error information } CRYPT_ATTRIBUTE_ERRORTYPE = 10; { Type of last error } CRYPT_ATTRIBUTE_ERRORLOCUS = 11; { Locus of last error } CRYPT_ATTRIBUTE_INT_ERRORCODE = 12; { Low-level software-specific } CRYPT_ATTRIBUTE_INT_ERRORMESSAGE = 13; { error code and message } { Generic information } CRYPT_ATTRIBUTE_CURRENT_GROUP = 14; { Cursor mgt: Group in attribute list } CRYPT_ATTRIBUTE_CURRENT = 15; { Cursor mgt: Entry in attribute list } CRYPT_ATTRIBUTE_CURRENT_INSTANCE = 16; { Cursor mgt: Instance in attribute list } CRYPT_ATTRIBUTE_BUFFERSIZE = 17; { Internal data buffer size } { User internally } CRYPT_GENERIC_LAST = 18; CRYPT_OPTION_FIRST = 100; {**************************} { Configuration attributes } {**************************} { cryptlib information (read-only) } CRYPT_OPTION_INFO_DESCRIPTION = 101; { Text description } CRYPT_OPTION_INFO_COPYRIGHT = 102; { Copyright notice } CRYPT_OPTION_INFO_MAJORVERSION = 103; { Major release version } CRYPT_OPTION_INFO_MINORVERSION = 104; { Minor release version } CRYPT_OPTION_INFO_STEPPING = 105; { Release stepping } { Encryption options } CRYPT_OPTION_ENCR_ALGO = 106; { Encryption algorithm } CRYPT_OPTION_ENCR_HASH = 107; { Hash algorithm } CRYPT_OPTION_ENCR_MAC = 108; { MAC algorithm } { PKC options } CRYPT_OPTION_PKC_ALGO = 109; { Public-key encryption algorithm } CRYPT_OPTION_PKC_KEYSIZE = 110; { Public-key encryption key size } { Signature options } CRYPT_OPTION_SIG_ALGO = 111; { Signature algorithm } CRYPT_OPTION_SIG_KEYSIZE = 112; { Signature keysize } { Keying options } CRYPT_OPTION_KEYING_ALGO = 113; { Key processing algorithm } CRYPT_OPTION_KEYING_ITERATIONS = 114; { Key processing iterations }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -