2025-04-27 07:49:33 -04:00

1180 lines
36 KiB
Plaintext

// CAPICOM.idl : IDL source for CAPICOM.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (CAPICOM.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
import "wincrypt.idl";
#if (0)
//
// Forward references
//
interface ISettings
interface IEKU;
interface IEKUs;
interface IKeyUsage;
interface IExtendedKeyUsage;
interface IBasicConstraints;
interface ICertificateStatus
interface ICertificate;
interface ICertificates;
interface IChain;
interface IStore;
interface IAttribute
interface IAttributes
interface ISigner;
interface ISigners;
interface ISignedData;
interface IAlgorithm;
interface IRecipients;
interface IEnvelopedData;
interface IEncryptedData;
#endif
//
// CAPICOM
//
[
uuid(BD26B198-EE42-4725-9B23-AFA912434229),
version(1.0),
helpstring("CAPICOM 1.0 Type Library")
]
library CAPICOM
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
//
// Error codes.
//
typedef enum CAPICOM_ERROR_CODE
{
CAPICOM_E_ENCODE_INVALID_TYPE = 0x80880100,
CAPICOM_E_EKU_INVALID_OID = 0x80880200,
CAPICOM_E_EKU_OID_NOT_INITIALIZED = 0x80880201,
CAPICOM_E_CERTIFICATE_NOT_INITIALIZED = 0x80880210,
CAPICOM_E_CERTIFICATE_NO_PRIVATE_KEY = 0x80880211,
CAPICOM_E_CHAIN_NOT_BUILT = 0x80880220,
CAPICOM_E_STORE_NOT_OPENED = 0x80880230,
CAPICOM_E_STORE_EMPTY = 0x80880231,
CAPICOM_E_STORE_INVALID_OPEN_MODE = 0x80880232,
CAPICOM_E_STORE_INVALID_SAVE_AS_TYPE = 0x80880233,
CAPICOM_E_ATTRIBUTE_NAME_NOT_INITIALIZED = 0x80880240,
CAPICOM_E_ATTRIBUTE_VALUE_NOT_INITIALIZED = 0x80880241,
CAPICOM_E_ATTRIBUTE_INVALID_NAME = 0x80880242,
CAPICOM_E_ATTRIBUTE_INVALID_VALUE = 0x80880243,
CAPICOM_E_SIGNER_NOT_INITIALIZED = 0x80880250,
CAPICOM_E_SIGNER_NOT_FOUND = 0x80880251,
CAPICOM_E_SIGN_NOT_INITIALIZED = 0x80880260,
CAPICOM_E_SIGN_INVALID_TYPE = 0x80880261,
CAPICOM_E_SIGN_NOT_SIGNED = 0x80880262,
CAPICOM_E_INVALID_ALGORITHM = 0x80880270,
CAPICOM_E_INVALID_KEY_LENGTH = 0x80880271,
CAPICOM_E_ENVELOP_NOT_INITIALIZED = 0x80880280,
CAPICOM_E_ENVELOP_INVALID_TYPE = 0x80880281,
CAPICOM_E_ENVELOP_NO_RECIPIENT = 0x80880282,
CAPICOM_E_ENVELOP_RECIPIENT_NOT_FOUND = 0x80880283,
CAPICOM_E_ENCRYPT_NOT_INITIALIZED = 0x80880290,
CAPICOM_E_ENCRYPT_INVALID_TYPE = 0x80880291,
CAPICOM_E_ENCRYPT_NO_SECRET = 0x80880292,
CAPICOM_E_NOT_SUPPORTED = 0x80880900,
CAPICOM_E_UI_DISABLED = 0x80880901,
CAPICOM_E_CANCELLED = 0x80880902,
CAPICOM_E_INTERNAL = 0x80880911,
CAPICOM_E_UNKNOWN = 0x80880999,
} CAPICOM_ERROR_CODE;
//
// Enumerated data types.
//
typedef enum CAPICOM_ENCODING_TYPE
{
CAPICOM_ENCODE_BASE64 = 0,
CAPICOM_ENCODE_BINARY = 1,
} CAPICOM_ENCODING_TYPE;
typedef enum CAPICOM_EKU
{
CAPICOM_EKU_OTHER = 0,
CAPICOM_EKU_SERVER_AUTH = 1,
CAPICOM_EKU_CLIENT_AUTH = 2,
CAPICOM_EKU_CODE_SIGNING = 3,
CAPICOM_EKU_EMAIL_PROTECTION = 4,
} CAPICOM_EKU;
typedef enum CAPICOM_CHECK_FLAG
{
CAPICOM_CHECK_NONE = 0,
CAPICOM_CHECK_TRUSTED_ROOT = 1,
CAPICOM_CHECK_TIME_VALIDITY = 2,
CAPICOM_CHECK_SIGNATURE_VALIDITY = 4,
CAPICOM_CHECK_ONLINE_REVOCATION_STATUS = 8,
CAPICOM_CHECK_OFFLINE_REVOCATION_STATUS = 16,
} CAPICOM_CHECK_FLAG;
typedef enum CAPICOM_CERT_INFO_TYPE
{
CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0,
CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1,
CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME = 2,
CAPICOM_CERT_INFO_ISSUER_EMAIL_NAME = 3,
} CAPICOM_CERT_INFO_TYPE;
typedef enum CAPICOM_STORE_LOCATION
{
CAPICOM_MEMORY_STORE = 0,
CAPICOM_LOCAL_MACHINE_STORE = 1,
CAPICOM_CURRENT_USER_STORE = 2,
CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3,
} CAPICOM_STORE_LOCATION;
typedef enum CAPICOM_STORE_OPEN_MODE
{
CAPICOM_STORE_OPEN_READ_ONLY = 0,
CAPICOM_STORE_OPEN_READ_WRITE = 1,
CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2,
} CAPICOM_STORE_OPEN_MODE;
typedef enum CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION
{
CAPICOM_SEARCH_ANY = 0,
CAPICOM_SEARCH_GLOBAL_CATALOG = 1,
CAPICOM_SEARCH_DEFAULT_DOMAIN = 2,
} CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION;
typedef enum CAPICOM_STORE_SAVE_AS_TYPE
{
CAPICOM_STORE_SAVE_AS_SERIALIZED = 0,
CAPICOM_STORE_SAVE_AS_PKCS7 = 1,
} CAPICOM_STORE_SAVE_AS_TYPE;
typedef enum CAPICOM_ATTRIBUTE
{
CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0,
CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1,
CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2,
} CAPICOM_ATTRIBUTE;
typedef enum CAPICOM_SIGNED_DATA_VERIFY_FLAG
{
CAPICOM_VERIFY_SIGNATURE_ONLY = 0,
CAPICOM_VERIFY_SIGNATURE_AND_CERTIFICATE = 1,
} CAPICOM_SIGNED_DATA_VERIFY_FLAG;
typedef enum CAPICOM_ENCRYPTION_ALGORITHM
{
CAPICOM_ENCRYPTION_ALGORITHM_RC2 = 0,
CAPICOM_ENCRYPTION_ALGORITHM_RC4 = 1,
CAPICOM_ENCRYPTION_ALGORITHM_DES = 2,
CAPICOM_ENCRYPTION_ALGORITHM_3DES = 3,
} CAPICOM_ENCRYPTION_ALGORITHM;
typedef enum CAPICOM_ENCRYPTION_KEY_LENGTH
{
CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM = 0,
CAPICOM_ENCRYPTION_KEY_LENGTH_40_BITS = 1,
CAPICOM_ENCRYPTION_KEY_LENGTH_56_BITS = 2,
CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS = 3,
} CAPICOM_ENCRYPTION_KEY_LENGTH;
typedef enum CAPICOM_SECRET_TYPE
{
CAPICOM_SECRET_PASSWORD = 0,
} CAPICOM_SECRET_TYPE;
//
// Constants.
//
[dllname("CAPICOM")]
module Constants
{
//
// CAPICOM version string.
//
const LPSTR CAPICOM_VERSION_INFO = "CAPICOM v1.0";
//
// System store names.
//
const LPSTR CAPICOM_MY_STORE = "My";
const LPSTR CAPICOM_CA_STORE = "Ca";
const LPSTR CAPICOM_ROOT_STORE = "Root";
const LPSTR CAPICOM_OTHER_STORE = "AddressBook";
//
// Enhanced Key Usage OIDs.
//
const LPSTR CAPICOM_OID_SERVER_AUTH = "1.3.6.1.5.5.7.3.1";
const LPSTR CAPICOM_OID_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2";
const LPSTR CAPICOM_OID_CODE_SIGNING = "1.3.6.1.5.5.7.3.3";
const LPSTR CAPICOM_OID_EMAIL_PROTECTION = "1.3.6.1.5.5.7.3.4";
const LPSTR CAPICOM_OID_IPSEC_END_SYSTEM = "1.3.6.1.5.5.7.3.5";
const LPSTR CAPICOM_OID_IPSEC_TUNNEL = "1.3.6.1.5.5.7.3.6";
const LPSTR CAPICOM_OID_IPSEC_USER = "1.3.6.1.5.5.7.3.7";
const LPSTR CAPICOM_OID_TIME_STAMPING = "1.3.6.1.5.5.7.3.8";
const LPSTR CAPICOM_OID_CTL_USAGE_SIGNING = "1.3.6.1.4.1.311.10.3.1";
const LPSTR CAPICOM_OID_TIME_STAMP_SIGNING = "1.3.6.1.4.1.311.10.3.2";
const LPSTR CAPICOM_OID_SERVER_GATED_CRYPTO = "1.3.6.1.4.1.311.10.3.3";
const LPSTR CAPICOM_OID_ENCRYPTING_FILE_SYSTEM = "1.3.6.1.4.1.311.10.3.4";
const LPSTR CAPICOM_OID_WHQL_CRYPTO = "1.3.6.1.4.1.311.10.3.5";
const LPSTR CAPICOM_OID_NT5_CRYPTO = "1.3.6.1.4.1.311.10.3.6";
const LPSTR CAPICOM_OID_OEM_WHQL_CRYPTO = "1.3.6.1.4.1.311.10.3.7";
const LPSTR CAPICOM_OID_EMBEDED_NT_CRYPTO = "1.3.6.1.4.1.311.10.3.8";
const LPSTR CAPICOM_OID_ROOT_LIST_SIGNER = "1.3.6.1.4.1.311.10.3.9";
const LPSTR CAPICOM_OID_QUALIFIED_SUBORDINATION = "1.3.6.1.4.1.311.10.3.10";
const LPSTR CAPICOM_OID_KEY_RECOVERY = "1.3.6.1.4.1.311.10.3.11";
const LPSTR CAPICOM_OID_DIGITAL_RIGHTS = "1.3.6.1.4.1.311.10.5.1";
const LPSTR CAPICOM_OID_LICENSES = "1.3.6.1.4.1.311.10.6.1";
const LPSTR CAPICOM_OID_LICENSE_SERVER = "1.3.6.1.4.1.311.10.6.2";
const LPSTR CAPICOM_OID_SMART_CARD_LOGON = "1.3.6.1.4.1.311.20.2.2";
//
// Chain status.
//
const long CAPICOM_TRUST_IS_NOT_TIME_VALID = 0x00000001;
const long CAPICOM_TRUST_IS_NOT_TIME_NESTED = 0x00000002;
const long CAPICOM_TRUST_IS_REVOKED = 0x00000004;
const long CAPICOM_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008;
const long CAPICOM_TRUST_IS_NOT_VALID_FOR_USAGE = 0x00000010;
const long CAPICOM_TRUST_IS_UNTRUSTED_ROOT = 0x00000020;
const long CAPICOM_TRUST_REVOCATION_STATUS_UNKNOWN = 0x00000040;
const long CAPICOM_TRUST_IS_CYCLIC = 0x00000080;
const long CAPICOM_TRUST_IS_PARTIAL_CHAIN = 0x00010000;
const long CAPICOM_TRUST_CTL_IS_NOT_TIME_VALID = 0x00020000;
const long CAPICOM_TRUST_CTL_IS_NOT_SIGNATURE_VALID = 0x00040000;
const long CAPICOM_TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 0x00080000;
};
//
// Settings
//
[
uuid(A996E48C-D3DC-4244-89F7-AFA33EC60679),
helpstring("Settings Class")
]
coclass Settings
{
[default] interface ISettings;
};
//
// EKU
//
[
uuid(8535F9A1-738A-40D0-8FB1-10CC8F74E7D3),
helpstring("EKU Class"),
noncreatable
]
coclass EKU
{
[default] interface IEKU;
};
//
// EKUs
//
[
uuid(F1800663-5BFC-4D1A-8D44-56CE02DDA34F),
helpstring("EKUs Class"),
noncreatable
]
coclass EKUs
{
[default] interface IEKUs;
};
//
// KeyUsage
//
[
uuid(9226C95C-38BE-4CC4-B3A2-A867F5199C13),
helpstring("KeyUsage Class"),
noncreatable
]
coclass KeyUsage
{
[default] interface IKeyUsage;
};
//
// Extended key usage
//
[
uuid(42C18607-1B4B-4126-8F1B-76E2DC7F631A),
helpstring("ExtendedKeyUsage Class"),
noncreatable
]
coclass ExtendedKeyUsage
{
[default] interface IExtendedKeyUsage;
};
//
// BasicConstraints
[
uuid(C05AAC6E-3A58-45A9-A203-56952E961E48),
helpstring("BasicConstraints Class"),
noncreatable
]
coclass BasicConstraints
{
[default] interface IBasicConstraints;
};
//
// CertificateStatus
//
[
uuid(16951EE6-A455-47CA-A78B-F98DA566B604),
helpstring("CertificateStatus Class"),
noncreatable
]
coclass CertificateStatus
{
[default] interface ICertificateStatus;
};
//
// Certificate
//
[
uuid(E38FD381-6404-4041-B5E9-B2739258941F),
helpstring("Certificate Class")
]
coclass Certificate
{
[default] interface ICertificate;
interface ICCertificate;
};
//
// Certificates
//
[
uuid(FBAB033B-CDD0-4C5E-81AB-AEA575CD1338),
helpstring("Certificates Class"),
noncreatable
]
coclass Certificates
{
[default] interface ICertificates;
};
//
// Chain
//
[
uuid(65104D73-BA60-4160-A95A-4B4782E7AA62),
helpstring("Chain Class")
]
coclass Chain
{
[default] interface IChain;
interface ICChain;
};
//
// Store
//
[
uuid(78E61E52-0E57-4456-A2F2-517492BCBF8F),
helpstring("Store Class")
]
coclass Store
{
[default] interface IStore;
};
//
// Attribute
//
[
uuid(54BA1E8F-818D-407F-949D-BAE1692C5C18),
helpstring("Attribute Class")
]
coclass Attribute
{
[default] interface IAttribute;
};
//
// IAttributes
//
[
uuid(933013A9-64C8-4485-ACEF-4908C3692A33),
helpstring("Attributes Class"),
noncreatable
]
coclass Attributes
{
[default] interface IAttributes;
};
//
// Signer
//
[
uuid(60A9863A-11FD-4080-850E-A8E184FC3A3C),
helpstring("Signer Class")
]
coclass Signer
{
[default] interface ISigner;
};
//
// Signers
//
[
uuid(1314C1D8-D3A8-4F8A-BED0-811FD7A8A633),
helpstring("Signers Class"),
noncreatable
]
coclass Signers
{
[default] interface ISigners;
};
//
// SignedData
//
[
uuid(94AFFFCC-6C05-4814-B123-A941105AA77F),
helpstring("SignedData Class")
]
coclass SignedData
{
[default] interface ISignedData;
};
//
// Algorithm
//
[
uuid(A1EEF42F-5026-4A32-BC5C-2E552B70FD96),
helpstring("Algorithm Class"),
noncreatable
]
coclass Algorithm
{
[default] interface IAlgorithm;
};
//
// Recipients
//
[
uuid(96A1B8B0-8F9A-436A-84DE-E23CD6818DA5),
helpstring("Recipients Class"),
noncreatable
]
coclass Recipients
{
[default] interface IRecipients;
};
//
// EnvelopedData
//
[
uuid(F3A12E08-EDE9-4160-8B51-334D982A9AD0),
helpstring("EnvelopedData Class")
]
coclass EnvelopedData
{
[default] interface IEnvelopedData;
};
//
// EncryptedData
//
[
uuid(A440BD76-CFE1-4D46-AB1F-15F238437A3D),
helpstring("EncryptedData Class")
]
coclass EncryptedData
{
[default] interface IEncryptedData;
};
};
//
// Interfaces
//
//
// Settings
//
[
object,
uuid(A24104F5-46D0-4C0F-926D-665565908E91),
dual,
helpstring("ISettings Interface"),
pointer_default(unique)
]
interface ISettings : IDispatch
{
[propget, id(1), helpstring("Property to get the current setting to enable/disable dialog box to prompt for certificate used to sign/decrypt a message.")]
HRESULT EnablePromptForCertificateUI([out, retval] VARIANT_BOOL * pVal);
[propput, id(1), helpstring("Property to enable/disable dialog box to prompt for certificate used to sign/decrypt a message.")]
HRESULT EnablePromptForCertificateUI([in, defaultvalue(0)] VARIANT_BOOL newVal);
[propget, id(2), helpstring("Property to get the current Active Directory search location.")]
HRESULT ActiveDirectorySearchLocation([out, retval] CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION * pVal);
[propput, id(2), helpstring("Property to set the Active Directory search location. By default, search location is unspecified, in which case Global Catalog will be searched if the userCertificate attribute is published there, otherwise the default domain will be searched.")]
HRESULT ActiveDirectorySearchLocation([in, defaultvalue(CAPICOM_SEARCH_ANY)] CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION newVal);
};
//
// IEKU
//
[
object,
uuid(976B7E6D-1002-4051-BFD4-824A74BD74E2),
dual,
helpstring("IEKU Interface"),
pointer_default(unique)
]
interface IEKU : IDispatch
{
[propget, id(0), helpstring("Default property to get EKU name.")]
HRESULT Name([out, retval] CAPICOM_EKU * pVal);
[propput, id(0), helpstring("Default property to set EKU name.")]
HRESULT Name([in] CAPICOM_EKU newVal);
[propget, id(1), helpstring("Property to get the actual EKU OID string as defined in WinCrypt.h.")]
HRESULT OID([out, retval] BSTR * pVal);
[propput, id(1), helpstring("Property to set the actual EKU OID string as defined in WinCrypt.h.")]
HRESULT OID([in] BSTR newVal);
};
//
// IEKUs
//
[
object,
uuid(47C87CEC-8C4B-4E3C-8D22-34280274EFD1),
dual,
helpstring("IEKUs Interface"),
pointer_default(unique)
]
interface IEKUs : IDispatch
{
//
// Property
//
[propget, id(0), helpstring("Property Item.")]
HRESULT Item([in] long Index, [out, retval] VARIANT * pVal);
[propget, id(1), helpstring("Property Count.")]
HRESULT Count([out, retval] long * pVal);
[propget, id(DISPID_NEWENUM), helpstring("Property _NewEnum."), restricted]
HRESULT _NewEnum([out, retval] LPUNKNOWN * pVal);
};
//
// IKeyUsage
//
[
object,
uuid(41DD35A8-9FF9-45A6-9A7C-F65B2F085D1F),
dual,
helpstring("IKeyUsage Interface"),
pointer_default(unique)
]
interface IKeyUsage : IDispatch
{
//
// Property
//
[propget, id(1), helpstring("Property to check if the KeyUsage extension is present.")]
HRESULT IsPresent([out, retval] VARIANT_BOOL * pVal);
[propget, id(2), helpstring("Property to check if the KeyUsage extension is marked critical.")]
HRESULT IsCritical([out, retval] VARIANT_BOOL * pVal);
[propget, id(3), helpstring("Property to check if the digitalSignature bit is set.")]
HRESULT IsDigitalSignatureEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(4), helpstring("Property to check if the nonRepudiation bit is set.")]
HRESULT IsNonRepudiationEnabled([out, retval] VARIANT_BOOL *pVal);
[propget, id(5), helpstring("Property to check if the keyEncipherment bit is set.")]
HRESULT IsKeyEnciphermentEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(6), helpstring("Property to check if the dataEncipherment bit is set.")]
HRESULT IsDataEnciphermentEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(7), helpstring("Property to check if the keyAgreement bit is set.")]
HRESULT IsKeyAgreementEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(8), helpstring("Property to check if the keyCertSign bit is set.")]
HRESULT IsKeyCertSignEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(9), helpstring("Property to check if the cRLSign bit is set.")]
HRESULT IsCRLSignEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(10), helpstring("Property to check if the encipherOnly bit is set.")]
HRESULT IsEncipherOnlyEnabled([out, retval] VARIANT_BOOL * pVal);
[propget, id(11), helpstring("Property to check if the decipherOnly bit is set.")]
HRESULT IsDecipherOnlyEnabled([out, retval] VARIANT_BOOL * pVal);
};
//
// IExtendedKeyUsage
//
[
object,
uuid(7289D408-987D-45D1-8DEE-CF9E91C2E90E),
dual,
helpstring("IExtendedKeyUsage Interface"),
pointer_default(unique)
]
interface IExtendedKeyUsage : IDispatch
{
//
// Property
//
[propget, id(1), helpstring("Property to check if the EKU extension is present.")]
HRESULT IsPresent([out, retval] VARIANT_BOOL * pVal);
[propget, id(2), helpstring("Property to check if the EKU extension is marked critical.")]
HRESULT IsCritical([out, retval] VARIANT_BOOL * pVal);
[propget, id(3), helpstring("Property to return an EKUs collection object.")]
HRESULT EKUs([out, retval] IEKUs ** pVal);
};
//
// IBasicConstraints
//
[
object,
uuid(4E298C47-ABA6-459E-851B-993D6C626EAD),
dual,
helpstring("IBasicConstraints Interface"),
pointer_default(unique)
]
interface IBasicConstraints : IDispatch
{
[propget, id(1), helpstring("Property to check if the BasicConstraints extension is present.")]
HRESULT IsPresent([out, retval] VARIANT_BOOL * pVal);
[propget, id(2), helpstring("Property to check if the BasicConstraints extension is marked critical.")]
HRESULT IsCritical([out, retval] VARIANT_BOOL * pVal);
[propget, id(3), helpstring("Property to check if it is a certificate authority.")]
HRESULT IsCertificateAuthority([out, retval] VARIANT_BOOL * pVal);
[propget, id(4), helpstring("Property to check if the path length constraint value is present.")]
HRESULT IsPathLenConstraintPresent([out, retval] VARIANT_BOOL * pVal);
[propget, id(5), helpstring("Property to get the path length constraint value.")]
HRESULT PathLenConstraint([out, retval] long * pVal);
};
//
// ICertificateStatus
//
[
object,
uuid(AB769053-6D38-49D4-86EF-5FA85ED3AF27),
dual,
helpstring("ICertificateStatus Interface"),
pointer_default(unique)
]
interface ICertificateStatus : IDispatch
{
[propget, id(0), helpstring("Default property to get the certificate validity result.")]
HRESULT Result([out, retval] VARIANT_BOOL * pVal);
[propget, id(1), helpstring("Property to get validity check flag.")]
HRESULT CheckFlag([out, retval] CAPICOM_CHECK_FLAG * pVal);
[propput, id(1), helpstring("Property to set validity check flag (values can be ORed together and default check flag is CHECK_SIGNATURE_VALIDITY OR CHECK_TIME_VALIDITY OR CHECK_TRUSTED_ROOT).")]
HRESULT CheckFlag([in] CAPICOM_CHECK_FLAG newVal);
[id(2), helpstring("Method to return an IEKU object for setting extended key usage to check (default is no EKU check).")]
HRESULT EKU([out, retval] IEKU ** pVal);
};
//
// ICertificate
//
[
object,
uuid(0BBA0B86-766C-4755-A443-243FF2BD8D29),
dual,
helpstring("ICertificate Interface"),
pointer_default(unique)
]
interface ICertificate : IDispatch
{
//
// Property
//
[propget, id(1), helpstring("Property to get the version number.")]
HRESULT Version([out, retval] long * pVal);
[propget, id(2), helpstring("Property to get the serial number.")]
HRESULT SerialNumber([out, retval] BSTR * pVal);
[propget, id(3), helpstring("Property to get the subject's name.")]
HRESULT SubjectName([out, retval] BSTR * pVal);
[propget, id(4), helpstring("Property to get the issuer's name.")]
HRESULT IssuerName([out, retval] BSTR * pVal);
[propget, id(5), helpstring("Property to get the valid notBefore date.")]
HRESULT ValidFromDate([out, retval] DATE * pVal);
[propget, id(6), helpstring("Property to get the valid notAfter date.")]
HRESULT ValidToDate([out, retval] DATE * pVal);
[propget, id(7), helpstring("Property to get the SHA1 hash.")]
HRESULT Thumbprint([out, retval] BSTR * pVal);
//
// Method
//
[id(10), helpstring("Method to check if private key is available.")]
HRESULT HasPrivateKey([out, retval] VARIANT_BOOL * pVal);
[id(11), helpstring("Method to get other simple information of the certificate.")]
HRESULT GetInfo([in] CAPICOM_CERT_INFO_TYPE InfoType, [out, retval] BSTR * pVal);
[id(12), helpstring("Method to return an ICertificateStatus object for checking if the certificate is valid.")]
HRESULT IsValid([out, retval] ICertificateStatus ** pVal);
[id(13), helpstring("Method to return a KeyUsage object.")]
HRESULT KeyUsage([out, retval] IKeyUsage ** pVal);
[id(14), helpstring("Method to return an ExtendedKeyUsage object.")]
HRESULT ExtendedKeyUsage([out, retval] IExtendedKeyUsage ** pVal);
[id(15), helpstring("Method to return an BasicConstraints object.")]
HRESULT BasicConstraints([out, retval] IBasicConstraints ** pVal);
[id(16), helpstring("Method to export the certificate.")]
HRESULT Export([in, defaultvalue(CAPICOM_ENCODE_BASE64)] CAPICOM_ENCODING_TYPE EncodingType,
[out, retval] BSTR * pVal);
[id(17), helpstring("Method to import a certificate.")]
HRESULT Import([in] BSTR EncodedCertificate);
[id(18), helpstring("Method to display the certificate.")]
HRESULT Display();
};
//
// ICertificates
//
[
object,
uuid(68646716-BDA0-4046-AB82-4444BC93B84A),
dual,
helpstring("ICertificates Interface"),
pointer_default(unique)
]
interface ICertificates : IDispatch
{
//
// Property
//
[propget, id(0), helpstring("Property Item.")]
HRESULT Item([in] long Index, [out, retval] VARIANT * pVal);
[propget, id(1), helpstring("Property Count.")]
HRESULT Count([out, retval] long * pVal);
[propget, id(DISPID_NEWENUM), helpstring("Property _NewEnum."), restricted]
HRESULT _NewEnum([out, retval] LPUNKNOWN * pVal);
};
//
// IChain
//
[
object,
uuid(77F6F881-5D3A-4F2F-AEF0-E4A2F9AA689D),
dual,
helpstring("IChain Interface"),
pointer_default(unique)
]
interface IChain : IDispatch
{
[propget, id(0), helpstring("Default property to get an ordered certificates collection object representing the chain, where Item(1) represents the end certificate and Item(Count()) represents the root certificate.")]
HRESULT Certificates([out, retval] ICertificates ** pVal);
[propget, id(1), helpstring("Property to get validity status of the chain or a particular certficate. For overall chain status, specify Index of 0, otherwise specify the 1 for the end certificate, and Certificates.Count() for the root certificate.")]
HRESULT Status([in, defaultvalue(0)] long Index, [out,retval] long * pVal);
[id(2), helpstring("Method to build the certificate chain and get the overall result of the chain validity.")]
HRESULT Build([in] ICertificate * pICertificate, [out, retval] VARIANT_BOOL * pVal);
};
//
// IStore
//
[
object,
uuid(E860EF75-1B63-4254-AF47-960DAA3DD337),
dual,
helpstring("IStore Interface"),
pointer_default(unique)
]
interface IStore : IDispatch
{
[propget, id(0), helpstring("Default property to get a Certificates collection object.")]
HRESULT Certificates([out, retval] ICertificates ** pVal);
[id(1), helpstring("Method to open a store.")]
HRESULT Open([in, defaultvalue(CAPICOM_CURRENT_USER_STORE)] CAPICOM_STORE_LOCATION StoreLocation,
[in, defaultvalue("My")] BSTR StoreName,
[in, defaultvalue(CAPICOM_STORE_OPEN_READ_ONLY)] CAPICOM_STORE_OPEN_MODE OpenMode);
[id(2), helpstring("Method to add a certificate to the store.")]
HRESULT Add([in] ICertificate * pVal);
[id(3), helpstring("Method to remove a certificate from the store.")]
HRESULT Remove([in] ICertificate * pVal);
[id(4), helpstring("Method to export the store.")]
HRESULT Export([in, defaultvalue(CAPICOM_STORE_SAVE_AS_SERIALIZED)] CAPICOM_STORE_SAVE_AS_TYPE SaveAs,
[in, defaultvalue(CAPICOM_ENCODE_BASE64)] CAPICOM_ENCODING_TYPE EncodingType,
[out, retval] BSTR * pVal);
[id(5), helpstring("Method to import a store.")]
HRESULT Import([in] BSTR EncodedStore);
};
//
// IAttribute
//
[
object,
uuid(B17A8D78-B5A6-45F7-BA21-01AB94B08415),
dual,
helpstring("IAttribute Interface"),
pointer_default(unique)
]
interface IAttribute : IDispatch
{
[propget, id(0), helpstring("Default property to get attribute name.")]
HRESULT Name([out, retval] CAPICOM_ATTRIBUTE * pVal);
[propput, id(0), helpstring("Default property to set attribute name.")]
HRESULT Name([in] CAPICOM_ATTRIBUTE newVal);
[propget, id(1), helpstring("Property to get attribute value.")]
HRESULT Value([out, retval] VARIANT * pVal);
[propput, id(1), helpstring("Property to set attribute value.")]
HRESULT Value([in] VARIANT newVal);
};
//
// IAttributes
//
[
object,
uuid(6ADC653E-D5B9-422A-991A-A2B0119CEDAC),
dual,
helpstring("IAttributes Interface"),
pointer_default(unique)
]
interface IAttributes : IDispatch
{
//
// Property
//
[propget, id(0), helpstring("Property Item.")]
HRESULT Item([in] long Index, [out, retval] VARIANT * pVal);
[propget, id(1), helpstring("Property Count.")]
HRESULT Count([out, retval] long * pVal);
[propget, id(DISPID_NEWENUM), helpstring("Property _NewEnum."), restricted]
HRESULT _NewEnum([out, retval] LPUNKNOWN * pVal);
[id(2), helpstring("Method Add.")]
HRESULT Add([in] IAttribute * pVal);
[id(3), helpstring("Method Remove.")]
HRESULT Remove([in] long Val);
[id(4), helpstring("Method Clear.")]
HRESULT Clear();
};
//
// ISigner
//
[
object,
uuid(51017B88-1913-49AD-82BE-6BB7C417DCF2),
dual,
helpstring("ISigner Interface"),
pointer_default(unique)
]
interface ISigner : IDispatch
{
[propget, id(0), helpstring("Default property to get signer's certificate.")]
HRESULT Certificate([out, retval] ICertificate ** pVal);
[propput, id(0), helpstring("Default property to set signer's certificate.")]
HRESULT Certificate([in] ICertificate * newVal);
[propget, id(1), helpstring("Property to add/remove authenticated attributes.")]
HRESULT AuthenticatedAttributes([out, retval] IAttributes ** pVal);
};
//
// ISigners
//
[
object,
uuid(5A0780F8-9E6B-4BB0-BF54-87CD9627A8B4),
dual,
helpstring("ISigners Interface"),
pointer_default(unique)
]
interface ISigners : IDispatch
{
//
// Property
//
[propget, id(0), helpstring("Property Item.")]
HRESULT Item([in] long Index, [out, retval] VARIANT * pVal);
[propget, id(1), helpstring("Property Count.")]
HRESULT Count([out, retval] long * pVal);
[propget, id(DISPID_NEWENUM), helpstring("Property _NewEnum."), restricted]
HRESULT _NewEnum([out, retval] LPUNKNOWN * pVal);
};
//
// ISignedData
//
[
object,
uuid(AE9C454B-FC65-4C10-B130-CD9B45BA948B),
dual,
helpstring("ISignedData Interface"),
pointer_default(unique)
]
interface ISignedData : IDispatch
{
[propput, id(0), helpstring("Default property to set content to be signed.")]
HRESULT Content([in] BSTR newVal);
[propget, id(0), helpstring("Default property to get content to be signed.")]
HRESULT Content([out, retval] BSTR * pVal);
[propget, id(1), helpstring("Property to get all the content signers in the form of an ISigners collection object.")]
HRESULT Signers([out, retval] ISigners ** pVal);
[propget, id(2), helpstring("Method to get all certificates in the signed message.")]
HRESULT Certificates([out, retval] ICertificates ** pVal);
[id(3), helpstring("Method to sign the message.")]
HRESULT Sign([in, defaultvalue(NULL)] ISigner * pSigner,
[in, defaultvalue(0)] VARIANT_BOOL bDetached,
[in, defaultvalue(CAPICOM_ENCODE_BASE64)] CAPICOM_ENCODING_TYPE EncodingType,
[out, retval] BSTR * pVal);
[id(4), helpstring("Method to CoSign the message.")]
HRESULT CoSign([in, defaultvalue(NULL)] ISigner * pSigner,
[in, defaultvalue(CAPICOM_ENCODE_BASE64)] CAPICOM_ENCODING_TYPE EncodingType,
[out, retval] BSTR * pVal);
[id(5), helpstring("Method to verify if signature(s) in the signed message is cryptographically valid.")]
HRESULT Verify([in] BSTR SignedMessage,
[in, defaultvalue(0)] VARIANT_BOOL bDetached,
[in, defaultvalue(CAPICOM_VERIFY_SIGNATURE_AND_CERTIFICATE)] CAPICOM_SIGNED_DATA_VERIFY_FLAG VerifyFlag);
};
//
// IAlgorithm
//
[
object,
uuid(BF3D04A9-B0DA-4153-B45E-6CCFA5AC715B),
dual,
helpstring("IAlgorithm Interface"),
pointer_default(unique)
]
interface IAlgorithm : IDispatch
{
[propget, id(0), helpstring("Default property to get encryption algorithm.")]
HRESULT Name([out, retval] CAPICOM_ENCRYPTION_ALGORITHM * pVal);
[propput, id(0), helpstring("Default property to set encryption algorithm.")]
HRESULT Name([in] CAPICOM_ENCRYPTION_ALGORITHM newVal);
[propget, id(1), helpstring("Property to get encryption key length. This property is ignored for DES or 3DES.")]
HRESULT KeyLength([out, retval] CAPICOM_ENCRYPTION_KEY_LENGTH * pVal);
[propput, id(1), helpstring("Property to set encryption key length. This property is ignored for DES or 3DES.")]
HRESULT KeyLength([in] CAPICOM_ENCRYPTION_KEY_LENGTH newVal);
};
//
// Recipients
//
[
object,
uuid(A694C896-FC38-4C34-AE61-3B1A95984C14),
dual,
helpstring("IRecipients Interface"),
pointer_default(unique)
]
interface IRecipients : IDispatch
{
//
// Property
//
[propget, id(0), helpstring("Property Item.")]
HRESULT Item([in] long Index, [out, retval] VARIANT * pVal);
[propget, id(1), helpstring("Property Count.")]
HRESULT Count([out, retval] long * pVal);
[propget, id(DISPID_NEWENUM), helpstring("Property _NewEnum."), restricted]
HRESULT _NewEnum([out, retval] LPUNKNOWN * pVal);
[id(2), helpstring("Method Add.")]
HRESULT Add([in] ICertificate * pVal);
[id(3), helpstring("Method Remove.")]
HRESULT Remove([in] long Val);
[id(4), helpstring("Method Clear.")]
HRESULT Clear();
};
//
// IEnvelopedData
//
[
object,
uuid(F6CB6A20-CC18-4424-AE57-6F2AA3DC2059),
dual,
helpstring("IEnvelopedData Interface"),
pointer_default(unique)
]
interface IEnvelopedData : IDispatch
{
[propput, id(0), helpstring("Default property to set the content to be enveloped.")]
HRESULT Content([in] BSTR newVal);
[propget, id(0), helpstring("Default property to get the content to be enveloped.")]
HRESULT Content([out, retval] BSTR * pVal);
[propget, id(1), helpstring("Property to get/set the encryption algorithm.")]
HRESULT Algorithm([out, retval] IAlgorithm ** pVal);
[propget, id(2), helpstring("Property to add/remove recipients.")]
HRESULT Recipients([out, retval] IRecipients ** pVal);
[id(3), helpstring("Method to envelop the content.")]
HRESULT Encrypt([in, defaultvalue(CAPICOM_ENCODE_BASE64)] CAPICOM_ENCODING_TYPE EncodingType,
[out, retval] BSTR * pVal);
[id(4), helpstring("Method to decrypt the enveloped content.")]
HRESULT Decrypt([in] BSTR EnvelopedMessage);
};
//
// IEncryptedData
//
[
object,
uuid(C4778A66-972F-42E4-87C5-5CC16F7931CA),
dual,
helpstring("IEncryptedData Interface"),
pointer_default(unique)
]
interface IEncryptedData : IDispatch
{
[propput, id(0), helpstring("Default property to set the content to be encrypted.")]
HRESULT Content([in] BSTR newVal);
[propget, id(0), helpstring("Default property to get the content to be encrypted.")]
HRESULT Content([out, retval] BSTR * pVal);
[propget, id(1), helpstring("Property to get/set the encryption algorithm.")]
HRESULT Algorithm([out, retval] IAlgorithm ** pVal);
[id(2), helpstring("Method to set the secret used to generate the symmetric key.")]
HRESULT SetSecret([in] BSTR newVal,
[in, defaultvalue(CAPICOM_SECRET_PASSWORD)] CAPICOM_SECRET_TYPE SecretType);
[id(3), helpstring("Method to encrypt the content.")]
HRESULT Encrypt([in, defaultvalue(CAPICOM_ENCODE_BASE64)] CAPICOM_ENCODING_TYPE EncodingType,
[out, retval] BSTR * pVal);
[id(4), helpstring("Method to decrypt the encrypted content.")]
HRESULT Decrypt([in] BSTR EncryptedMessage);
};
////////////////////////////////////////////////////////////////////////////////
//
// Custom interfaces.
//
//
// ICChain
//
[
object,
uuid(02DF22F8-CF55-465d-97A8-9D6F2EF9817C),
local,
helpstring("ICChain Interface"),
pointer_default(unique)
]
interface ICChain : IUnknown
{
HRESULT GetContext([out] PCCERT_CHAIN_CONTEXT * ppChainContext);
}
//
// ICCertificate
//
[
object,
uuid(873AE377-8509-44ba-BD12-5F0723DE6656),
local,
helpstring("ICCertificate Interface"),
pointer_default(unique)
]
interface ICCertificate : IUnknown
{
HRESULT GetContext([out] PCCERT_CONTEXT * ppCertContext);
}