//+--------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1996 - 1999
//
// File:        certadm.idl
//
// Contents:    IDL source for certadm.dll
//
//---------------------------------------------------------------------------

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

import "wtypes.idl";
import "certview.idl";

//+--------------------------------------------------------------------------
// ICertAdmin::IsValidCertificate() returned Disposition:

const LONG CA_DISP_INCOMPLETE =		0x00000000; // call did not complete
const LONG CA_DISP_ERROR =		0x00000001; // call failed
const LONG CA_DISP_REVOKED =		0x00000002; // cert revoked
const LONG CA_DISP_VALID =		0x00000003; // cert still valid
const LONG CA_DISP_INVALID =		0x00000004; // cert never issued
const LONG CA_DISP_UNDER_SUBMISSION =   0x00000005; // taken under submission

//+--------------------------------------------------------------------------
// ICertAdmin::GetCAProperty(CR_PROP_KRACERTSTATE) returned Disposition:

const LONG KRA_DISP_EXPIRED =		0x00000000; // cert expired
const LONG KRA_DISP_NOTFOUND =		0x00000001; // cert not found
const LONG KRA_DISP_REVOKED =		0x00000002; // cert revoked
const LONG KRA_DISP_VALID =		0x00000003; // cert valid
const LONG KRA_DISP_INVALID =		0x00000004; // cert invalid
const LONG KRA_DISP_UNTRUSTED =		0x00000005; // cert untrusted
const LONG KRA_DISP_NOTLOADED = 	0x00000006; // cert not loaded


// Cert server roles
const LONG CA_ACCESS_ADMIN      =   0x00000001; // CA administrator
const LONG CA_ACCESS_OFFICER    =   0x00000002; // certificate officer
const LONG CA_ACCESS_AUDITOR    =   0x00000004; // auditor
const LONG CA_ACCESS_OPERATOR   =   0x00000008;	// backup operator
const LONG CA_ACCESS_MASKROLES  =   0x000000ff;

// Cert server read/enroll access
const LONG CA_ACCESS_READ       =   0x00000100; // read only access to CA
const LONG CA_ACCESS_ENROLL     =   0x00000200; // enroll access to CA

// do not publish this, reserved for internal use
// const LONG CA_ACCESS_LOCALADMIN = 0x00008000; // builtin administrator
// const LONG CA_ACCESS_DENIED     = 0x00004000; // force an access denied

//+--------------------------------------------------------------------------
// ICertAdmin -- local COM interface, implementation uses DCOM
//+--------------------------------------------------------------------------

[
    object,
    uuid(34df6950-7fb6-11d0-8817-00a0c903b83c),
    dual,
    helpstring("ICertAdmin Interface"),
    pointer_default(unique)
]

interface ICertAdmin: IDispatch
{
    import "oaidl.idl";

    HRESULT IsValidCertificate(
		[in] BSTR const strConfig,
		[in] BSTR const strSerialNumber,
		[out, retval] LONG *pDisposition);

    HRESULT GetRevocationReason(
		[out, retval] LONG *pReason);

    HRESULT RevokeCertificate(
		[in] BSTR const strConfig,
		[in] BSTR const strSerialNumber,
		[in] LONG Reason,
		[in] DATE Date);

    HRESULT SetRequestAttributes(
		[in] BSTR const strConfig,
		[in] LONG RequestId,
		[in] BSTR const strAttributes);

    HRESULT SetCertificateExtension(
		[in] BSTR const strConfig,
		[in] LONG RequestId,
		[in] BSTR const strExtensionName,
		[in] LONG Type,
		[in] LONG Flags,
		[in] VARIANT const *pvarValue);

    HRESULT DenyRequest(
		[in] BSTR const strConfig,
		[in] LONG RequestId);

    HRESULT ResubmitRequest(
		[in] BSTR const strConfig,
		[in] LONG RequestId,
		[out, retval] LONG *pDisposition);

    HRESULT PublishCRL(
		[in] BSTR const strConfig,
		[in] DATE Date);

    // See certcli.idl/certcli.h for CR_OUT_* Flags.

    HRESULT GetCRL(
		[in] BSTR const strConfig,
		[in] LONG Flags,		// CR_OUT_*
		[out, retval] BSTR *pstrCRL);

    HRESULT ImportCertificate(
		[in] BSTR const strConfig,
		[in] BSTR const strCertificate,
		[in] LONG Flags,	// ICF_* | (CR_IN_ENCODEMASK & CR_IN_*)
		[out, retval] LONG *pRequestId);
};


