⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cryptlib.bas

📁 老外写的加密库cryptlib(版本3.1)
💻 BAS
📖 第 1 页 / 共 5 页
字号:
Attribute VB_Name = "CRYPTLIB"

Option Explicit

'*****************************************************************************
'*                                                                           *
'*                        cryptlib External API Interface                    *
'*                       Copyright Peter Gutmann 1997-2003                   *
'*                                                                           *
'*                 adapted for Visual Basic Version 6  by W. Gothier         *
'*****************************************************************************


'-----------------------------------------------------------------------------

'This file has been created automatically by a perl script from the file:
'
'"cryptlib.h" dated Fri Dec 12 02:22:00 2003, filesize = 80561.
'
'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.
'
'Examples using Visual Basic are available on the same web address.
'
'Published by W. Gothier, 
'mailto: cryptlib@gothier.net if you find errors in this file.

'-----------------------------------------------------------------------------



'****************************************************************************
'*                                                                           *
'*                           Algorithm and Object Types                      *
'*                                                                           *
'****************************************************************************

' Algorithm and mode types 

Public Enum CRYPT_ALGO_TYPE
                      ' Algorithms 
    ' No encryption 
    CRYPT_ALGO_NONE                 ' No encryption 

    ' Conventional encryption 
    CRYPT_ALGO_DES                  ' DES 
    CRYPT_ALGO_3DES                 ' Triple DES 
    CRYPT_ALGO_IDEA                 ' IDEA 
    CRYPT_ALGO_CAST                 ' CAST-128 
    CRYPT_ALGO_RC2                  ' RC2 
    CRYPT_ALGO_RC4                  ' RC4 
    CRYPT_ALGO_RC5                  ' RC5 
    CRYPT_ALGO_AES                  ' AES 
    CRYPT_ALGO_BLOWFISH             ' Blowfish 
    CRYPT_ALGO_SKIPJACK             ' Skipjack 

    ' Public-key encryption 
    CRYPT_ALGO_DH = 100             ' Diffie-Hellman 
    CRYPT_ALGO_RSA                  ' RSA 
    CRYPT_ALGO_DSA                  ' DSA 
    CRYPT_ALGO_ELGAMAL              ' ElGamal 
    CRYPT_ALGO_KEA                  ' KEA 

    ' Hash algorithms 
    CRYPT_ALGO_MD2 = 200            ' MD2 
    CRYPT_ALGO_MD4                  ' MD4 
    CRYPT_ALGO_MD5                  ' MD5 
    CRYPT_ALGO_SHA                  ' SHA/SHA1 
    CRYPT_ALGO_RIPEMD160            ' RIPE-MD 160 

    ' MAC's 
    CRYPT_ALGO_HMAC_MD5 = 300       ' HMAC-MD5 
    CRYPT_ALGO_HMAC_SHA             ' HMAC-SHA 
    CRYPT_ALGO_HMAC_RIPEMD160       ' 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                 ' 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 = CRYPT_ALGO_DES
    CRYPT_ALGO_LAST_CONVENTIONAL = CRYPT_ALGO_DH - 1
    CRYPT_ALGO_FIRST_PKC = CRYPT_ALGO_DH
    CRYPT_ALGO_LAST_PKC = CRYPT_ALGO_MD2 - 1
    CRYPT_ALGO_FIRST_HASH = CRYPT_ALGO_MD2
    CRYPT_ALGO_LAST_HASH = CRYPT_ALGO_HMAC_MD5 - 1
    CRYPT_ALGO_FIRST_MAC = CRYPT_ALGO_HMAC_MD5
    CRYPT_ALGO_LAST_MAC = CRYPT_ALGO_HMAC_MD5 + 99  ' End of mac algo.range 
    

End Enum

Public Enum 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 
    

End Enum


' Keyset subtypes 

Public Enum 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 

    

End Enum

' Device subtypes 

Public Enum 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 
    

End Enum

' Certificate subtypes 

Public Enum 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 
    

End Enum

' Envelope/data format subtypes 

Public Enum 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_PKCS7 = CRYPT_FORMAT_CMS
    CRYPT_FORMAT_SMIME              ' As CMS with MSG-style behaviour 
    CRYPT_FORMAT_PGP                ' PGP format 
    CRYPT_FORMAT_LAST               ' Last possible format type 
    

End Enum

' Session subtypes 

Public Enum 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_LAST              ' Last possible session type 
    

End Enum

' User subtypes 

Public Enum 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 
    

End Enum

'****************************************************************************
'*                                                                           *
'*                               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 

Public Enum CRYPT_ATTRIBUTE_TYPE

    CRYPT_ATTRIBUTE_NONE            ' Non-value 

    ' Used internally 
    CRYPT_PROPERTY_FIRST

    '*******************
    ' Object attributes 
    '*******************

    ' Object properties 
    CRYPT_PROPERTY_HIGHSECURITY     ' Owned+non-forwardcount+locked 
    CRYPT_PROPERTY_OWNER            ' Object owner 
    CRYPT_PROPERTY_FORWARDCOUNT     ' No.of times object can be forwarded 
    CRYPT_PROPERTY_LOCKED           ' Whether properties can be chged/read 
    CRYPT_PROPERTY_USAGECOUNT       ' Usage count before object expires 
    CRYPT_PROPERTY_NONEXPORTABLE    ' Whether key is nonexp.from context 

    ' Used internally 
    CRYPT_PROPERTY_LAST
    CRYPT_GENERIC_FIRST

    ' Extended error information 
    CRYPT_ATTRIBUTE_ERRORTYPE       ' Type of last error 
    CRYPT_ATTRIBUTE_ERRORLOCUS      ' Locus of last error 
    CRYPT_ATTRIBUTE_INT_ERRORCODE   ' Low-level software-specific 
    CRYPT_ATTRIBUTE_INT_ERRORMESSAGE  '   error code and message 

    ' Generic information 
    CRYPT_ATTRIBUTE_BUFFERSIZE      ' Internal data buffer size 

    ' User internally 
    CRYPT_GENERIC_LAST
    CRYPT_OPTION_FIRST = 100

    '**************************
    ' Configuration attributes 
    '**************************

    ' cryptlib information (read-only) 
    CRYPT_OPTION_INFO_DESCRIPTION   ' Text description 
    CRYPT_OPTION_INFO_COPYRIGHT     ' Copyright notice 
    CRYPT_OPTION_INFO_MAJORVERSION  ' Major release version 
    CRYPT_OPTION_INFO_MINORVERSION  ' Minor release version 
    CRYPT_OPTION_INFO_STEPPING      ' Release stepping 

    ' Encryption options 
    CRYPT_OPTION_ENCR_ALGO          ' Encryption algorithm 
    CRYPT_OPTION_ENCR_HASH          ' Hash algorithm 
    CRYPT_OPTION_ENCR_MAC           ' MAC algorithm 

    ' PKC options 
    CRYPT_OPTION_PKC_ALGO           ' Public-key encryption algorithm 
    CRYPT_OPTION_PKC_KEYSIZE        ' Public-key encryption key size 

    ' Signature options 
    CRYPT_OPTION_SIG_ALGO           ' Signature algorithm 
    CRYPT_OPTION_SIG_KEYSIZE        ' Signature keysize 

    ' Keying options 
    CRYPT_OPTION_KEYING_ALGO        ' Key processing algorithm 
    CRYPT_OPTION_KEYING_ITERATIONS  ' Key processing iterations 

    ' Certificate options 
    CRYPT_OPTION_CERT_SIGNUNRECOGNISEDATTRIBUTES    ' Whether to sign unrecog.attrs 
    CRYPT_OPTION_CERT_VALIDITY      ' Certificate validity period 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -