Discuss this help topic in SecureBlackbox Forum

Load certificate request from stream

Typically you will only need to load someone's certificate request from a binary form if you are a CA and you intend to generate a certificate from the request. This is done in the following way:


// Creating a request object
TElCertificateRequest req = new TElCertificateRequest();

// Opening a file containing the request
FileStream f = new FileStream("cert.req", FileMode.Open);
try
{
  req.LoadFromStream(f, 0);
}
finally
{
  // We may close the file immediately after the request has been loaded, its contents is copied to the object
  f.Close();
}
The second parameter tells the component how many bytes from the stream it should read. Zero value means that the stream can be read until its end.

If the received certificate request is in PEM format (base64-encoded data with headers) it can be loaded with the LoadFromStreamPEM() method instead, which works in exactly the same way.

How To articles about certificate requests

Discuss this help topic in SecureBlackbox Forum