EldoS
Navigation
Web site
Support
Table Of Contents

Filter: C#  VB.NET  Pascal  ActiveX  DLL 


TElX509Certificate.SaveKeyToBufferNET

TElX509Certificate     See also    


 

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

 
 

Declaration

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

[VB.NET]
    function SaveKeyToBufferNET(ByRef Buffer As Byte(), ByRef Size As Integer) As Integer

[Pascal]
    function SaveKeyToBufferNET(Buffer: pointer; var Size: integer): integer;

[VB6]
    Sub IElCertificateX6.SaveKeyToBufferNET(Buf As Variant)

[ActiveX]
    HRESULT _stdcall IElCertificateX6.SaveKeyToBufferNET([out] VARIANT * Buf);

[DLL]
    not implemented;
 
 

Parameters

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

 

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 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.

     
     

    See also:     LoadKeyFromBufferNET     LoadKeyFromStreamNET     SaveKeyToStreamNET     SaveKeyToBuffer     SaveKeyToBufferMS     SaveKeyToBufferPEM     SaveKeyToBufferPVK    

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