const LONG CA_CRL_BASE =	0x00000001; // base CRL
const LONG CA_CRL_DELTA =	0x00000002; // delta CRL
const LONG CA_CRL_REPUBLISH =	0x00000010; // Republish CRL(s) only

const LONG ICF_ALLOWFOREIGN =	0x00010000; // allow foreign cert, key

const LONG IKF_OVERWRITE =	0x00010000; // allow overwriting key

const LONG CDR_EXPIRED =		1;	// expired certs, CRLs
const LONG CDR_REQUEST_LAST_CHANGED =	2;	// request last update

//+--------------------------------------------------------------------------
// ICertAdmin2 -- local COM interface, implementation uses DCOM
//+--------------------------------------------------------------------------

[
    object,
    uuid(f7c3ac41-b8ce-4fb4-aa58-3d1dc0e36b39),
    dual,
    helpstring("ICertAdmin2 Interface"),
    pointer_default(unique)
]

interface ICertAdmin2: ICertAdmin
{
    HRESULT PublishCRLs(
		[in] BSTR const strConfig,
		[in] DATE Date,
		[in] LONG CRLFlags);		// CA_CRL_*

    // See certcli.idl/certcli.h for CR_PROP_* and CR_OUT_*.

    HRESULT GetCAProperty(
		[in] BSTR const strConfig,
		[in] LONG PropId,		// CR_PROP_*
		[in] LONG PropIndex,
		[in] LONG PropType,		// PROPTYPE_*
		[in] LONG Flags,		// CR_OUT_*
		[out, retval] VARIANT *pvarPropertyValue);

    HRESULT SetCAProperty(
		[in] BSTR const strConfig,
		[in] LONG PropId,		// CR_PROP_*
		[in] LONG PropIndex,
		[in] LONG PropType,		// PROPTYPE_*
		[in] VARIANT *pvarPropertyValue);

    HRESULT GetCAPropertyFlags(
		[in] BSTR const strConfig,
		[in] LONG PropId,		// CR_PROP_*
		[out, retval] LONG *pPropFlags); // PROPTYPE_* | PROPFLAGS_*

    HRESULT GetCAPropertyDisplayName(
		[in] BSTR const strConfig,
		[in] LONG PropId,		// CR_PROP_*
		[out, retval] BSTR *pstrDisplayName);

    HRESULT GetArchivedKey(
		[in] BSTR const strConfig,
		[in] LONG RequestId,
		[in] LONG Flags,		// CR_OUT_*
		[out, retval] BSTR *pstrArchivedKey);

    HRESULT GetConfigEntry(
		[in] BSTR const strConfig,
		[in] BSTR const strNodePath,
		[in] BSTR const strEntryName,
		[out, retval] VARIANT *pvarEntry);

    HRESULT SetConfigEntry(
		[in] BSTR const strConfig,
		[in] BSTR const strNodePath,
		[in] BSTR const strEntryName,
		[in] VARIANT *pvarEntry);

    HRESULT ImportKey(
		[in] BSTR const strConfig,
		[in] LONG RequestId,		// -1: use strCertHash
		[in] BSTR const strCertHash,	// OPTIONAL
		[in] LONG Flags,	// IKF_* | (CR_IN_ENCODEMASK & CR_IN_*)
		[in] BSTR const strKey);

    HRESULT GetMyRoles(
		[in] BSTR const strConfig,
		[out, retval] LONG *pRoles); // CA_ACCESS_*

    HRESULT DeleteRow(
		[in] BSTR const strConfig,
		[in] LONG Flags,		// CDR_*
		[in] DATE Date,
		[in] LONG Table,		// CVRC_TABLE_*
		[in] LONG RowId,
		[out, retval] LONG *pcDeleted);
};


//+--------------------------------------------------------------------------
// certadm Type library
//+--------------------------------------------------------------------------

[
    uuid(35de99a0-7fb6-11d0-8817-00a0c903b83c),
    version(1.0),
    helpstring("CertAdm 1.0 Type Library")
]

library CERTADMINLib
{
    importlib("stdole2.tlb");

    //------------------------------------------------
    // CCertAdmin
    [
	uuid(37eabaf0-7fb6-11d0-8817-00a0c903b83c),
	helpstring("CertAdmin Class")
    ]
    coclass CCertAdmin
    {
	[default] interface ICertAdmin2;
    };

    //------------------------------------------------
    // CCertView
    [
	uuid(a12d0f7a-1e84-11d1-9bd6-00c04fb683fa),
	helpstring("CertView Class")
    ]
    coclass CCertView
    {
	[default] interface ICertView2;
    };
};
