Discuss this help topic in SecureBlackbox Forum


TElX509Certificate     See also     

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

Saves the private key of the certificate to the memory buffer in NET format.


    int SaveKeyToBufferNET(out byte[] Buffer);
    int SaveKeyToBufferNET(ref byte[] Buffer, ref int Size);

    Function SaveKeyToBufferNET(Out Buffer As Byte()) As Integer
    Function SaveKeyToBufferNET(ByRef Buffer As Byte(), ByRef Size As Integer) As Integer

    function SaveKeyToBufferNET(Buffer: pointer; var Size: integer): integer;

    int32_t SaveKeyToBufferNET(void * Buffer, int32_t &Size);

    integer SaveKeyToBufferNET(TSBPointer|array of byte|string|NULL $Buffer, integer &$Size)


  • Buffer - the buffer to which the private key is saved.
  • Size - the size of the buffer to which the private key is saved. When the method returns, Size parameter contains the size of the data that were saved, or, if the buffer was too small, the size of the buffer enough to hold the data.

Return value

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


    This method saves the private key to the provided memory location of the given size. If the buffer is too small (or empty), Size parameter is set to the size which will be enough to hold the whole data. 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