By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Write a string in a binary file, problem with CAPICOM

P: n/a
Hello!

My problem happens when I'm trying to write a string in DER. I'm
using the following code:

signed = SignedData.Sign(Signer, False,
CAPICOM.CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BINAR Y)

in order to get a PKCS#7 in DER. The signed is defined as string.
The problem is that I don't know how I can write this string in a binary

file. I'm using the following code:
Dim oFileStream As System.IO.StreamWriter
Dim fsn As New FileStream("C:\Prueba\Archivo1.txt" & ".p7",
FileMode.Create)
Dim w As New BinaryWriter(fsn)
' Create the writer for data.
Dim i As Integer
For i = 1 To signed.Length
w.Write(signed.Chars(i))
Next
w.Close()
fsn.Close()

But this code raises me an exception.

Can you help me, please?
Thanks in advance,
Regards,
Antonio
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Hello!

My problem happens when I'm trying to write a string in DER. I'm
using the following code:

signed = SignedData.Sign(Signer, False,
CAPICOM.CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BINAR Y)

in order to get a PKCS#7 in DER. The signed is defined as string.
The problem is that I don't know how I can write this string in a binary

file. I'm using the following code:
Dim oFileStream As System.IO.StreamWriter
Dim fsn As New FileStream("C:\Prueba\Archivo1.txt" & ".p7",
FileMode.Create)
Dim w As New BinaryWriter(fsn)
' Create the writer for data.
Dim i As Integer
For i = 1 To signed.Length
w.Write(signed.Chars(i))
Next
w.Close()
fsn.Close()

But this code raises me an exception.

Can you help me, please?
Thanks in advance,
Regards,
Antonio


User submitted from AEWNET (http://www.aewnet.com/)
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.