473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
1 2021

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John | last post by:
Hello, I am trying to create a dll that has a capicom reference in it. After I do the following: Dim message As New CAPICOM.EncryptedData I recompile my dll. I don't receive any errors or...
2
by: stéphane bard | last post by:
Hi all, Has anyone ever used Python to work with Certificate Services in Windows? I'm trying to capicom dll with pywin32. I've found some reference about python and capicom in this mail...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
0
by: BrophyJeff | last post by:
I am putting together a system that uses Authenticode to verify that critical files are not tampered with. This is one of the purposes for Authenticode. At run-time, I use CAPICOM to verify that...
0
by: yxq | last post by:
Hello, I want to get the file signer using capicom.dll like signtool.exe, how to do? For example: The signer of file "c:\windows\system32\winlogon.exe" is Microsoft, how to get this signer using...
13
by: zach | last post by:
Can someone help me out, I can't figure out what I'm doing wrong to write to a file in binary mode. What's wrong with my code? <?php $fileName = "something.dat"; $string = "This is a...
6
by: aagarwal8 | last post by:
Hi, I am trying to write the contents of a textbox to a file in binary format. My code looks like this... private void btnWriteToFile_Click(object sender, EventArgs e) { FileStream fs =...
1
by: =?Utf-8?B?U3RldmVU?= | last post by:
I have a structure that contains both 32x32 and 16x16 icons plus some text. I want to write all this to an XML file so that I can recover the icons later in an application. Can someone tell me how...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.