📄 cryptlib.cs
字号:
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 */ public const int MAX_PKCSIZE = 512 ; /* 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 = -10 ; /* A magic value for unused parameters */ public const int UNUSED = -11 ; /* Whether the PKC key is a public or private key */ public const int KEYTYPE_PRIVATE = 0 ; public const int KEYTYPE_PUBLIC = 1 ; /* The type of information polling to perform to get random seed information */ public const int RANDOM_FASTPOLL = -10 ; public const int RANDOM_SLOWPOLL = -11 ; /* Cursor positioning codes for certificate/CRL extensions */ public const int CURSOR_FIRST = -20 ; public const int CURSOR_PREVIOUS = -21 ; public const int CURSOR_NEXT = -22 ; public const int CURSOR_LAST = -23 ; /* 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; /* Length of private exponent in bits */ // unsigned char e2[ CRYPT_MAX_PKCSIZE ]; /* Private exponent 2 (PKCS) */ // int e2Len; /* Length of private exponent in bits */ // } CRYPT_PKCINFO_RSA; //CRYPTLIBCONVERTER - NOT SUPPORTED: //typedef struct { // /* Status information */ // int isPublicKey; /* Whether this is a public or private key */ // // /* Public components */ // unsigned char p[ CRYPT_MAX_PKCSIZE ]; /* Prime modulus */ // int pLen; /* Length of prime modulus in bits */ // unsigned char q[ CRYPT_MAX_PKCSIZE ]; /* Prime divisor */ // int qLen; /* Length of prime divisor in bits */ // unsigned char g[ CRYPT_MAX_PKCSIZE ]; /* h^( ( p - 1 ) / q ) mod p */ // int gLen; /* Length of g in bits */ // unsigned char y[ CRYPT_MAX_PKCSIZE ]; /* Public random integer */ // int yLen; /* Length of public integer in bits */ // // /* Private components */ // unsigned char x[ CRYPT_MAX_PKCSIZE ]; /* Private random integer */ // int xLen; /* Length of private integer in bits */ // } CRYPT_PKCINFO_DLP; /* Macros to init
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -