467,894 Members | 1,709 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,894 developers. It's quick & easy.

Write a string in a binary file, problem with CAPICOM

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
  • viewed: 1851
Share:
1 Reply

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.

Similar topics

reply views Thread by John | last post: by
2 posts views Thread by stéphane bard | last post: by
13 posts views Thread by zach | last post: by
6 posts views Thread by aagarwal8 | last post: by
1 post views Thread by =?Utf-8?B?U3RldmVU?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.