Add a script for generating CMC requests on Windows

Change-Id: I18192ca90a83a6e5f05fe783961c7de9db9b6d77
This commit is contained in:
Stanisław Pitucha 2016-01-19 17:04:49 +11:00 committed by Stanislaw Pitucha
parent 7f51b08ea3
commit 82cf08c78e
1 changed files with 26 additions and 0 deletions

26
tools/cmc_wrap.vbs Executable file
View File

@ -0,0 +1,26 @@
' Generate the CMC request with a hardcoded CN from the current user context
Const ContextUser = 1
const XCN_CERT_X500_NAME_STR = 3
Set fso = CreateObject ("Scripting.FileSystemObject")
Set req = CreateObject("X509Enrollment.CX509CertificateRequestCmc")
Set xreq = CreateObject("X509Enrollment.CX509CertificateRequestPkcs10")
xreq.Initialize ContextUser
xreq.Subject = CreateObject( "X509Enrollment.CX500DistinguishedName" )
xreq.Subject.Encode "CN=anchor-test.example.com", XCN_CERT_X500_NAME_STR
req.InitializeFromInnerRequest xreq
req.Encode
outFile="cmc.req"
Set objFile = fso.CreateTextFile(outFile,True)
objFile.WriteLine "-----BEGIN CERTIFICATE REQUEST-----"
objFile.WriteLine req.RawData
objFile.WriteLine "-----END CERTIFICATE REQUEST-----"
objFile.Close