Discuss this help topic in SecureBlackbox Forum

TElX509Certificate.LoadKeyFromBufferNET

TElX509Certificate     See also     


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


Loads the certificate's private key from the memory buffer. The key must be stored in NET format.

Declaration

[C#]
    int LoadKeyFromBufferNET(byte[] Buffer, string Password);
    int LoadKeyFromBufferNET(byte[] Buffer, int StartIndex, int Count, string Password);

[VB.NET]
    Function LoadKeyFromBufferNET(ByVal Buffer As Byte(), ByVal Password As String) As Integer
    Function LoadKeyFromBufferNET(ByVal Buffer As Byte(), ByVal StartIndex As Integer, ByVal Count As Integer, ByVal Password As String) As Integer

[Pascal]
    function LoadKeyFromBufferNET(Buffer: pointer; Size: integer; const Password: string): integer;

[C++]
    int32_t LoadKeyFromBufferNET(void * Buffer, int32_t Size, const std::string &Password);

[PHP]
    integer LoadKeyFromBufferNET(TSBPointer|array of byte|string|NULL $Buffer, integer $Size, string $Password)

[Java]
    int loadKeyFromBufferNET(byte[] Buffer, String Password);
    int loadKeyFromBufferNET(byte[] Buffer, int StartIndex, int Count, String Password);

Parameters

  • Buffer - the buffer from which the key is loaded.
  • Size - the size of the buffer from which the data is loaded.
  • Password - The password to decrypt the private key. If the key is not encrypted, set this parameter to empty string
  • StartIndex - position in the Buffer from which the data must be read
  • Count - amount of bytes to be read from start position

Return value

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

Description

    This method attempts to read the certificate's private key from the provided memory location of the given size. The key must have been 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