function MSCO () {
        this.ForReading = 1;
        this.ForWriting = 2;
        this.ForAppending = 8;
        this.TristateUseDefault = -2;
        this.TristateTrue = -1;
        this.TristateFalse = 0;

        // special return value for GetTemplateList and UpdateCSPList
        this.ERROR_NOITEMS=-1;
        this.ERROR_NOMATCHEDCSP=-2;

        this.HKEY_CLASSES_ROOT =(0x80000000) ;
        this.HKEY_CURRENT_USER =(0x80000001) ;
        this.HKEY_LOCAL_MACHINE =(0x80000002) ;
        this.HKEY_USERS =(0x80000003) ;
        this.HKEY_CURRENT_CONFIG =(0x80000005) ;
        this.HKEY_DYN_DATA =(0x80000006) ;

        this.REG_SZ =(1) ;
        this.REG_EXPAND_SZ =(2) ;
        this.REG_BINARY =(3) ;
        this.REG_DWORD =(4) ;
        this.REG_MULTI_SZ =(7) ;

        // flags for getCertTemplateCount and enumCertTemplateName
        this.SCARD_ENROLL_ALL_CERT_TEMPLATE=0; //default
        this.SCARD_ENROLL_USER_CERT_TEMPLATE=1;
        this.SCARD_ENROLL_MACHINE_CERT_TEMPLATE=2;
        this.SCARD_ENROLL_ENTERPRISE_CERT_TEMPLATE=0x08;
        this.SCARD_ENROLL_CROSS_CERT_TEMPLATE=0x20;
        this.SCARD_ENROLL_OFFLINE_CERT_TEMPLATE=0x10;

        // flags for enumCertTemplateName, getCertTemplateName and setCertTemplateName
        this.SCARD_ENROLL_CERT_TEMPLATE_REAL_NAME=0; // default
        this.SCARD_ENROLL_CERT_TEMPLATE_DISPLAY_NAME=4;

        // flags for enumCAName, getCAName and setCAName
        this.SCARD_ENROLL_CA_REAL_NAME=0; //default
        this.SCARD_ENROLL_CA_MACHINE_NAME=1;
        this.SCARD_ENROLL_CA_DISPLAY_NAME=2;
        this.SCARD_ENROLL_CA_UNIQUE_NAME=3; //machineName\realName

        // flags for getSigningCertificateName, getEnrolledCertificateName
        this.SCARD_ENROLL_DISPLAY_CERT=0;
        this.SCARD_ENROLL_NO_DISPLAY_CERT=1;

        // flags for setUserName and getUserName
        this.SCARD_ENROLL_SAM_COMPATIBLE_NAME=0; // default
        this.SCARD_ENROLL_UPN_NAME=1;

        // flags for setSigningCertificate and selectSigningCertificate
        // this.SCARD_SELECT_TEMPLATENAME = 0;
        this.SCARD_SELECT_EKU = 1;

        this.FLAGS_NONE=0;

        // flags for getCertTemplateInfo
        this.SCARD_CTINFO_KEYSPEC=1;
        this.SCARD_CTINFO_KEYFLAGS=2;
        this.SCARD_CTINFO_EXT_OID=3;
        this.SCARD_CTINFO_EXT_MAJOR=4;
        this.SCARD_CTINFO_EXT_MINOR=5;
        this.SCARD_CTINFO_EXT_MINOR_FLAG=6;
        this.SCARD_CTINFO_SUBJECTFLAG=7;
        this.SCARD_CTINFO_CSPLIST_FIRST=8;
        this.SCARD_CTINFO_CSPLIST_NEXT=9;
        this.SCARD_CTINFO_GENERALFLAGS=10;
        this.SCARD_CTINFO_ENROLLMENTFLAGS=11;
        this.SCARD_CTINFO_PRIVATEKEYFLAGS=12;
        this.SCARD_CTINFO_RA_SIGNATURE=13;


        // SCARD_CTINFO_ENROLLMENTFLAGS
        this.CT_FLAG_INCLUDE_SYMMETRIC_ALGORITHMS=0x00000001;


        // CAPICOM_ENCODING_TYPE
        this.CAPICOM_ENCODE_BASE64 = 0;
        this.CAPICOM_ENCODE_BINARY = 1;
        this.CAPICOM_ENCODE_ANY = -1;

        // CAPICOM_EKU
        this.CAPICOM_EKU_OTHER = 0;
        this.CAPICOM_EKU_SERVER_AUTH = 1;
        this.CAPICOM_EKU_CLIENT_AUTH = 2;
        this.CAPICOM_EKU_CODE_SIGNING = 3;
        this.CAPICOM_EKU_EMAIL_PROTECTION = 4;
        this.CAPICOM_EKU_SMARTCARD_LOGON = 5;
        this.CAPICOM_EKU_ENCRYPTING_FILE_SYSTEM = 6;

        // CAPICOM_CHECK_FLAG
        this.CAPICOM_CHECK_NONE = 0;
        this.CAPICOM_CHECK_TRUSTED_ROOT = 1;
        this.CAPICOM_CHECK_TIME_VALIDITY = 2;
        this.CAPICOM_CHECK_SIGNATURE_VALIDITY = 4;
        this.CAPICOM_CHECK_ONLINE_REVOCATION_STATUS = 8;
        this.CAPICOM_CHECK_OFFLINE_REVOCATION_STATUS = 16;
        this.CAPICOM_CHECK_COMPLETE_CHAIN = 32;
        this.CAPICOM_CHECK_NAME_CONSTRAINTS = 64;
        this.CAPICOM_CHECK_BASIC_CONSTRAINTS = 128;
        this.CAPICOM_CHECK_NESTED_VALIDITY_PERIOD = 256;
        this.CAPICOM_CHECK_ONLINE_ALL = 495;
        this.CAPICOM_CHECK_OFFLINE_ALL = 503;

        // CAPICOM_CERT_INFO_TYPE
        this.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;
        this.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;
        this.CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME = 2;
        this.CAPICOM_CERT_INFO_ISSUER_EMAIL_NAME = 3;
        this.CAPICOM_CERT_INFO_SUBJECT_UPN = 4;
        this.CAPICOM_CERT_INFO_ISSUER_UPN = 5;
        this.CAPICOM_CERT_INFO_SUBJECT_DNS_NAME = 6;
        this.CAPICOM_CERT_INFO_ISSUER_DNS_NAME = 7;

        // CAPICOM_STORE_LOCATION
        this.CAPICOM_MEMORY_STORE = 0;
        this.CAPICOM_LOCAL_MACHINE_STORE = 1;
        this.CAPICOM_CURRENT_USER_STORE = 2;
        this.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;
        this.CAPICOM_SMART_CARD_USER_STORE = 4;

        // CAPICOM_STORE_OPEN_MODE
        this.CAPICOM_STORE_OPEN_READ_ONLY = 0;
        this.CAPICOM_STORE_OPEN_READ_WRITE = 1;
        this.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;
        this.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;
        this.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;

        // CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION
        this.CAPICOM_SEARCH_ANY = 0;
        this.CAPICOM_SEARCH_GLOBAL_CATALOG = 1;
        this.CAPICOM_SEARCH_DEFAULT_DOMAIN = 2;

        // CAPICOM_STORE_SAVE_AS_TYPE
        this.CAPICOM_STORE_SAVE_AS_SERIALIZED = 0;
        this.CAPICOM_STORE_SAVE_AS_PKCS7 = 1;

        // CAPICOM_ATTRIBUTE
        this.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
        this.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
        this.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;

        // CAPICOM_SIGNED_DATA_VERIFY_FLAG
        this.CAPICOM_VERIFY_SIGNATURE_ONLY = 0;
        this.CAPICOM_VERIFY_SIGNATURE_AND_CERTIFICATE = 1;

        // CAPICOM_ENCRYPTION_ALGORITHM
        this.CAPICOM_ENCRYPTION_ALGORITHM_RC2 = 0;
        this.CAPICOM_ENCRYPTION_ALGORITHM_RC4 = 1;
        this.CAPICOM_ENCRYPTION_ALGORITHM_DES = 2;
        this.CAPICOM_ENCRYPTION_ALGORITHM_3DES = 3;
        this.CAPICOM_ENCRYPTION_ALGORITHM_AES = 4;

        // CAPICOM_ENCRYPTION_KEY_LENGTH
        this.CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM = 0;
        this.CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS = 1;
        this.CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS = 2;
        this.CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS = 3;
        this.CAPICOM_ENCRYPTION_KEY_LENGTH_192_BITS = 4;
        this.CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS = 5;

        // CAPICOM_SECRET_TYPE
        this.CAPICOM_SECRET_PASSWORD = 0;

        // CAPICOM_KEY_ALGORITHM
        this.CAPICOM_KEY_ALGORITHM_OTHER = 0;
        this.CAPICOM_KEY_ALGORITHM_RSA = 1;
        this.CAPICOM_KEY_ALGORITHM_DSS = 2;

        // CAPICOM_OID
        this.CAPICOM_OID_OTHER = 0;
        this.CAPICOM_OID_AUTHORITY_KEY_IDENTIFIER_EXTENSION = 1;
        this.CAPICOM_OID_KEY_ATTRIBUTES_EXTENSION = 2;
        this.CAPICOM_OID_CERT_POLICIES_95_EXTENSION = 3;
        this.CAPICOM_OID_KEY_USAGE_RESTRICTION_EXTENSION = 4;
        this.CAPICOM_OID_LEGACY_POLICY_MAPPINGS_EXTENSION = 5;
        this.CAPICOM_OID_SUBJECT_ALT_NAME_EXTENSION = 6;
        this.CAPICOM_OID_ISSUER_ALT_NAME_EXTENSION = 7;
        this.CAPICOM_OID_BASIC_CONSTRAINTS_EXTENSION = 8;
        this.CAPICOM_OID_SUBJECT_KEY_IDENTIFIER_EXTENSION = 9;
        this.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;
        this.CAPICOM_OID_PRIVATEKEY_USAGE_PERIOD_EXTENSION = 11;
        this.CAPICOM_OID_SUBJECT_ALT_NAME2_EXTENSION = 12;
        this.CAPICOM_OID_ISSUER_ALT_NAME2_EXTENSION = 13;
        this.CAPICOM_OID_BASIC_CONSTRAINTS2_EXTENSION = 14;
        this.CAPICOM_OID_NAME_CONSTRAINTS_EXTENSION = 15;
        this.CAPICOM_OID_CRL_DIST_POINTS_EXTENSION = 16;
        this.CAPICOM_OID_CERT_POLICIES_EXTENSION = 17;
        this.CAPICOM_OID_POLICY_MAPPINGS_EXTENSION = 18;
        this.CAPICOM_OID_AUTHORITY_KEY_IDENTIFIER2_EXTENSION = 19;
        this.CAPICOM_OID_POLICY_CONSTRAINTS_EXTENSION = 20;
        this.CAPICOM_OID_ENHANCED_KEY_USAGE_EXTENSION = 21;
        this.CAPICOM_OID_CERTIFICATE_TEMPLATE_EXTENSION = 22;
        this.CAPICOM_OID_APPLICATION_CERT_POLICIES_EXTENSION = 23;
        this.CAPICOM_OID_APPLICATION_POLICY_MAPPINGS_EXTENSION = 24;
        this.CAPICOM_OID_APPLICATION_POLICY_CONSTRAINTS_EXTENSION = 25;
        this.CAPICOM_OID_AUTHORITY_INFO_ACCESS_EXTENSION = 26;
        this.CAPICOM_OID_SERVER_AUTH_EKU = 100;
        this.CAPICOM_OID_CLIENT_AUTH_EKU = 101;
        this.CAPICOM_OID_CODE_SIGNING_EKU = 102;
        this.CAPICOM_OID_EMAIL_PROTECTION_EKU = 103;
        this.CAPICOM_OID_IPSEC_END_SYSTEM_EKU = 104;
        this.CAPICOM_OID_IPSEC_TUNNEL_EKU = 105;
        this.CAPICOM_OID_IPSEC_USER_EKU = 106;
        this.CAPICOM_OID_TIME_STAMPING_EKU = 107;
        this.CAPICOM_OID_CTL_USAGE_SIGNING_EKU = 108;
        this.CAPICOM_OID_TIME_STAMP_SIGNING_EKU = 109;
        this.CAPICOM_OID_SERVER_GATED_CRYPTO_EKU = 110;
        this.CAPICOM_OID_ENCRYPTING_FILE_SYSTEM_EKU = 111;
        this.CAPICOM_OID_EFS_RECOVERY_EKU = 112;
        this.CAPICOM_OID_WHQL_CRYPTO_EKU = 113;
        this.CAPICOM_OID_NT5_CRYPTO_EKU = 114;
        this.CAPICOM_OID_OEM_WHQL_CRYPTO_EKU = 115;
        this.CAPICOM_OID_EMBEDED_NT_CRYPTO_EKU = 116;
        this.CAPICOM_OID_ROOT_LIST_SIGNER_EKU = 117;
        this.CAPICOM_OID_QUALIFIED_SUBORDINATION_EKU = 118;
        this.CAPICOM_OID_KEY_RECOVERY_EKU = 119;
        this.CAPICOM_OID_DIGITAL_RIGHTS_EKU = 120;
        this.CAPICOM_OID_LICENSES_EKU = 121;
        this.CAPICOM_OID_LICENSE_SERVER_EKU = 122;
        this.CAPICOM_OID_SMART_CARD_LOGON_EKU = 123;
        this.CAPICOM_OID_PKIX_POLICY_QUALIFIER_CPS = 124;
        this.CAPICOM_OID_PKIX_POLICY_QUALIFIER_USERNOTICE = 125;

        // CAPICOM_PROPID
        this.CAPICOM_PROPID_UNKNOWN = 0;
        this.CAPICOM_PROPID_KEY_PROV_HANDLE = 1;
        this.CAPICOM_PROPID_KEY_PROV_INFO = 2;
        this.CAPICOM_PROPID_SHA1_HASH = 3;
        this.CAPICOM_PROPID_HASH_PROP = 3;
        this.CAPICOM_PROPID_MD5_HASH = 4;
        this.CAPICOM_PROPID_KEY_CONTEXT = 5;
        this.CAPICOM_PROPID_KEY_SPEC = 6;
        this.CAPICOM_PROPID_IE30_RESERVED = 7;
        this.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;
        this.CAPICOM_PROPID_ENHKEY_USAGE = 9;
        this.CAPICOM_PROPID_CTL_USAGE = 9;
        this.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;
        this.CAPICOM_PROPID_FRIENDLY_NAME = 11;
        this.CAPICOM_PROPID_PVK_FILE = 12;
        this.CAPICOM_PROPID_DESCRIPTION = 13;
        this.CAPICOM_PROPID_ACCESS_STATE = 14;
        this.CAPICOM_PROPID_SIGNATURE_HASH = 15;
        this.CAPICOM_PROPID_SMART_CARD_DATA = 16;
        this.CAPICOM_PROPID_EFS = 17;
        this.CAPICOM_PROPID_FORTEZZA_DATA = 18;
        this.CAPICOM_PROPID_ARCHIVED = 19;
        this.CAPICOM_PROPID_KEY_IDENTIFIER = 20;
        this.CAPICOM_PROPID_AUTO_ENROLL = 21;
        this.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;
        this.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;
        this.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;
        this.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;
        this.CAPICOM_PROPID_ENROLLMENT = 26;
        this.CAPICOM_PROPID_DATE_STAMP = 27;
        this.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;
        this.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;
        this.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;
        this.CAPICOM_PROPID_RENEWAL = 64;
        this.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;
        this.CAPICOM_PROPID_FIRST_RESERVED = 66;
        this.CAPICOM_PROPID_LAST_RESERVED = 32767;
        this.CAPICOM_PROPID_FIRST_USER = 32768;
        this.CAPICOM_PROPID_LAST_USER = 65535;

        // CAPICOM_PROV_TYPE
        this.CAPICOM_PROV_RSA_FULL = 1;
        this.CAPICOM_PROV_RSA_SIG = 2;
        this.CAPICOM_PROV_DSS = 3;
        this.CAPICOM_PROV_FORTEZZA = 4;
        this.CAPICOM_PROV_MS_EXCHANGE = 5;
        this.CAPICOM_PROV_SSL = 6;
        this.CAPICOM_PROV_RSA_SCHANNEL = 12;
        this.CAPICOM_PROV_DSS_DH = 13;
        this.CAPICOM_PROV_EC_ECDSA_SIG = 14;
        this.CAPICOM_PROV_EC_ECNRA_SIG = 15;
        this.CAPICOM_PROV_EC_ECDSA_FULL = 16;
        this.CAPICOM_PROV_EC_ECNRA_FULL = 17;
        this.CAPICOM_PROV_DH_SCHANNEL = 18;
        this.CAPICOM_PROV_SPYRUS_LYNKS = 20;
        this.CAPICOM_PROV_RNG = 21;
        this.CAPICOM_PROV_INTEL_SEC = 22;
        this.CAPICOM_PROV_REPLACE_OWF = 23;
        this.CAPICOM_PROV_RSA_AES = 24;

        // CAPICOM_CERTIFICATE_SAVE_AS_TYPE
        this.CAPICOM_CERTIFICATE_SAVE_AS_PFX = 0;
        this.CAPICOM_CERTIFICATE_SAVE_AS_CER = 1;

        // CAPICOM_CERTIFICATES_SAVE_AS_TYPE
        this.CAPICOM_CERTIFICATES_SAVE_AS_SERIALIZED = 0;
        this.CAPICOM_CERTIFICATES_SAVE_AS_PKCS7 = 1;
        this.CAPICOM_CERTIFICATES_SAVE_AS_PFX = 2;

        // CAPICOM_CERTIFICATE_INCLUDE_OPTION
        this.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;
        this.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;
        this.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;

        // CAPICOM_KEY_SPEC
        this.CAPICOM_KEY_SPEC_KEYEXCHANGE = 1;
        this.CAPICOM_KEY_SPEC_SIGNATURE = 2;

        // CAPICOM_KEY_LOCATION
        this.CAPICOM_CURRENT_USER_KEY = 0;
        this.CAPICOM_LOCAL_MACHINE_KEY = 1;

        // CAPICOM_KEY_STORAGE_FLAG
        this.CAPICOM_KEY_STORAGE_DEFAULT = 0;
        this.CAPICOM_KEY_STORAGE_EXPORTABLE = 1;
        this.CAPICOM_KEY_STORAGE_USER_PROTECTED = 2;

        // CAPICOM_EXPORT_FLAG
        this.CAPICOM_EXPORT_DEFAULT = 0;
        this.CAPICOM_EXPORT_IGNORE_PRIVATE_KEY_NOT_EXPORTABLE_ERROR = 1;

        // CAPICOM_KEY_USAGE
        this.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;
        this.CAPICOM_NON_REPUDIATION_KEY_USAGE = 64;
        this.CAPICOM_KEY_ENCIPHERMENT_KEY_USAGE = 32;
        this.CAPICOM_DATA_ENCIPHERMENT_KEY_USAGE = 16;
        this.CAPICOM_KEY_AGREEMENT_KEY_USAGE = 8;
        this.CAPICOM_KEY_CERT_SIGN_KEY_USAGE = 4;
        this.CAPICOM_OFFLINE_CRL_SIGN_KEY_USAGE = 2;
        this.CAPICOM_CRL_SIGN_KEY_USAGE = 2;
        this.CAPICOM_ENCIPHER_ONLY_KEY_USAGE = 1;
        this.CAPICOM_DECIPHER_ONLY_KEY_USAGE = 32768;

        // CAPICOM_CERTIFICATE_FIND_TYPE
        this.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;
        this.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;
        this.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;
        this.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;
        this.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;
        this.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;
        this.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;
        this.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;
        this.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;
        this.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;
        this.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;
        this.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;
        this.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;

        // CAPICOM_HASH_ALGORITHM
        this.CAPICOM_HASH_ALGORITHM_SHA1 = 0;
        this.CAPICOM_HASH_ALGORITHM_MD2 = 1;
        this.CAPICOM_HASH_ALGORITHM_MD4 = 2;
        this.CAPICOM_HASH_ALGORITHM_MD5 = 3;

        this.CAPICOM_TRUST_IS_NOT_TIME_VALID  = 0x00000001 ;
        this.CAPICOM_TRUST_IS_NOT_TIME_NESTED = 0x00000002 ;
        this.CAPICOM_TRUST_IS_REVOKED  = 0x00000004 ;
        this.CAPICOM_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008 ;
        this.CAPICOM_TRUST_IS_NOT_VALID_FOR_USAGE  = 0x00000010 ;
        this.CAPICOM_TRUST_IS_UNTRUSTED_ROOT  = 0x00000020 ;
        this.CAPICOM_TRUST_REVOCATION_STATUS_UNKNOWN  = 0x00000040 ;
        this.CAPICOM_TRUST_IS_CYCLIC = 0x00000080 ;
        this.CAPICOM_TRUST_INVALID_EXTENSION  = 0x00000100 ;
        this.CAPICOM_TRUST_INVALID_POLICY_CONSTRAINTS = 0x00000200 ;
        this.CAPICOM_TRUST_INVALID_BASIC_CONSTRAINTS  = 0x00000400 ;
        this.CAPICOM_TRUST_INVALID_NAME_CONSTRAINTS  = 0x00000800 ;
        this.CAPICOM_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT  = 0x00001000 ;
        this.CAPICOM_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT  = 0x00002000 ;
        this.CAPICOM_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT  = 0x00004000 ;
        this.CAPICOM_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT  = 0x00008000 ;
        this.CAPICOM_TRUST_IS_OFFLINE_REVOCATION  = 0x01000000 ;
        this.CAPICOM_TRUST_NO_ISSUANCE_CHAIN_POLICY  = 0x02000000 ;
        this.CAPICOM_TRUST_IS_PARTIAL_CHAIN  = 0x00010000 ;
        this.CAPICOM_TRUST_CTL_IS_NOT_TIME_VALID  = 0x00020000 ;
        this.CAPICOM_TRUST_CTL_IS_NOT_SIGNATURE_VALID  = 0x00040000 ;
        this.CAPICOM_TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 0x00080000 ;

        this.CRYPT_EXPORTABLE=1;
        this.CRYPT_USER_PROTECTED=2;
        this.CRYPT_MACHINE_KEYSET=0x20;
        this.AT_KEYEXCHANGE=1;
        this.AT_SIGNATURE=2;

        this.CERT_STORE_NO_CRYPT_RELEASE_FLAG                = 0x00000001;
        this.CERT_STORE_SET_LOCALIZED_NAME_FLAG              = 0x00000002;
        this.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG     = 0x00000004;
        this.CERT_STORE_DELETE_FLAG                          = 0x00000010;
        this.CERT_STORE_UNSAFE_PHYSICAL_FLAG                 = 0x00000020;
        this.CERT_STORE_SHARE_STORE_FLAG                     = 0x00000040;
        this.CERT_STORE_SHARE_CONTEXT_FLAG                   = 0x00000080;
        this.CERT_STORE_MANIFOLD_FLAG                        = 0x00000100;
        this.CERT_STORE_ENUM_ARCHIVED_FLAG                   = 0x00000200;
        this.CERT_STORE_UPDATE_KEYID_FLAG                    = 0x00000400;
        this.CERT_STORE_BACKUP_RESTORE_FLAG                  = 0x00000800;
        this.CERT_STORE_READONLY_FLAG                        = 0x00008000;
        this.CERT_STORE_OPEN_EXISTING_FLAG                   = 0x00004000;
        this.CERT_STORE_CREATE_NEW_FLAG                      = 0x00002000;
        this.CERT_STORE_MAXIMUM_ALLOWED_FLAG                 = 0x00001000;

        this.CERT_SYSTEM_STORE_LOCATION_SHIFT=16;
        this.CERT_SYSTEM_STORE_CURRENT_USER_ID=1;
        this.CERT_SYSTEM_STORE_LOCAL_MACHINE_ID=2;
        this.CERT_SYSTEM_STORE_CURRENT_USER=this.CERT_SYSTEM_STORE_CURRENT_USER_ID << this.CERT_SYSTEM_STORE_LOCATION_SHIFT;
        this.CERT_SYSTEM_STORE_LOCAL_MACHINE=this.CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << this.CERT_SYSTEM_STORE_LOCATION_SHIFT;
        this.ALG_CLASS_ANY=0
        this.ALG_CLASS_SIGNATURE=1<<13;
        this.ALG_CLASS_HASH=4<<13;
        this.PROV_DSS=3;
        this.PROV_DSS_DH=13;
        this.PROV_DH_SCHANNEL=18;

        this.XECR_PKCS10_V2_0=1;
        this.XECR_PKCS7=2;
        this.XECR_CMC=3;

        this.XECT_EXTENSION_V1=1;
        this.XECT_EXTENSION_V2=2;

        this.CR_DISP_INCOMPLETE = ( 0 );
        this.CR_DISP_ERROR      = ( 0x1 );
        this.CR_DISP_DENIED     = ( 0x2 );
        this.CR_DISP_ISSUED     = ( 0x3 );
        this.CR_DISP_ISSUED_OUT_OF_BAND = ( 0x4 );
        this.CR_DISP_UNDER_SUBMISSION   = ( 0x5 );
        this.CR_DISP_REVOKED    = ( 0x6 );

        this.CR_IN_BASE64HEADER = ( 0 );
        this.CR_IN_BASE64       = ( 0x1 );
        this.CR_IN_BINARY       = ( 0x2 );
        this.CR_IN_ENCODEANY    = ( 0xff );
        this.CR_IN_ENCODEMASK   = ( 0xff );
        this.CR_IN_FORMATANY    = ( 0 );
        this.CR_IN_PKCS10       = ( 0x100 );
        this.CR_IN_KEYGEN       = ( 0x200 );
        this.CR_IN_PKCS7        = ( 0x300 );
        this.CR_IN_CMC  = ( 0x400 );
        this.CR_IN_FORMATMASK   = ( 0xff00 );
        this.CR_IN_RPC  = ( 0x20000 );
        this.CR_IN_FULLRESPONSE = ( 0x40000 );
        this.CR_IN_CRLS = ( 0x80000 );

        this.CR_PROP_NONE               =0  ;// Invalid
        this.CR_PROP_FILEVERSION        =1  ;// String
        this.CR_PROP_PRODUCTVERSION     =2  ;// String
        this.CR_PROP_EXITCOUNT          =3  ;// Long

        // CR_PROP_EXITCOUNT Elements:
        this.CR_PROP_EXITDESCRIPTION    =4  ;// String, Indexed

        this.CR_PROP_POLICYDESCRIPTION  =5  ;// String
        this.CR_PROP_CANAME             =6  ;// String
        this.CR_PROP_SANITIZEDCANAME    =7  ;// String
        this.CR_PROP_SHAREDFOLDER       =8  ;// String
        this.CR_PROP_PARENTCA           =9  ;// String
        this.CR_PROP_CATYPE            =10  ;// Long
        this.CR_PROP_CASIGCERTCOUNT    =11  ;// Long

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CASIGCERT         =12  ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CASIGCERTCHAIN    =13  ;// Binary, Indexed

        this.CR_PROP_CAXCHGCERTCOUNT   =14  ;// Long

        // CR_PROP_CAXCHGCERTCOUNT Elements:
        this.CR_PROP_CAXCHGCERT        =15  ;// Binary, Indexed

        // CR_PROP_CAXCHGCERTCOUNT Elements:
        this.CR_PROP_CAXCHGCERTCHAIN   =16  ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        // Fetch only if CR_PROP_CRLSTATE[i] == CA_DISP_VALID
        // May also be available if CR_PROP_CRLSTATE[i] == CA_DISP_INVALID
        this.CR_PROP_BASECRL           =17  ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        // Fetch only if Delta CRLs enabled && CR_PROP_CRLSTATE[i] == CA_DISP_VALID
        // May also be available if CR_PROP_CRLSTATE[i] == CA_DISP_INVALID
        this.CR_PROP_DELTACRL          =18  ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CACERTSTATE       =19  ;// Long, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CRLSTATE          =20  ;// Long, Indexed

        this.CR_PROP_CAPROPIDMAX       =21  ;// Long
        this.CR_PROP_DNSNAME           =22  ;// String
        this.CR_PROP_ROLESEPARATIONENABLED =23 ;// Long
        this.CR_PROP_KRACERTUSEDCOUNT  =24  ;// Long
        this.CR_PROP_KRACERTCOUNT      =25  ;// Long

        // CR_PROP_KRACERTCOUNT Elements:
        this.CR_PROP_KRACERT           =26  ;// Binary, Indexed

        // CR_PROP_KRACERTCOUNT Elements:
        this.CR_PROP_KRACERTSTATE      =27  ;// Long, Indexed

        this.CR_PROP_ADVANCEDSERVER    =28  ;// Long
        this.CR_PROP_TEMPLATES         =29  ;// String

        // CR_PROP_CASIGCERTCOUNT Elements:
        // Fetch only if CR_PROP_CRLSTATE[i] == CA_DISP_VALID
        this.CR_PROP_BASECRLPUBLISHSTATUS =30  ;// Long, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        // Fetch only if Delta CRLs enabled && CR_PROP_CRLSTATE[i] == CA_DISP_VALID
        this.CR_PROP_DELTACRLPUBLISHSTATUS =31  ;// Long, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CASIGCERTCRLCHAIN =32  ;// Binary, Indexed

        // CR_PROP_CAXCHGCERTCOUNT Elements:
        this.CR_PROP_CAXCHGCERTCRLCHAIN =33 ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CACERTSTATUSCODE  =34  ;// Long, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CAFORWARDCROSSCERT =35  ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CABACKWARDCROSSCERT =36  ;// Binary, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CAFORWARDCROSSCERTSTATE =37  ;// Long, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CABACKWARDCROSSCERTSTATE =38  ;// Long, Indexed

        // CR_PROP_CASIGCERTCOUNT Elements:
        this.CR_PROP_CACERTVERSION       =39  ;// Long, Indexed
        this.CR_PROP_SANITIZEDCASHORTNAME =40  ;// String

        // DataTypeEnum;
        this.adEmpty = 0;
        this.adTinyInt = 16;
        this.adSmallInt = 2;
        this.adInteger = 3;
        this.adBigInt = 20;
        this.adUnsignedTinyInt = 17;
        this.adUnsignedSmallInt = 18;
        this.adUnsignedInt = 19;
        this.adUnsignedBigInt = 21;
        this.adSingle = 4;
        this.adDouble = 5;
        this.adCurrency = 6;
        this.adDecimal = 14;
        this.adNumeric = 131;
        this.adBoolean = 11;
        this.adError = 10;
        this.adUserDefined = 132;
        this.adVariant = 12;
        this.adIDispatch = 9;
        this.adIUnknown = 13;
        this.adGUID = 72;
        this.adDate = 7;
        this.adDBDate = 133;
        this.adDBTime = 134;
        this.adDBTimeStamp = 135;
        this.adBSTR = 8;
        this.adChar = 129;
        this.adVarChar = 200;
        this.adLongVarChar = 201;
        this.adWChar = 130;
        this.adVarWChar = 202;
        this.adLongVarWChar = 203;
        this.adBinary = 128;
        this.adVarBinary = 204;
        this.adLongVarBinary = 205;
        this.adChapter = 136;
        this.adFileTime = 64;
        this.adPropVariant = 138;
        this.adVarNumeric = 139;
        this.adArray = 8192;

        // ParameterDirectionEnum;
        this.adParamUnknown = 0;
        this.adParamInput = 1;
        this.adParamOutput = 2;
        this.adParamInputOutput = 3;
        this.adParamReturnValue = 4;

        // CommandTypeEnum;
        this.adCmdUnspecified = -1;
        this.adCmdUnknown = 8;
        this.adCmdText = 1;
        this.adCmdTable = 2;
        this.adCmdStoredProc = 4;
        this.adCmdFile = 256;
        this.adCmdTableDirect = 512;

        this.szOID_NT_PRINCIPAL_NAME = "1.3.6.1.4.1.311.20.2.3";
        this.szOID_NTDS_REPLICATION = "1.3.6.1.4.1.311.25.1";

        this.CA_DISP_INCOMPLETE = 0 ;
        this.CA_DISP_ERROR      = 0x1 ;
        this.CA_DISP_REVOKED    = 0x2 ;
        this.CA_DISP_VALID      = 0x3 ;
        this.CA_DISP_INVALID    = 0x4 ;
        this.CA_DISP_UNDER_SUBMISSION   = 0x5 ;

        this.CRL_REASON_UNSPECIFIED              =0;
        this.CRL_REASON_KEY_COMPROMISE           =1;
        this.CRL_REASON_CA_COMPROMISE            =2;
        this.CRL_REASON_AFFILIATION_CHANGED      =3;
        this.CRL_REASON_SUPERSEDED               =4;
        this.CRL_REASON_CESSATION_OF_OPERATION   =5;
        this.CRL_REASON_CERTIFICATE_HOLD         =6;
        this.CRL_REASON_REMOVE_FROM_CRL          =8;

        this.PROPTYPE_LONG               = 0x00000001;  // Signed long
        this.PROPTYPE_DATE               = 0x00000002;  // Date+Time
        this.PROPTYPE_BINARY             = 0x00000003;  // Binary data
        this.PROPTYPE_STRING             = 0x00000004;  // Unicode String
        this.PROPTYPE_MASK               = 0x000000ff;

        this.CV_OUT_BASE64HEADER        = 0 ;
        this.CV_OUT_BASE64      = 0x1 ;
        this.CV_OUT_BINARY      = 0x2 ;
        this.CV_OUT_BASE64REQUESTHEADER = 0x3 ;
        this.CV_OUT_HEX = 0x4 ;
        this.CV_OUT_HEXASCII    = 0x5 ;
        this.CV_OUT_BASE64X509CRLHEADER = 0x9 ;
        this.CV_OUT_HEXADDR     = 0xa ;
        this.CV_OUT_HEXASCIIADDR        = 0xb ;
        this.CV_OUT_ENCODEMASK  = 0xff ;

        this.CVR_SEEK_NONE      = 0 ;
        this.CVR_SEEK_EQ        = 0x1 ;
        this.CVR_SEEK_LT        = 0x2 ;
        this.CVR_SEEK_LE        = 0x4 ;
        this.CVR_SEEK_GE        = 0x8 ;
        this.CVR_SEEK_GT        = 0x10 ;
        this.CVR_SEEK_MASK      = 0xff ;
        this.CVR_SEEK_NODELTA   = 0x1000 ;
        this.CVR_SORT_NONE      = 0 ;
        this.CVR_SORT_ASCEND    = 0x1 ;
        this.CVR_SORT_DESCEND   = 0x2 ;
        this.CV_COLUMN_QUEUE_DEFAULT    = -1 ;
        this.CV_COLUMN_LOG_DEFAULT      = -2 ;
        this.CV_COLUMN_LOG_FAILED_DEFAULT       = -3 ;
        this.CV_COLUMN_EXTENSION_DEFAULT        = -4 ;
        this.CV_COLUMN_ATTRIBUTE_DEFAULT        = -5 ;
        this.CV_COLUMN_CRL_DEFAULT      = -6 ;
        this.CV_COLUMN_LOG_REVOKED_DEFAULT      = -7 ;
        this.CVRC_COLUMN_SCHEMA = 0 ;
        this.CVRC_COLUMN_RESULT = 0x1 ;
        this.CVRC_COLUMN_VALUE  = 0x2 ;
        this.CVRC_COLUMN_MASK   = 0xfff ;
        this.CVRC_TABLE_REQCERT = 0 ;
        this.CVRC_TABLE_EXTENSIONS      = 0x3000 ;
        this.CVRC_TABLE_ATTRIBUTES      = 0x4000 ;
        this.CVRC_TABLE_CRL     = 0x5000 ;
        this.CVRC_TABLE_MASK    = 0xf000 ;
        this.CVRC_TABLE_SHIFT   = 12 ;

        //GetFullResponseProperty
        this.FR_PROP_NONE = 0;
        this.FR_PROP_FULLRESPONSE = 1;
        this.FR_PROP_STATUSINFOCOUNT = 2;
        this.FR_PROP_BODYPARTSTRING = 3;
        this.FR_PROP_STATUS = 4;
        this.FR_PROP_STATUSSTRING = 5;
        this.FR_PROP_OTHERINFOCHOICE = 6;
        this.FR_PROP_FAILINFO = 7;
        this.FR_PROP_PENDINFOTOKEN = 8;
        this.FR_PROP_PENDINFOTIME = 9;
        this.FR_PROP_ISSUEDCERTIFICATEHASH = 10;
        this.FR_PROP_ISSUEDCERTIFICATE = 11;
        this.FR_PROP_ISSUEDCERTIFICATECHAIN = 12;
        this.FR_PROP_ISSUEDCERTIFICATECRLCHAIN = 13;
        this.FR_PROP_ENCRYPTEDKYEHASH = 14;
        this.FR_PROP_FULLRESPONSENOPKCS7 = 15 ;

        this.CPF_BASE           =0x00000001;
        this.CPF_DELTA          =0x00000002;
        this.CPF_COMPLETE               =0x00000004;
        this.CPF_SHADOW         =0x00000008;
        this.CPF_CASTORE_ERROR  =0x00000010;
        this.CPF_BADURL_ERROR   =0x00000020;
        this.CPF_MANUAL         =0x00000040;
        this.CPF_SIGNATURE_ERROR        =0x00000080;
        this.CPF_LDAP_ERROR             =0x00000100;
        this.CPF_FILE_ERROR             =0x00000200;
        this.CPF_FTP_ERROR              =0x00000400;
        this.CPF_HTTP_ERROR             =0x00000800;

        this.ERROR_NOT_FOUND = 0x80070490;
}
