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

📄 cryptlib.cs

📁 老外写的加密库cryptlib(版本3.1)
💻 CS
📖 第 1 页 / 共 5 页
字号:
using System;using System.Runtime.InteropServices;using System.Text;namespace cryptlib{    public class crypt{    		/****************************************************************************	*																			*	*							Algorithm and Object Types						*	*																			*	****************************************************************************/		/* Algorithm and mode types */		// CRYPT_ALGO_TYPE	public const int ALGO_NONE               = 0  ; // No encryption	public const int ALGO_DES                = 1  ; // DES	public const int ALGO_3DES               = 2  ; // Triple DES	public const int ALGO_IDEA               = 3  ; // IDEA	public const int ALGO_CAST               = 4  ; // CAST-128	public const int ALGO_RC2                = 5  ; // RC2	public const int ALGO_RC4                = 6  ; // RC4	public const int ALGO_RC5                = 7  ; // RC5	public const int ALGO_AES                = 8  ; // AES	public const int ALGO_BLOWFISH           = 9  ; // Blowfish	public const int ALGO_SKIPJACK           = 10 ; // Skipjack	public const int ALGO_DH                 = 100; // Diffie-Hellman	public const int ALGO_RSA                = 101; // RSA	public const int ALGO_DSA                = 102; // DSA	public const int ALGO_ELGAMAL            = 103; // ElGamal	public const int ALGO_KEA                = 104; // KEA	public const int ALGO_MD2                = 200; // MD2	public const int ALGO_MD4                = 201; // MD4	public const int ALGO_MD5                = 202; // MD5	public const int ALGO_SHA                = 203; // SHA/SHA1	public const int ALGO_RIPEMD160          = 204; // RIPE-MD 160	public const int ALGO_HMAC_MD5           = 300; // HMAC-MD5	public const int ALGO_HMAC_SHA           = 301; // HMAC-SHA	public const int ALGO_HMAC_RIPEMD160     = 302; // HMAC-RIPEMD-160	public const int ALGO_LAST               = 303; // Last possible crypt algo value	public const int ALGO_FIRST_CONVENTIONAL = 1  ;	public const int ALGO_LAST_CONVENTIONAL  = 99 ;	public const int ALGO_FIRST_PKC          = 100;	public const int ALGO_LAST_PKC           = 199;	public const int ALGO_FIRST_HASH         = 200;	public const int ALGO_LAST_HASH          = 299;	public const int ALGO_FIRST_MAC          = 300;	public const int ALGO_LAST_MAC           = 399; // End of mac algo.range		// CRYPT_MODE_TYPE	public const int MODE_NONE = 0; // No encryption mode	public const int MODE_ECB  = 1; // ECB	public const int MODE_CBC  = 2; // CBC	public const int MODE_CFB  = 3; // CFB	public const int MODE_OFB  = 4; // OFB	public const int MODE_LAST = 5; // Last possible crypt mode value			/* Keyset subtypes */		// CRYPT_KEYSET_TYPE	public const int KEYSET_NONE           = 0 ; // No keyset type	public const int KEYSET_FILE           = 1 ; // Generic flat file keyset	public const int KEYSET_HTTP           = 2 ; // Web page containing cert/CRL	public const int KEYSET_LDAP           = 3 ; // LDAP directory service	public const int KEYSET_ODBC           = 4 ; // Generic ODBC interface	public const int KEYSET_DATABASE       = 5 ; // Generic RDBMS interface	public const int KEYSET_PLUGIN         = 6 ; // Generic database plugin	public const int KEYSET_ODBC_STORE     = 7 ; // ODBC certificate store	public const int KEYSET_DATABASE_STORE = 8 ; // Database certificate store	public const int KEYSET_PLUGIN_STORE   = 9 ; // Database plugin certificate store	public const int KEYSET_LAST           = 10; // Last possible keyset type		/* Device subtypes */		// CRYPT_DEVICE_TYPE	public const int DEVICE_NONE      = 0; // No crypto device	public const int DEVICE_FORTEZZA  = 1; // Fortezza card	public const int DEVICE_PKCS11    = 2; // PKCS #11 crypto token	public const int DEVICE_CRYPTOAPI = 3; // Microsoft CryptoAPI	public const int DEVICE_LAST      = 4; // Last possible crypto device type		/* Certificate subtypes */		// CRYPT_CERTTYPE_TYPE	public const int CERTTYPE_NONE               = 0 ; // No certificate type	public const int CERTTYPE_CERTIFICATE        = 1 ; // Certificate	public const int CERTTYPE_ATTRIBUTE_CERT     = 2 ; // Attribute certificate	public const int CERTTYPE_CERTCHAIN          = 3 ; // PKCS #7 certificate chain	public const int CERTTYPE_CERTREQUEST        = 4 ; // PKCS #10 certification request	public const int CERTTYPE_REQUEST_CERT       = 5 ; // CRMF certification request	public const int CERTTYPE_REQUEST_REVOCATION = 6 ; // CRMF revocation request	public const int CERTTYPE_CRL                = 7 ; // CRL	public const int CERTTYPE_CMS_ATTRIBUTES     = 8 ; // CMS attributes	public const int CERTTYPE_RTCS_REQUEST       = 9 ; // RTCS request	public const int CERTTYPE_RTCS_RESPONSE      = 10; // RTCS response	public const int CERTTYPE_OCSP_REQUEST       = 11; // OCSP request	public const int CERTTYPE_OCSP_RESPONSE      = 12; // OCSP response	public const int CERTTYPE_PKIUSER            = 13; // PKI user information	public const int CERTTYPE_LAST               = 14; // Last possible cert.type		/* Envelope/data format subtypes */		// CRYPT_FORMAT_TYPE	public const int FORMAT_NONE     = 0; // No format type	public const int FORMAT_AUTO     = 1; // Deenv, auto-determine type	public const int FORMAT_CRYPTLIB = 2; // cryptlib native format	public const int FORMAT_CMS      = 3; // PKCS #7 / CMS / S/MIME fmt.	public const int FORMAT_PKCS7    = 3;	public const int FORMAT_SMIME    = 4; // As CMS with MSG-style behaviour	public const int FORMAT_PGP      = 5; // PGP format	public const int FORMAT_LAST     = 6; // Last possible format type		/* Session subtypes */		// CRYPT_SESSION_TYPE	public const int SESSION_NONE        = 0 ; // No session type	public const int SESSION_SSH         = 1 ; // SSH	public const int SESSION_SSH_SERVER  = 2 ; // SSH server	public const int SESSION_SSL         = 3 ; // SSL/TLS	public const int SESSION_SSL_SERVER  = 4 ; // SSL/TLS server	public const int SESSION_RTCS        = 5 ; // RTCS	public const int SESSION_RTCS_SERVER = 6 ; // RTCS server	public const int SESSION_OCSP        = 7 ; // OCSP	public const int SESSION_OCSP_SERVER = 8 ; // OCSP server	public const int SESSION_TSP         = 9 ; // TSP	public const int SESSION_TSP_SERVER  = 10; // TSP server	public const int SESSION_CMP         = 11; // CMP	public const int SESSION_CMP_SERVER  = 12; // CMP server	public const int SESSION_SCEP        = 13; // SCEP	public const int SESSION_SCEP_SERVER = 14; // SCEP server	public const int SESSION_LAST        = 15; // Last possible session type		/* User subtypes */		// CRYPT_USER_TYPE	public const int USER_NONE   = 0; // No user type	public const int USER_NORMAL = 1; // Normal user	public const int USER_SO     = 2; // Security officer	public const int USER_CA     = 3; // CA user	public const int USER_LAST   = 4; // 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	public const int ATTRIBUTE_NONE                              = 0   ; // Non-value	public const int PROPERTY_FIRST                              = 1   ; // *******************	public const int PROPERTY_HIGHSECURITY                       = 2   ; // Owned+non-forwardcount+locked	public const int PROPERTY_OWNER                              = 3   ; // Object owner	public const int PROPERTY_FORWARDCOUNT                       = 4   ; // No.of times object can be forwarded	public const int PROPERTY_LOCKED                             = 5   ; // Whether properties can be chged/read	public const int PROPERTY_USAGECOUNT                         = 6   ; // Usage count before object expires	public const int PROPERTY_NONEXPORTABLE                      = 7   ; // Whether key is nonexp.from context	public const int PROPERTY_LAST                               = 8   ;	public const int GENERIC_FIRST                               = 9   ; // Extended error information	public const int ATTRIBUTE_ERRORTYPE                         = 10  ; // Type of last error	public const int ATTRIBUTE_ERRORLOCUS                        = 11  ; // Locus of last error	public const int ATTRIBUTE_INT_ERRORCODE                     = 12  ; // Low-level software-specific	public const int ATTRIBUTE_INT_ERRORMESSAGE                  = 13  ; // error code and message	public const int ATTRIBUTE_BUFFERSIZE                        = 14  ; // Internal data buffer size	public const int GENERIC_LAST                                = 15  ;	public const int OPTION_FIRST                                = 100 ; // **************************	public const int OPTION_INFO_DESCRIPTION                     = 101 ; // Text description	public const int OPTION_INFO_COPYRIGHT                       = 102 ; // Copyright notice	public const int OPTION_INFO_MAJORVERSION                    = 103 ; // Major release version	public const int OPTION_INFO_MINORVERSION                    = 104 ; // Minor release version	public const int OPTION_INFO_STEPPING                        = 105 ; // Release stepping	public const int OPTION_ENCR_ALGO                            = 106 ; // Encryption algorithm	public const int OPTION_ENCR_HASH                            = 107 ; // Hash algorithm	public const int OPTION_ENCR_MAC                             = 108 ; // MAC algorithm	public const int OPTION_PKC_ALGO                             = 109 ; // Public-key encryption algorithm	public const int OPTION_PKC_KEYSIZE                          = 110 ; // Public-key encryption key size	public const int OPTION_SIG_ALGO                             = 111 ; // Signature algorithm	public const int OPTION_SIG_KEYSIZE                          = 112 ; // Signature keysize	public const int OPTION_KEYING_ALGO                          = 113 ; // Key processing algorithm	public const int OPTION_KEYING_ITERATIONS                    = 114 ; // Key processing iterations	public const int OPTION_CERT_SIGNUNRECOGNISEDATTRIBUTES      = 115 ; // Whether to sign unrecog.attrs	public const int OPTION_CERT_VALIDITY                        = 116 ; // Certificate validity period	public const int OPTION_CERT_UPDATEINTERVAL                  = 117 ; // CRL update interval	public const int OPTION_CERT_COMPLIANCELEVEL                 = 118 ; // PKIX compliance level for cert chks.

⌨️ 快捷键说明

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