473,803 Members | 3,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CAPICOM EnvelopedData Troubles

I am trying to use the CAPICOM Package to Send Secure Emails, however, I am
having a bit of trouble in getting it to work. I am able to get the proper
certificate, and seemingly encode the 'EnvelopedData' correctly, but when
attempting to open the sent message in Outlook I receive a: "Can't open this
item. Your Digital ID name can not be found by the underlying security
system." Error. I am unsure what this means exactly as it is not something I
was able to query with helpful results on Google, so I was wondering if
someone else had this issue, and knew how to resolve it.

If anyone has a good example of this process in action I would very much
appreciate a good example, so that I can perhaps see my error(s).

NOTE: I was able to Encrypt and send Messages using ChilkatDotNet so I would
assume i'm just overlooking some step of the process.

Since I find it very likely I'm doing something incorrect somewhere along
the encryption process, I have attached my source below. Any help would be
greatly appreciated:
//CLASS VARIABLES

static private String _currStoreName = "My";
static StoreClass _oCurrStore;

private System.Web.Mail .MailMessage theMessage;

private Certificates oCerts;
private Certificate oCert;

private EnvelopedData encryptedMessag e;
//SOURCE CODE

private void btnSubmit_Click (object sender, System.EventArg s e)
{

_oCurrStore = new StoreClass();
_oCurrStore.Ope n(CAPICOM_STORE _LOCATION.CAPIC OM_CURRENT_USER _STORE,
_currStoreName, CAPICOM_STORE_O PEN_MODE.CAPICO M_STORE_OPEN_EX ISTING_ONLY |
CAPICOM_STORE_O PEN_MODE.CAPICO M_STORE_OPEN_MA XIMUM_ALLOWED);

oCerts = (Certificates)_ oCurrStore.Cert ificates;

foreach(Certifi cate cert in oCerts)
{
oCert = cert;
}

theMessage = new System.Web.Mail .MailMessage();

theMessage.To = "jz******@dovet ailinternet.com ";
theMessage.From = "jz******@dovet ailinternet.com ";
theMessage.Subj ect = "This is the Subject";

encryptedMessag e = new EnvelopedData() ;
encryptedMessag e.Content = "Hello World!";
encryptedMessag e.Recipients.Ad d(oCert);

Response.Write( "<B>Subject Email Name: </B>" +
oCert.GetInfo(C APICOM.CAPICOM_ CERT_INFO_TYPE. CAPICOM_CERT_IN FO_SUBJECT_EMAI L_NAME) + "<BR>");

string smimeMessage =
encryptedMessag e.Encrypt(CAPIC OM.CAPICOM_ENCO DING_TYPE.CAPIC OM_ENCODE_BASE6 4);

StreamWriter outStream = new StreamWriter("C :\\DEV\\smime.p 7m", false);
outStream.Write Line(smimeMessa ge);
outStream.Close ();

theMessage.Atta chments.Add(new
System.Web.Mail .MailAttachment ("C:\\DEV\\smim e.p7m"));

theMessage.Head ers.Add("Conten t-Type",
"applicatio n/x-pkcs7-mime;smime-type=enveloped-data;");
//theMessage.Head ers.Add("Conten t-Transfer-Encoding", "base64");
theMessage.Head ers.Remove("Con tent-Class");

System.Web.Mail .SmtpMail.SmtpS erver = "mail.dovetaili nternet.com";
System.Web.Mail .SmtpMail.Send( theMessage);

File.Delete("C: \\DEV\\smime.p7 m");
}
Nov 19 '05 #1
0 1156

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3465
by: Alexei Pashin | last post by:
I use EnvelopedData from CAPICOM library to encrypt and decrypt security info on my ASP site. I got and installed test VerySign certificate on my server in Personal store and successfully encrypt data. As a recipient I used this certificate. I could successfully encrypt data. Before decryption i try to check availability of Private key: 1 Property objCertificate.HasPrivateKey() returns TRUE 2 Property...
0
1807
by: Mario Rodriguez | last post by:
Hi, I'm using interop-Capicom in my C# application, but when I try to use the CAPICOM_SMART_CARD_USER_STORE flag the following exception raises: The system cannot find the file specified. at CAPICOM.StoreClass.Open(CAPICOM_STORE_LOCATION StoreLocation, String Store Name, CAPICOM_STORE_OPEN_MODE OpenMode) at sugef.sicveca.capaPresentacion.windows.FindCertnet.Main(String args) in d:\documents and settings\mrodriguez\my documents\visual...
1
2218
by: Neil S. | last post by:
I am writing an ISAPI filter which is using CAPICOM to encrypt and decrypt cookie information. I've found that the encryption string being returned by CAPICOM a has carriage control and line feed. (Hex 0d0a). My filter adds the header in the correct format, including the entire encrypted cookie value (set-cookie: mycookie=theEncryptedValue;path=/;). However, when the isapi filter finishes running, the browser only gets part of the...
1
1980
by: Mohit | last post by:
Hi Friends I did not know where to post this question, so am posting it on ASP.Net forum (so please excue me Has any one used CapiCom.DLL. I am having problems with it, and am wondering if it works with Windows 2003? So the question is, does CapiCom.DLL (Version 2.0.0.3) work with Windows 2003 I keep getting the following error messag "The recipient cannot be found in the EnvelopedData object." when i call the Decrypt method Please...
0
1463
by: Frederic ESNOUF \(MVP-ISA\) | last post by:
Hi, My question is about 3des, ... in fact the difference between 3DES with Capicom (VB) and VB.net With VB6/capicom, encrypting data is simple : message.Content = "This is my bank account : Azerty007" message.SetSecret "MyPassword' message.Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS message.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM_3DES
0
1162
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 warnings at this point. Next, I take a generic application and import an inherited form from the dll and I get the error to check to see if the reference has already been added. I can leave the reference to capicom in the references section and...
1
1822
by: Fafnir | last post by:
Hi all. I'm gettings asn1 error in capicom during the signature verification. The problem is that i sign the document using russian cryptoprovider - CryptoPro and verification also uses this cryptoprovider. Signed files are passed via email(Microsoft Outlook). Some files(small) pass ok and some raise asn1 error. Does anybody know what i could do? I'm using WinXP, Visual Studio .net 2003, c# and Interop.Capicom. Thanks for help. Alex.
2
3859
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 archive http://mail.python.org/pipermail/python-win32/2006-March.txt but nothing really helpfull.
1
2573
by: CsharpDeveloper | last post by:
Hi, I have sucessfuly used the CAPICOM in .NET FrameWork, but when it comes to using in .NET Compact FrameWork it is giving me a COMException "Class not registered". I have created a Interop wrapper with .NET 2.0. I have used the following command to do it tlbImp "CAPICOM.dll" /namespace:CAPICOM /out:INTEROP.CAPICOM.dll The code snippet is as follows
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.