//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//
//  Copyright (C) Microsoft Corporation, 1998 - 1999
//
//  File:       scrdenrl.idl
//
//--------------------------------------------------------------------------

// scrdenrl.idl : IDL source for scrdenrl.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (scrdenrl.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

[
    object,
    uuid(80CB7886-20DE-11D2-8D5C-00C04FC29D45),
    dual,
    helpstring("ISCrdEnr Interface"),
    pointer_default(unique)
]
interface ISCrdEnr : IDispatch
{
    [propget]
    HRESULT CSPCount(
        [out, retval] long *pVal);

    [propget]
    HRESULT CSPName(
        [out, retval] BSTR *pVal);

    [propput]
    HRESULT CSPName(
        [in] BSTR newVal);

    HRESULT selectUserName(
        [in] DWORD dwFlags);

    HRESULT enroll(
        [in] DWORD  dwFlags);

    HRESULT getEnrolledCertificateName(
        [in]          DWORD  dwFlags,
        [retval][out] BSTR  *pBstrCertName );

    HRESULT selectSigningCertificate(
        [in] DWORD dwFlags,
        [in] BSTR  bstrCertTemplateName);

    HRESULT resetUser();

    HRESULT enumCSPName(
        [in]          DWORD dwIndex,
        [in]          DWORD dwFlags,
        [retval][out] BSTR *pbstrCSPName);

    HRESULT enumCertTemplateName(
        [in] DWORD          dwIndex,
        [in] DWORD          dwFlags,
        [retval][out] BSTR *pbstrCertTemplateName);

    HRESULT getCACount(
        [in]          BSTR  bstrCertTemplateName,
        [retval][out] long *pdwCACount);

    HRESULT getCAName(
        [in]          DWORD dwFlags,
        [in]          BSTR  bstrCertTemplateName,
        [retval][out] BSTR *pbstrCAName);

    HRESULT setCAName(
        [in] DWORD dwFlags,
        [in] BSTR  bstrCertTemplateName,
        [in] BSTR  bstrCAName);

    HRESULT enumCAName(
        [in]          DWORD dwIndex,
        [in]          DWORD dwFlags,
        [in]          BSTR  bstrCertTemplateName,
        [retval][out] BSTR *pbstrCAName);

    HRESULT getSigningCertificateName(
        [in]          DWORD dwFlags,
        [retval][out] BSTR *pbstrSigningCertName);

    HRESULT getUserName(
        [in]          DWORD dwFlags,
        [retval][out] BSTR *pbstrUserName);

    HRESULT setUserName(
        [in] DWORD dwFlags,
        [in] BSTR  bstrUserName);

    HRESULT setSigningCertificate(
        [in] DWORD dwFlags,
        [in] BSTR  bstrCertTemplateName);

    HRESULT getCertTemplateCount(
        [in]          DWORD dwFlags,
        [retval][out] long *pdwCertTemplateCount);

    HRESULT getCertTemplateName(
        [in]          DWORD dwFlags,
        [retval][out] BSTR *pbstrCertTemplateName);

    HRESULT setCertTemplateName(
        [in] DWORD dwFlags,
        [in] BSTR  bstrCertTemplateName);

    [propget]
    HRESULT EnrollmentStatus(
        [out, retval] LONG *plEnrollStatus);

    HRESULT getCertTemplateInfo(
        [in]          BSTR     bstrCertTemplateName,
        [in]          LONG     lType,
        [retval][out] VARIANT *pvarCertTemplateInfo);
};

[
    uuid(80CB7877-20DE-11D2-8D5C-00C04FC29D45),
    version(1.0),
    helpstring("scrdenrl 1.0 Type Library")
]
library SCRDENRLLib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	[
		uuid(80CB7887-20DE-11D2-8D5C-00C04FC29D45),
		helpstring("SCrdEnr Class")
	]
	coclass SCrdEnr
	{
		[default] interface ISCrdEnr;
	};
};

//flags for both getCertTemplateCount and enumCertTemplateName
// By default, all cert template will be returned.
// SCARD_ENROLL_CERT_TEMPLATE_DISPLAY_NAME is for enumCertTemplateName
// by default, the name parameter will be the certificate template's real name
cpp_quote("#define  SCARD_ENROLL_USER_CERT_TEMPLATE 		0x01")
cpp_quote("#define  SCARD_ENROLL_MACHINE_CERT_TEMPLATE		0x02")
cpp_quote("#define  SCARD_ENROLL_CERT_TEMPLATE_DISPLAY_NAME	0x04")
cpp_quote("#define  SCARD_ENROLL_ENTERPRISE_CERT_TEMPLATE	0x08")
cpp_quote("#define  SCARD_ENROLL_OFFLINE_CERT_TEMPLATE		0x10")
cpp_quote("#define  SCARD_ENROLL_CROSS_CERT_TEMPLATE		0x20")

//flags for setCAName, getCAName, and enumCAName
// SCARD_ENROLL_CA_MACHINE_NAME treats the name as the CA's machine name.  
// SCARD_ENROLL_CA_UNIQUE_NAMEwill treats the name as the CA's unique name.
// ie, the machinename\realName
// by default, the name parameter will be the CA's real name.  
cpp_quote("#define  SCARD_ENROLL_CA_MACHINE_NAME	0x01")
cpp_quote("#define  SCARD_ENROLL_CA_DISPLAY_NAME	0x02")
cpp_quote("#define  SCARD_ENROLL_CA_UNIQUE_NAME		0x03")


// flags for getSigningCertificateName, getEnrolledCertificateName
// If this flag is set, we will not diaplay the certiifcate common dialogue.
cpp_quote("#define  SCARD_ENROLL_NO_DISPLAY_CERT	0x01")

// flag for setUserName and getUserName.  This flag will allow setUserName
// and getUserName to treat the name parameter as the user's UPN name.
// By default, the name parameter will be the user's SAM compatible name
cpp_quote("#define  SCARD_ENROLL_UPN_NAME		0x01")

//flags for getCertTemplateInfo
cpp_quote("#define  SCARD_CTINFO_KEYSPEC            0x01")
cpp_quote("#define  SCARD_CTINFO_KEYFLAGS           0x02")
cpp_quote("#define  SCARD_CTINFO_EXT_OID            0x03")
cpp_quote("#define  SCARD_CTINFO_EXT_MAJOR          0x04")
cpp_quote("#define  SCARD_CTINFO_EXT_MINOR          0x05")
cpp_quote("#define  SCARD_CTINFO_EXT_MINOR_FLAG     0x06")
cpp_quote("#define  SCARD_CTINFO_SUBJECTFLAG        0x07")
cpp_quote("#define  SCARD_CTINFO_CSPLIST_FIRST      0x08")
cpp_quote("#define  SCARD_CTINFO_CSPLIST_NEXT       0x09")
cpp_quote("#define  SCARD_CTINFO_GENERALFLAGS       0x0A")
cpp_quote("#define  SCARD_CTINFO_ENROLLMENTFLAGS    0x0B")
cpp_quote("#define  SCARD_CTINFO_PRIVATEKEYFLAGS    0x0C")
cpp_quote("#define  SCARD_CTINFO_RA_SIGNATURES      0x0D")

//flags for selectSigningCertificate
cpp_quote("#define  SCARD_SELECT_TEMPLATENAME       0x0")
cpp_quote("#define  SCARD_SELECT_EKU                0x1")