EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Cryptographic Message Syntax Standar ---PKCS7

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#6286
Posted: 05/16/2008 02:07:35
by  xu cong
Hi,
How is it Certificate Change into Cryptographic Message Syntax Standard(Base64 form )?
#6287
Posted: 05/16/2008 02:21:54
by Ken Ivanov (EldoS Corp.)

Sorry, I do not understand your question. If I am guessing it right, the certificate can be saved to alternative formats using various SaveToStreamXXX methods (where XXX is PEM, PFX and SPC).
#6290
Posted: 05/16/2008 05:37:40
by  xu cong
I am sorry, have not clearly expressed the question.
I'm using SaveToBufferSPC methods.But return result is binary format.
I want return Base64 format.
#6292
Posted: 05/16/2008 09:24:42
by Ken Ivanov (EldoS Corp.)

Please use SBPEM.Encode() method to encode binary PKCS7 to Base64-encoded PKCS7.
#6339
Posted: 05/21/2008 02:46:27
by  xu cong
This is my using SaveToBufferSPC methods. But the result does not have Root_CA.cer information.Is my operation method wrong?
Code
...
            TElX509Certificate TELX509 = new TElX509Certificate();
            TElCustomCertStorage Cert = null;
            byte[] pkcs7;

            FileStream CAstream = File.OpenRead(Server.MapPath("CA/Root_CA.cer"));
            FileStream readStream = File.OpenRead(Server.MapPath("certificate/certificate.cer"));

            TELX509.LoadFromStream(CAstream,0);            
            TELX509.LoadFromStreamPEM(readStream, "", 0);
            TELX509.SaveToBufferSPC(out pkcs7);
...
#6340
Posted: 05/21/2008 02:57:31
by Ken Ivanov (EldoS Corp.)

Please use TElMemoryCertStorage.SaveToBufferPKCS7() method to save more than one certificate to the same PKCS7 file. I.e., the code should look like the following:

// loading certificates
TElMemoryCertStorage storage = new TElMemoryCertStorage();
TELX509.LoadFromStream(CA­stream,0);
storage.Add(TELX509);
TELX509.LoadFromStream­PEM(readStream, "", 0);
storage.Add(TELX509);
// saving storage to buffer
byte[] pkcs7 = null;
int size = 0;
storage.SaveToBufferPKCS7(ref pkcs7, ref size);
pkcs7 = new byte[size];
storage.SaveToBufferPKCS7(ref pkcs7, ref size);
pkcs7 = SBUtils.Unit.CloneBuffer(pkcs7, 0, size);
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 1949 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!