Historical Content Alert
This is a historical content for Windows NT 4.0 product and is presented for informative purposes only. All content in this directory is copyrighted and owned by Microsoft.

Visual Basic Policy Module Sample Code

The following sample code shows how to write a simple policy module in Microsoft® Visual Basic® that accepts requests only if the Subject.CommonName field is equal to "YourName".

Private const VR_INSTANT_OK as Long = 1
Private const VR_INSTANT_BAD as Long = 2 Public Function VerifyRequest( _
strConfig as BSTR, _
Context as Long, _
bNewRequest as Long, _
Flags as Long) as Integer Dim Name as String
Dim CertPolicy As CCertServerPolicy Set CertPolicy = New CCertServerPolicy Name = CertPolicy.GetRequestProperty("Subject.CommonName", PROPTYPE_STRING) If Name = "YourName" Then
VerifyRequest = VR_INSTANT_OK
VerifyRequest = VR_INSTANT_BAD
End If End Function

Share this article: