CryptoSys PKI examples VB6 to VB.NET

X509_MakeCRL

Creates an X.509 Certificate Revocation List (CRL).

VB6/VBA

Debug.Print "Testing X509_MakeCRL ..."
Dim nRet As Long
Dim strCrlFile As String
Dim strIssuerFile As String
Dim strKeyFile As String
Dim strPassword As String
Dim strCertList As String
Dim strExtension As String
' Create a new CRL dated with the current system time
strCrlFile = "CarlsNew.crl"
strIssuerFile = "CarlRSASelf.cer"
strKeyFile = "CarlPrivRSASign.epk"
' CAUTION: DO NOT HARD-CODE REAL PASSWORDS!
strPassword = "password"
strCertList = "1,2007-12-31, 2, 2009-12-31T12:59:59Z, 66000,2066-01-01, #x0102deadbeef,2010-02-28T01:01:59"
nRet = X509_MakeCRL(strCrlFile, strIssuerFile, strKeyFile, strPassword, strCertList, "", 0)
Debug.Print "X509_MakeCRL returns " & nRet & " (expected 0)"
If (nRet = 0) Then
  Debug.Print "SUCCESS: New CRL file '" & strCrlFile & "' created."
Else
  Debug.Print "ERROR: " & pkiErrorLookup(nRet) & ": " & pkiGetLastError()
End If
' Create another CRL using specified times (NB these are GMT times, not local)
strExtension = "thisUpdate=2010-04-01T12:00,nextUpdate=2010-05-01"
strCrlFile = "Carl_20100401.crl"
nRet = X509_MakeCRL(strCrlFile, strIssuerFile, strKeyFile, strPassword, strCertList, strExtension, 0)
Debug.Print "X509_MakeCRL returns " & nRet & " (expected 0)"
If (nRet = 0) Then
  Debug.Print "SUCCESS: New CRL file '" & strCrlFile & "' created."
Else
  Debug.Print "ERROR: " & pkiErrorLookup(nRet) & ": " & pkiGetLastError()
End If

Output

Testing X509_MakeCRL ...
X509_MakeCRL returns 0 (expected 0)
SUCCESS: New CRL file 'CarlsNew.crl' created.
X509_MakeCRL returns 0 (expected 0)
SUCCESS: New CRL file 'Carl_20100401.crl' created.

VB.NET

Console.WriteLine("Testing X509_MakeCRL ...")
Dim nRet As Integer
Dim strCrlFile As String
Dim strIssuerFile As String
Dim strKeyFile As String
Dim strPassword As String
Dim strCertList As String
Dim strExtension As String
' Create a new CRL dated with the current system time
strCrlFile = "CarlsNew.crl"
strIssuerFile = "CarlRSASelf.cer"
strKeyFile = "CarlPrivRSASign.epk"
' CAUTION: DO NOT HARD-CODE REAL PASSWORDS!
strPassword = "password"
strCertList = "1,2007-12-31, 2, 2009-12-31T12:59:59Z, 66000,2066-01-01, #x0102deadbeef,2010-02-28T01:01:59"
nRet = X509.MakeCRL(strCrlFile, strIssuerFile, strKeyFile, strPassword, strCertList, "", 0)
Console.WriteLine("X509_MakeCRL returns " & nRet & " (expected 0)")
If (nRet = 0) Then
    Console.WriteLine("SUCCESS: New CRL file '" & strCrlFile & "' created.")
Else
    Console.WriteLine("ERROR: " & General.ErrorLookup(nRet) & ": " & General.LastError())
End If
' Create another CRL using specified times (NB these are GMT times, not local)
strExtension = "thisUpdate=2010-04-01T12:00,nextUpdate=2010-05-01"
strCrlFile = "Carl_20100401.crl"
nRet = X509.MakeCRL(strCrlFile, strIssuerFile, strKeyFile, strPassword, strCertList, strExtension, 0)
Console.WriteLine("X509_MakeCRL returns " & nRet & " (expected 0)")
If (nRet = 0) Then
    Console.WriteLine("SUCCESS: New CRL file '" & strCrlFile & "' created.")
Else
    Console.WriteLine("ERROR: " & General.ErrorLookup(nRet) & ": " & General.LastError())
End If

[Contents]

[HOME]   [NEXT: X509_TextDump...]

Copyright © 2010-20 D.I. Management Services Pty Ltd. All rights reserved.