EldoS
Navigation
Web site
Support
Table Of Contents
View Table Of Contents | Send comments on this topic

Filter: C#  VB.NET  Pascal  ActiveX  DLL 


ElCustomCertStorage.SaveToStreamPFX

CustomCertStorage     See also    


 

Use this method in derived classes to save certificates contained in storage to stream in PFX (PKCS12) format.

 
 

Declaration

[C#]
    int SaveToStreamPFX(System.IO.Stream stream, string password, int KeyEncryptionAlgorithm, int CertEncryptionAlgorithm);
    int SaveToStreamPFX(System.IO.Stream stream, string password);

[VB.NET]
    function SaveToStreamPFX(ByVal Stream As System.IO.Stream, ByVal Password As string, ByVal KeyEncryptionAlgorithm As integer, ByVal CertEncryptionAlgorithm As integer) As Integer;
    function SaveToStreamPFX(ByVal stream As System.IO.Stream, ByVal Password As string) As Integer;

[Pascal]
    function SaveToStreamPFX(Stream: TStream; const Password: string; KeyEncryptionAlgorithm: integer; CertEncryptionAlgorithm: integer): integer;
    function SaveToStreamPFX(Stream: TStream; const Password: string): integer;

[VB6]
    not implemented;

[ActiveX]
    not implemented;

[DLL]
    not applicable;
 
 

Parameters

  • Stream - The stream to which certificates are written.
  • Password - Password to encrypt certificates
  • KeyEncryptionAlgorithm - Password-based (PBE) algorithm which should be used to encrypt private keys. If this parameter is omitted, the default algorithm is SB_ALGORITHM_PBE_SHA1_3DES.
  • CertEncryptionAlgorithm - Password-based (PBE) algorithm which should be used to encrypt certificates. If this parameter is omitted, the default algorithm is SB_ALGORITHM_PBE_SHA1_RC2_40.
 
 

Return value

    0 if certificates were successfully saved.
    PKCS12 error code otherwise.

 

Values:

Definition Value
SB_ALGORITHM_PBE_SHA1_RC4_128 0x7201
SB_ALGORITHM_PBE_SHA1_RC4_40 0x7202
SB_ALGORITHM_PBE_SHA1_3DES 0x7203
SB_ALGORITHM_PBE_SHA1_RC2_128 0x7204
SB_ALGORITHM_PBE_SHA1_RC2_40 0x7205
Declared in
[.NET] [Pascal]
Namespace: SBConstants
Assembly: SecureBlackbox
Unit: SBConstants

Note: Windows CSPs don't understand RC4/128-bit algorithm and if the certificate is exported using these algorithm, you won't be able to import it with CryptoAPI.

 
 

PKCS12 Error codes

[.NET] [Pascal] [ActiveX] [DLL] Value Description
SB_PKCS12_ERROR_INVALID_ASN_DATA 793 (0x1F01) Buffer doesn't contain a valid PFX sequence
SB_PKCS12_ERROR_NO_DATA 7938 (0x1F02) The PFX message doesn't contain any certificate
SB_PKCS12_ERROR_INVALID_DATA 7939 (0x1F03) Some parameters of PFX message are invalid
SB_PKCS12_ERROR_INVALID_VERSION 7940 (0x1F04) PFX message version is invalid
SB_PKCS12_ERROR_INVALID_CONTENT 7941 (0x1F05) PFX message contains invalid content
SB_PKCS12_ERROR_INVALID_AUTHENTICATED_SAFE_DATA 7942 (0x1F06) AuthenticatedSafe part of PFX message is invalid
SB_PKCS12_ERROR_INVALID_MAC_DATA 7943 (0x1F07) MAC part of PFX message PFX message is invalid
SB_PKCS12_ERROR_INVALID_SAFE_CONTENTS 7944 (0x1F08) The entity located in PFX message has invalid content type.
SB_PKCS12_ERROR_INVALID_SAFE_BAG 7945 (0x1F09) The entity located in PFX message has invalid format
SB_PKCS12_ERROR_INVALID_SHROUDED_KEY_BAG 7946 (0x1F0A) The private key contained in PFX message has invalid format
SB_PKCS12_ERROR_UNKNOWN_PBE_ALGORITHM 7947 (0x1F0B)
  • Saving: invalid PBE algorithm specified
  • Loading: unknown PBE algorithm was used to encrypt the message.
  • SB_PKCS12_ERROR_INTERNAL_ERROR 7948 (0x1F0C) Internal error occured. Please contact EldoS support for details.
    SB_PKCS12_ERROR_INVALID_PBE_ALGORITHM_PARAMS 7949 (0x1F0D) PBE algorithm params (iteration count and salt) are invalid
    SB_PKCS12_ERROR_INVALID_CERT_BAG 7950 (0x1F0E) The certificate contained in PFX message has invalid format
    SB_PKCS12_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 7951 (0x1F0F) The certificate contained in PFX message has unsupported type
    SB_PKCS12_ERROR_INVALID_PRIVATE_KEY 7952 (0x1F10) The private key contained in PFX message has invalid format
    SB_PKCS12_ERROR_INVALID_MAC 7953 (0x1F11) MAC verification failed
    SB_PKCS12_ERROR_NO_CERTIFICATES 7954 (0x1F12) Saving: nothing to save
    SB_PKCS12_ERROR_INVALID_PASSWORD 7955 (0x1F13) Invalid password was specified. Can not decrypt certificate.
    SB_PKCS12_ERROR_BUFFER_TOO_SMALL 7956 (0x1F14) Buffer doesn't have enough space to store encoded certificate
    Declared in
    [.NET] [Pascal]
    Namespace: SBPKCS12
    Assembly: SecureBlackbox
    Unit: SBPKCS12

     
     

    Description

        Use this method in derived classes to save currently stored certificates in PFX format. PFX format supports storing of private keys.

     
     

    See also:     LoadFromBufferPFX LoadFromStreamPFX SaveToBufferPFX

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