EldoS
Navigation
Web site
Support
Table Of Contents

Filter: C#  VB.NET  Pascal  ActiveX  DLL 


TElX509Certificate.LoadKeyFromBufferNET

TElX509Certificate     See also    


 

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;

[VB6]
    Sub IElCertificateX6.LoadKeyFromBufferNET(Data As Variant, Password As String)

[ActiveX]
    HRESULT _stdcall IElCertificateX6.LoadKeyFromBufferNET([in] VARIANT Data, [in] BSTR Password);

[DLL]
    not implemented;
 
 

Parameters

  • Buffer (Data) - 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.

 
 

PKCS#8 Error Codes

[.NET] [Pascal] Value Description
SB_PKCS8_ERROR_OK 0 (0x0000) no errors
SB_PKCS8_ERROR_INVALID_ASN_DATA 8961 (0x2301) Invalid ASN.1 data
SB_PKCS8_ERROR_INVALID_FORMAT 8962 (0x2302) The key is not correct PKCS#8 key
SB_PKCS8_ERROR_UNSUPPORTED_ALGORITHM 8963 (0x2303)
  • Saving: invalid NET algorithm specified
  • Loading: unknown NET algorithm was used to encrypt the message.
  • SB_PKCS8_ERROR_INVALID_PASSWORD 8964 (0x2304) Invalid password was specified. Can not decrypt certificate.
    SB_PKCS8_ERROR_INVALID_VERSION 8965 (0x2305) NET message version is invalid
    SB_PKCS8_ERROR_INVALID_PARAMETER 8966 (0x2306) Invalid key parameter (for example wrong length of encryption key)
    SB_PKCS8_ERROR_UNKNOWN 8967 (0x2307) Unknown or internal error.
    SB_PKCS8_ERROR_BUFFER_TOO_SMALL 8968 (0x2308) Buffer doesn't have enough space to store encoded certificate
    Declared in
    [.NET] [Pascal]
    Namespace: SBPKCS8
    Assembly: SecureBlackbox
    Unit: SBPKCS8

     
     

    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.

     
     

    See also:     LoadKeyFromBufferAuto     LoadKeyFromBuffer     LoadKeyFromBufferMS     LoadKeyFromStreamNET     SaveKeyToBufferNET     SaveKeyToStreamNET     LoadKeyFromBufferPEM     LoadKeyFromBufferPVK    

     
    Contact Us | Terms of Use | Trademarks | Privacy Statement
    Copyright (c) 1998-2012, EldoS Corporation