📄 cryptlib.cs
字号:
public const int KEYID_EMAIL = 2; // Synonym: owner email addr. public const int KEYID_LAST = 3; // Last possible key ID type /* The encryption object types */ // CRYPT_OBJECT_TYPE public const int OBJECT_NONE = 0; // No object type public const int OBJECT_ENCRYPTED_KEY = 1; // Conventionally encrypted key public const int OBJECT_PKCENCRYPTED_KEY = 2; // PKC-encrypted key public const int OBJECT_KEYAGREEMENT = 3; // Key agreement information public const int OBJECT_SIGNATURE = 4; // Signature public const int OBJECT_LAST = 5; // Last possible object type /* Object/attribute error type information */ // CRYPT_ERRTYPE_TYPE public const int ERRTYPE_NONE = 0; // No error information public const int ERRTYPE_ATTR_SIZE = 1; // Attribute data too small or large public const int ERRTYPE_ATTR_VALUE = 2; // Attribute value is invalid public const int ERRTYPE_ATTR_ABSENT = 3; // Required attribute missing public const int ERRTYPE_ATTR_PRESENT = 4; // Non-allowed attribute present public const int ERRTYPE_CONSTRAINT = 5; // Cert: Constraint violation in object public const int ERRTYPE_ISSUERCONSTRAINT = 6; // Cert: Constraint viol.in issuing cert public const int ERRTYPE_LAST = 7; // Last possible error info type /* Cert store management action type */ // CRYPT_CERTACTION_TYPE public const int CERTACTION_NONE = 0 ; // No cert management action public const int CERTACTION_CREATE = 1 ; // Create cert store public const int CERTACTION_CONNECT = 2 ; // Connect to cert store public const int CERTACTION_DISCONNECT = 3 ; // Disconnect from cert store public const int CERTACTION_ERROR = 4 ; // Error information public const int CERTACTION_ADDUSER = 5 ; // Add PKI user public const int CERTACTION_DELETEUSER = 6 ; // Delete PKI user public const int CERTACTION_REQUEST_CERT = 7 ; // Cert request public const int CERTACTION_REQUEST_RENEWAL = 8 ; // Cert renewal request public const int CERTACTION_REQUEST_REVOCATION = 9 ; // Cert revocation request public const int CERTACTION_CERT_CREATION = 10; // Cert creation public const int CERTACTION_CERT_CREATION_COMPLETE = 11; // Confirmation of cert creation public const int CERTACTION_CERT_CREATION_DROP = 12; // Cancellation of cert creation public const int CERTACTION_CERT_CREATION_REVERSE = 13; // Cancel of creation w.revocation public const int CERTACTION_RESTART_CLEANUP = 14; // Delete reqs after restart public const int CERTACTION_RESTART_REVOKE_CERT = 15; // Complete revocation after restart public const int CERTACTION_ISSUE_CERT = 16; // Cert issue public const int CERTACTION_ISSUE_CRL = 17; // CRL issue public const int CERTACTION_REVOKE_CERT = 18; // Cert revocation public const int CERTACTION_EXPIRE_CERT = 19; // Cert expiry public const int CERTACTION_CLEANUP = 20; // Clean up on restart public const int CERTACTION_LAST = 21; // Last possible cert store log action /**************************************************************************** * * * General Constants * * * ****************************************************************************/ /* The maximum user key size - 2048 bits */ public const int MAX_KEYSIZE = 256 ; /* The maximum IV size - 256 bits */ public const int MAX_IVSIZE = 32 ; /* The maximum public-key component size - 4096 bits, and maximum component size for ECCs - 256 bits */ public const int MAX_PKCSIZE = 512 ; public const int MAX_PKCSIZE_ECC = 32 ; /* The maximum hash size - 256 bits */ public const int MAX_HASHSIZE = 32 ; /* The maximum size of a text string (e.g.key owner name) */ public const int MAX_TEXTSIZE = 64 ; /* A magic value indicating that the default setting for this parameter should be used */ public const int USE_DEFAULT = -100; /* A magic value for unused parameters */ public const int UNUSED = -101; /* Cursor positioning codes for certificate/CRL extensions */ public const int CURSOR_FIRST = -200; public const int CURSOR_PREVIOUS = -201; public const int CURSOR_NEXT = -202; public const int CURSOR_LAST = -203; /* The type of information polling to perform to get random seed information. These values have to be negative because they're used as magic length values for cryptAddRandom() */ public const int RANDOM_FASTPOLL = -300; public const int RANDOM_SLOWPOLL = -301; /* Whether the PKC key is a public or private key */ public const int KEYTYPE_PRIVATE = 0 ; public const int KEYTYPE_PUBLIC = 1 ; /* Keyset open options */ // CRYPT_KEYOPT_TYPE public const int KEYOPT_NONE = 0; // No options public const int KEYOPT_READONLY = 1; // Open keyset in read-only mode public const int KEYOPT_CREATE = 2; // Create a new keyset public const int KEYOPT_LAST = 3; // Last possible key option type /* The various cryptlib objects - these are just integer handles */ //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_CERTIFICATE; //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_CONTEXT; //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_DEVICE; //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_ENVELOPE; //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_KEYSET; //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_SESSION; //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_USER; /* Sometimes we don't know the exact type of a cryptlib object, so we use a generic handle type to identify it */ //CRYPTLIBCONVERTER - NOT NEEDED: typedef int CRYPT_HANDLE; /**************************************************************************** * * * Encryption Data Structures * * * ****************************************************************************/ /* Results returned from the capability query */ //CRYPTLIBCONVERTER - NOT SUPPORTED: //typedef struct { // /* Algorithm information */ // C_CHR algoName[ CRYPT_MAX_TEXTSIZE ];/* Algorithm name */ // int blockSize; /* Block size of the algorithm */ // int minKeySize; /* Minimum key size in bytes */ // int keySize; /* Recommended key size in bytes */ // int maxKeySize; /* Maximum key size in bytes */ // } CRYPT_QUERY_INFO; /* Results returned from the encoded object query. These provide information on the objects created by cryptExportKey()/ cryptCreateSignature() */ //CRYPTLIBCONVERTER - NOT SUPPORTED: //typedef struct { // /* The object type */ // CRYPT_OBJECT_TYPE objectType; // // /* The encryption algorithm and mode */ // CRYPT_ALGO_TYPE cryptAlgo; // CRYPT_MODE_TYPE cryptMode; // // /* The hash algorithm for Signature objects */ // CRYPT_ALGO_TYPE hashAlgo; // // /* The salt for derived keys */ // unsigned char salt[ CRYPT_MAX_HASHSIZE ]; // int saltSize; // } CRYPT_OBJECT_INFO; /* Key information for the public-key encryption algorithms. These fields are not accessed directly, but can be manipulated with the init/set/ destroyComponents() macros */ //CRYPTLIBCONVERTER - NOT SUPPORTED: //typedef struct { // /* Status information */ // int isPublicKey; /* Whether this is a public or private key */ // // /* Public components */ // unsigned char n[ CRYPT_MAX_PKCSIZE ]; /* Modulus */ // int nLen; /* Length of modulus in bits */ // unsigned char e[ CRYPT_MAX_PKCSIZE ]; /* Public exponent */ // int eLen; /* Length of public exponent in bits */ // // /* Private components */ // unsigned char d[ CRYPT_MAX_PKCSIZE ]; /* Private exponent */ // int dLen; /* Length of private exponent in bits */ // unsigned char p[ CRYPT_MAX_PKCSIZE ]; /* Prime factor 1 */ // int pLen; /* Length of prime factor 1 in bits */ // unsigned char q[ CRYPT_MAX_PKCSIZE ]; /* Prime factor 2 */ // int qLen; /* Length of prime factor 2 in bits */ // unsigned char u[ CRYPT_MAX_PKCSIZE ]; /* Mult.inverse of q, mod p */ // int uLen; /* Length of private exponent in bits */ // unsigned char e1[ CRYPT_MAX_PKCSIZE ]; /* Private exponent 1 (PKCS) */ // int e1Len; /
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -