Discuss this help topic in SecureBlackbox Forum

TElX509Certificate.LoadKeyFromStreamAuto

TElX509Certificate     See also     


Filter: C#/Java  VB.NET  Pascal  C++  PHP  


Reads the certificate's private key from the stream.

Declaration

[C#/Java]
    int LoadKeyFromStreamAuto(System.IO.Stream Stream, string Password, int Count);

[VB.NET]
    Function LoadKeyFromStreamAuto(ByVal Stream As System.IO.Stream, ByVal Password As String, ByVal Count As Integer) As Integer

[Pascal]
    function LoadKeyFromStreamAuto(Stream : TStream; const Password : string; Count : integer) : integer;

[C++]
    int32_t LoadKeyFromStreamAuto(TStream &Stream, const std::string &Password, int32_t Count);
    int32_t LoadKeyFromStreamAuto(TStream *Stream, const std::string &Password, int32_t Count);

[PHP]
    integer LoadKeyFromStreamAuto(TStream $Stream, string $Password, integer $Count)

Parameters

  • Stream - The stream from which the private key is loaded.
  • Count - Optional parameter that specified the number of bytes to be read. If this parameter is zero, the whole stream (from current position till the end) is read.
  • Password - The password to decrypt the private key. If the key is not encrypted, set this parameter to empty string

Return value

    0 on success.
    Error code otherwise.
    If the format of the certificate is not recognized, SB_X509_ERROR_UNRECOGNIZED_FORMAT (0x5009) error is reported.

Description

    This method attempts to read the certificate's private key from the stream. It recognizes the format automatically; if the format is not recognized, SB_X509_ERROR_UNRECOGNIZED_FORMAT (0x5009) error is reported. The supported formats are: DER, PEM, PFX, PVK, NET, PKCS#8.

See also:     LoadKeyFromBufferAuto     LoadKeyFromFileAuto    

Discuss this help topic in SecureBlackbox Forum