📄 enums.cs
字号:
//==========================================================================================
//
// OpenNETCF.Windows.Forms.Enums.cs
// Copyright (c) 2003, OpenNETCF.org
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the OpenNETCF.org Shared Source License.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the OpenNETCF.org Shared Source License
// for more details.
//
// You should have received a copy of the OpenNETCF.org Shared Source License
// along with this library; if not, email licensing@opennetcf.org to request a copy.
//
// If you wish to contact the OpenNETCF Advisory Board to discuss licensing, please
// email licensing@opennetcf.org.
//
// For general enquiries, email enquiries@opennetcf.org or visit our website at:
// http://www.opennetcf.org
//
// !!! A HUGE thank-you goes out to Casey Chesnut for supplying this class library !!!
// !!! You can contact Casey at http://www.brains-n-brawn.com !!!
//
//==========================================================================================
using System;
namespace OpenNETCF.Security.Cryptography.NativeMethods
{
[CLSCompliant(false)]
public enum PaddingMode : uint
{
PKCS5 = 1, // PKCS 5 (sec 6.2) padding method
RANDOM = 2,
ZERO = 3,
}
[CLSCompliant(false)]
public enum KeyBlob : uint
{
// exported key blob definitions
SIMPLEBLOB = 0x1,
PUBLICKEYBLOB = 0x6,
PRIVATEKEYBLOB = 0x7,
PLAINTEXTKEYBLOB = 0x8,
OPAQUEKEYBLOB = 0x9,
PUBLICKEYBLOBEX = 0xA,
SYMMETRICWRAPKEYBLOB = 0xB,
}
[Flags, CLSCompliant(false)]
public enum ExportKeyParam : uint
{
// dwFlag definitions for CryptExportKey
Y_ONLY = 0x00000001,
SSL2_FALLBACK = 0x00000002,
DESTROYKEY = 0x00000004,
OAEP = 0x00000040, // used with RSA encryptions/decryptions
}
[CLSCompliant(false)]
public enum KeyParam : uint
{
IV = 1, // Initialization vector
SALT = 2, // Salt value
PADDING = 3, // Padding values
MODE = 4, // Mode of the cipher
MODE_BITS = 5, // Number of bits to feedback
PERMISSIONS = 6, // Key permissions DWORD
ALGID = 7, // Key algorithm
BLOCKLEN = 8, // Block size of the cipher
KEYLEN = 9, // Length of key in bits
SALT_EX = 10, // Length of salt in bytes
P = 11, // DSS/Diffie-Hellman P value
G = 12, // DSS/Diffie-Hellman G value
Q = 13, // DSS Q value
X = 14, // Diffie-Hellman X value
Y = 15, // Y value
RA = 16, // Fortezza RA value
RB = 17, // Fortezza RB value
INFO = 18, // for putting information into an RSA envelope
EFFECTIVE_KEYLEN = 19, // setting and getting RC2 effective key length
SCHANNEL_ALG = 20, // for setting the Secure Channel algorithms
CLIENT_RANDOM = 21, // for setting the Secure Channel client random data
SERVER_RANDOM = 22, // for setting the Secure Channel server random data
RP = 23,
PRECOMP_MD5 = 24,
PRECOMP_SHA = 25,
CERTIFICATE = 26, // for setting Secure Channel certificate data (PCT1)
CLEAR_KEY = 27, // for setting Secure Channel clear key data (PCT1)
PUB_EX_LEN = 28,
PUB_EX_VAL = 29,
KEYVAL = 30,
ADMIN_PIN = 31,
KEYEXCHANGE_PIN = 32,
SIGNATURE_PIN = 33,
PREHASH = 34,
ROUNDS = 35,
OAEP_PARAMS = 36, // for setting OAEP params on RSA keys
CMS_KEY_INFO = 37,
CMS_DH_KEY_INFO = 38,
PUB_PARAMS = 39, // for setting public parameters
VERIFY_PARAMS = 40, // for verifying DSA and DH parameters
HIGHEST_VERSION = 41, // for TLS protocol version setting
GET_USE_COUNT = 42, // for use with PP_CRYPT_COUNT_KEY_USE contexts
}
[Flags, CLSCompliant(false)]
public enum GenKeyParam : uint
{
NONE = 0,
EXPORTABLE = 0x00000001,
USER_PROTECTED = 0x00000002,
CREATE_SALT = 0x00000004,
UPDATE_KEY = 0x00000008,
NO_SALT = 0x00000010,
PREGEN = 0x00000040,
RECIPIENT = 0x00000010,
INITIATOR = 0x00000040,
ONLINE = 0x00000080,
CRYPT_SF = 0x00000100,
CREATE_IV = 0x00000200,
KEK = 0x00000400,
DATA_KEY = 0x00000800,
VOLATILE = 0x00001000,
SGCKEY = 0x00002000,
ARCHIVABLE = 0x00004000,
}
[Flags, CLSCompliant(false)]
public enum ProtectPromptStruct : uint
{
// CryptProtect PromptStruct dwPromtFlags
// prompt on unprotect
ON_UNPROTECT = 0x1, // 1<<0
// prompt on protect
ON_PROTECT = 0x2, // 1<<1
RESERVED = 0x04, // reserved, do not use.
// default to strong variant UI protection (user supplied password currently).
STRONG = 0x08, // 1<<3
// require strong variant UI protection (user supplied password currently).
REQUIRE_STRONG = 0x10, // 1<<4
}
[Flags, CLSCompliant(false)]
public enum ProtectParam : uint
{
// CryptProtectData and CryptUnprotectData dwFlags
UI_FORBIDDEN = 0x1, // for remote-access situations where ui is not an option
// if UI was specified on protect or unprotect operation, the call
// will fail and GetLastError() will indicate ERROR_PASSWORD_RESTRICTION
LOCAL_MACHINE = 0x4, // per machine protected data -- any user on machine where CryptProtectData
// took place may CryptUnprotectData
CRED_SYNC = 0x8,// force credential synchronize during CryptProtectData()
// Synchronize is only operation that occurs during this operation
AUDIT = 0x10, // Generate an Audit on protect and unprotect operations
NO_RECOVERY = 0x20, // Protect data with a non-recoverable key
VERIFY_PROTECTION = 0x40, // Verify the protection of a protected blob
CRED_REGENERATE = 0x80, // Regenerate the local machine protection
SYSTEM = 0x20000000, // Only allow decryption from system (trusted) processes (Windows CE)
FIRST_RESERVED_FLAGVAL = 0x0FFFFFFF, // flags reserved for system use
LAST_RESERVED_FLAGVAL = 0xFFFFFFFF,
}
//[CLSCompliant(false)]
public enum KeySpec : int //mod from uint to make RSACryptoServiceProvider compliant
{
KEYEXCHANGE = 1,
SIGNATURE = 2,
}
[CLSCompliant(false)]
public enum HashParam : uint
{
ALGID = 0x0001, // Hash algorithm
HASHVAL = 0x0002, // Hash value
HASHSIZE = 0x0004, // Hash value size
HMAC_INFO = 0x0005, // information for creating an HMAC
TLS1PRF_LABEL = 0x0006, // label for TLS1 PRF
TLS1PRF_SEED = 0x0007, // seed for TLS1 PRF
}
[CLSCompliant(false)]
public enum CalgHash : uint
{
MD2 = (AlgClass.HASH | AlgType.ANY | AlgSid.MD2),
MD4 = (AlgClass.HASH | AlgType.ANY | AlgSid.MD4),
MD5 = (AlgClass.HASH | AlgType.ANY | AlgSid.MD5), //32771
SHA = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA),
SHA1 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA1),
MAC = (AlgClass.HASH | AlgType.ANY | AlgSid.MAC),
SSL3_SHAMD5 = (AlgClass.HASH | AlgType.ANY | AlgSid.SSL3SHAMD5),
HMAC = (AlgClass.HASH | AlgType.ANY | AlgSid.HMAC),
TLS1PRF = (AlgClass.HASH | AlgType.ANY | AlgSid.TLS1PRF),
HASH_REPLACE_OWF = (AlgClass.HASH | AlgType.ANY | AlgSid.HASH_REPLACE_OWF),
SHA_256 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA_256),
SHA_384 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA_384),
SHA_512 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA_512),
}
[CLSCompliant(false)]
public enum CalgEncrypt : uint
{
DES = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.DES), //26113
TRIP_DES_112 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.TRIP_DES_112),
TRIP_DES = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.TRIP_DES),
DESX = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.DESX),
RC2 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.RC2),
RC4 = (AlgClass.DATA_ENCRYPT | AlgType.STREAM | AlgSid.RC4), //26625
SEAL = (AlgClass.DATA_ENCRYPT | AlgType.STREAM | AlgSid.SEAL),
SKIPJACK = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.SKIPJACK),
TEK = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.TEK),
CYLINK_MEK = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.CYLINK_MEK),
SSL3_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SSL3_MASTER),
SCHANNEL_MASTER_HASH = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SCHANNEL_MASTER_HASH),
SCHANNEL_MAC_KEY = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SCHANNEL_MAC_KEY),
SCHANNEL_ENC_KEY = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SCHANNEL_ENC_KEY),
PCT1_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.PCT1_MASTER),
SSL2_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SSL2_MASTER),
TLS1_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.TLS1_MASTER),
RC5 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK|AlgSid.RC5),
AES_128 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES_128),
AES_192 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES_192),
AES_256 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES_256),
AES = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES),
}
[CLSCompliant(false)]
public enum CalgSign : uint
{
RSA_SIGN = (AlgClass.SIGNATURE | AlgType.RSA | AlgSid.RSA_ANY),
DSS_SIGN = (AlgClass.SIGNATURE | AlgType.DSS | AlgSid.DSS_ANY),
NO_SIGN = (AlgClass.SIGNATURE | AlgType.ANY | AlgSid.ANY),
}
[CLSCompliant(false)]
public enum CalgKeyEx : uint
{
RSA_KEYX = (AlgClass.KEY_EXCHANGE | AlgType.RSA | AlgSid.RSA_ANY),
DH_SF = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.DH_SANDF),
DH_EPHEM = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.DH_EPHEM),
AGREEDKEY_ANY = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.AGREED_KEY_ANY),
KEA_KEYX = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.KEA),
HUGHES_MD5 = (AlgClass.KEY_EXCHANGE | AlgType.ANY | AlgSid.MD5),
}
[CLSCompliant(false)]
public enum Calg : uint
{
//key spec - for GenKey
AT_KEYEXCHANGE = 1,
AT_SIGNATURE = 2,
// algorithm identifier definitions
MD2 = (AlgClass.HASH | AlgType.ANY | AlgSid.MD2),
MD4 = (AlgClass.HASH | AlgType.ANY | AlgSid.MD4),
MD5 = (AlgClass.HASH | AlgType.ANY | AlgSid.MD5), //32771
SHA = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA),
SHA1 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA1),
MAC = (AlgClass.HASH | AlgType.ANY | AlgSid.MAC),
RSA_SIGN = (AlgClass.SIGNATURE | AlgType.RSA | AlgSid.RSA_ANY),
DSS_SIGN = (AlgClass.SIGNATURE | AlgType.DSS | AlgSid.DSS_ANY),
NO_SIGN = (AlgClass.SIGNATURE | AlgType.ANY | AlgSid.ANY),
RSA_KEYX = (AlgClass.KEY_EXCHANGE | AlgType.RSA | AlgSid.RSA_ANY),
DES = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.DES), //26113
TRIP_DES_112 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.TRIP_DES_112),
TRIP_DES = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.TRIP_DES),
DESX = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.DESX),
RC2 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.RC2),
RC4 = (AlgClass.DATA_ENCRYPT | AlgType.STREAM | AlgSid.RC4), //26625
SEAL = (AlgClass.DATA_ENCRYPT | AlgType.STREAM | AlgSid.SEAL),
DH_SF = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.DH_SANDF),
DH_EPHEM = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.DH_EPHEM),
AGREEDKEY_ANY = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.AGREED_KEY_ANY),
KEA_KEYX = (AlgClass.KEY_EXCHANGE | AlgType.DH | AlgSid.KEA),
HUGHES_MD5 = (AlgClass.KEY_EXCHANGE | AlgType.ANY | AlgSid.MD5),
SKIPJACK = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.SKIPJACK),
TEK = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.TEK),
CYLINK_MEK = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.CYLINK_MEK),
SSL3_SHAMD5 = (AlgClass.HASH | AlgType.ANY | AlgSid.SSL3SHAMD5),
SSL3_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SSL3_MASTER),
SCHANNEL_MASTER_HASH = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SCHANNEL_MASTER_HASH),
SCHANNEL_MAC_KEY = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SCHANNEL_MAC_KEY),
SCHANNEL_ENC_KEY = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SCHANNEL_ENC_KEY),
PCT1_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.PCT1_MASTER),
SSL2_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.SSL2_MASTER),
TLS1_MASTER = (AlgClass.MSG_ENCRYPT | AlgType.SECURECHANNEL | AlgSid.TLS1_MASTER),
RC5 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK|AlgSid.RC5),
HMAC = (AlgClass.HASH | AlgType.ANY | AlgSid.HMAC),
TLS1PRF = (AlgClass.HASH | AlgType.ANY | AlgSid.TLS1PRF),
HASH_REPLACE_OWF = (AlgClass.HASH | AlgType.ANY | AlgSid.HASH_REPLACE_OWF),
AES_128 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES_128),
AES_192 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES_192),
AES_256 = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES_256),
AES = (AlgClass.DATA_ENCRYPT | AlgType.BLOCK | AlgSid.AES),
SHA_256 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA_256),
SHA_384 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA_384),
SHA_512 = (AlgClass.HASH | AlgType.ANY | AlgSid.SHA_512),
}
[CLSCompliant(false)]
public class AlgSid
{
// Generic sub-ids
public const uint ANY = (0);
// Some RSA sub-ids
public const uint RSA_ANY = 0;
public const uint RSA_PKCS = 1;
public const uint RSA_MSATWORK = 2;
public const uint RSA_ENTRUST = 3;
public const uint RSA_PGP = 4;
// Some DSS sub-ids
public const uint DSS_ANY = 0;
public const uint DSS_PKCS = 1;
public const uint DSS_DMS = 2;
// Block cipher sub ids
// DES sub_ids
public const uint DES = 1;
public const uint TRIP_DES = 3;
public const uint DESX = 4;
public const uint IDEA = 5;
public const uint CAST = 6;
public const uint SAFERSK64 = 7;
public const uint SAFERSK128 = 8;
public const uint TRIP_DES_112 = 9;
public const uint CYLINK_MEK = 12;
public const uint RC5 = 13;
public const uint AES_128 = 14;
public const uint AES_192 = 15;
public const uint AES_256 = 16;
public const uint AES = 17;
// Fortezza sub-ids
public const uint SKIPJACK = 10;
public const uint TEK = 11;
// RC2 sub-ids
public const uint RC2 = 2;
// Stream cipher sub-ids
public const uint RC4 = 1;
public const uint SEAL = 2;
// Diffie-Hellman sub-ids
public const uint DH_SANDF = 1;
public const uint DH_EPHEM = 2;
public const uint AGREED_KEY_ANY = 3;
public const uint KEA = 4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -