Discuss this help topic in SecureBlackbox Forum


TElX509Certificate     See also     

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

Saves the private key of the certificate to the stream in NET format.


    int SaveKeyToStreamNET(System.IO.Stream Stream, string Password);

    Function SaveKeyToStreamNET(ByVal Stream As System.IO.Stream, ByVal Password As String) As Integer

    function SaveKeyToStreamNET(Stream : TStream; const Password : string) : integer;

    int32_t SaveKeyToStreamNET(TStream &Stream, const std::string &Password);
    int32_t SaveKeyToStreamNET(TStream *Stream, const std::string &Password);

    integer SaveKeyToStreamNET(TStream $Stream, string $Password)

    int saveKeyToStreamNET(TElStream Stream, String Password);
    int saveKeyToStreamNET(OutputStream Stream, String Password);


  • Stream - object to which the private key is saved
  • Password - the password to encrypt the key. If the key shouldn't be encrypted, set this parameter to empty string

Return value

    0 - if the key was successfully saved.
    Otherwise PKCS#8 error code.


    This method saves the private key to the provided stream. The private key will be saved in NET format. NET format was invented by Microsoft Corp. and is based on PKCS#8 private key format. However, it is not fully compatible with PKCS#8, so passing a buffer with raw PKCS#8 data will cause an 'invalid format' error.

Discuss this help topic in SecureBlackbox Forum