EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Index out of Range on Generate from Request

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#6874
Posted: 07/08/2008 10:22:42
by Alex Rogers (Priority Standard support level)
Joined: 07/08/2008
Posts: 6

I am using PKI Black box to generate Certificates. I have been successfull at generating a self Signed CA certificate and also successfull at generating a certificate based on the CA Certificate.

I am now trying to generate a certificate based on a certificate request generated from a web server. I am getting "Index was outside the bounds of the array." on the call to generate. I can find no sample in the help files for what I am trying to do.


Relevant code:

str As New System.IO.FileStream("request path", FileMode.Open)
request.LoadFromStream(reqstr, reqstr.Length)
nname = request.Subject

request.ValidateSignature()

CACert = New SBX509.TElX509Certificate(Nothing)

Dim fs As New FileStream("root path", FileMode.Open)

Dim ms As New MemoryStream
Dim b As Integer = fs.ReadByte

Do While b <> -1
ms.WriteByte(CByte(b))
b = fs.ReadByte
Loop

fs.Close()
fs = Nothing
ms.Capacity = CType(ms.Length, Integer)
ms.Close()
bufCA = ms.GetBuffer()
ms = Nothing

CACert.LoadFromBuffer(bufCA)


'load private key here
fs = New FileStream("private key path", FileMode.Open)
Dim length As Integer
length = fs.Length

CACert.LoadKeyFromStream(fs, length)


CACert.ValidTo = Now.AddYears(2)
CACert.ValidFrom = Now

CACert.Extensions.KeyUsage.DigitalSignature = True

Dim CreatedCert As SBX509.TElX509Certificate
CreatedCert = New SBX509.TElX509Certificate(Nothing)

CACert.Generate(request, CreatedCert)
#6875
Posted: 07/08/2008 10:38:47
by Eugene Mayevski (EldoS Corp.)

What exactly build of SecureBlaackbox are you using? CSR-based certificate generation got broken in build 143 and fixed in build 144.


Sincerely yours
Eugene Mayevski
#6876
Posted: 07/08/2008 10:50:36
by Alex Rogers (Priority Standard support level)
Joined: 07/08/2008
Posts: 6

version 6.0.143 is what my history of changes doc says. I downloaded the eval copy from the website. Has that been updated?
#6879
Posted: 07/08/2008 11:13:34
by Alex Rogers (Priority Standard support level)
Joined: 07/08/2008
Posts: 6

I have upgraded to version version 6.0.144. I am still having the problem.
#6882
Posted: 07/08/2008 11:37:06
by Alex Rogers (Priority Standard support level)
Joined: 07/08/2008
Posts: 6

got it figured out. The subject of my request was not complete. Thanks for the help.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 1624 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!