I have a USB token (Epass-Capricorn) and my requirement is to sign text/flat files using the same.
PS: I believe I have to get the "START-SIGNATURE", "START-CERTIFICATE" and "SIGNER-VERSION" data from the code and append at the end of the file, attached a screenshot of same.
Can someone guide me how can I achieve the same using C#?
Related
I want to write a C# console or WinForms application to add digital signature to a PDF file using a Certificate .PFX file. Currently, I am able to sign PDF files using a PFX certificate from a folder in the file system, using iText7 and BouncyCastle libraries.
But I need to ask the user to choose a Certificate at run time from the list of installed certificates in the system.
Specifically, I want to display the Windows Security's Confirm Certificate dialog box, and sign using the certificate selected by the user. I want to show the popup shown below:
My specific question is:
How can I trigger the Windows Security's Confirm Certificate dialog box, and how can I read the certificate selected by the user?
EDIT 1:
If I use X509Certificate2UI.SelectFromCollection method, I get a different popup as shown below. This is different from what I want.
You can try using X509Certificate2UI.SelectFromCollection which is documented here.
As #Crypt32 mentioned in the comments i felt the neccessity of adding code example how to use the api. I was wondering how #AllSolutions managed to get that UI window using the same API. It seems the UI changes with the selectionFlag parameter.
var store = new X509Store("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
var collection = store.Certificates;
var cert = X509Certificate2UI.SelectFromCollection(collection, "Select", "Select a certificate to sign", X509SelectionFlag.SingleSelection);
I need to open a secured password protected PDF files programatically in ASP.NET using C#
I don't want to enter the password manually when it opens.
When the file is downloaded to the local drive it must ask the password to download or print the file.
I am using PDFsharp
You can specify the password in the call to PdfReader.Open to open the document. You can then create an unprotected copy of the PDF, e.g. to print it without password prompt.
See also:
http://www.pdfsharp.net/wiki/UnprotectDocument-sample.ashx
In my application, i send mails to managers from program automatically. Normally it works good, but when i use program on another computer, it sends mail automatically but file type is not PDF. File type is File and name of pdf is =utf-8BQU5HT1JBIEhBTEkgQS7Fni4gR8OcTkzD. I also checked source codes. But I couldn't understand what is wrong with that. Any idea what to do?
Try to fill the ContentDisposition, example is here:
Sending email with attachments from C#, attachments arrive as Part 1.2 in Thunderbird
Maybe, in the code you can change the MediaTypeNames.Application.Octet to MediaTypeNames.Application.Pdf
I hope, this helps!
Whatsapp is change the message db to .crypt 7, and now my little app that written in c# not working now (i have a little app for myself for viewing my history chats) because it written for old crypt db of whatsapp.
Now, i see that whatsapp is useing new crypt - .crypt7 - what is it? and how i can convert it? i see also have there local key for decrypt? how i can use it with my little c# for decrypt and read it?
Thanks!
You have to get encryption key. if you have root, you can copy /data/data/com.whatsapp/files/key here. As far as i know whatsapp using "aes" for encryption.
Hell guys,
I'm coding in csharp to send an email which contains a .zip file (has htmls and css inside). When I check the mail recieved, In fact, instead of the .zip file, the attachment becomes a txt file and has:
FILE QUARANTINED
The original contents of this file have been replaced with
this message because of its characteristics.
File name: 'xxxxxxx_Result.zip'
Virus name: 'Large uncompressed size'
The exchange server has blocked the zip file..I'm using CDO to create and send the email.
I tried using the code to send a mail with a zip file generated by WINZIP, there was no problem, then I tried using outlook to send a mail with the zip file generated by my code(I use sharpziplib library), the problem occured...
How can I do to send the attachment correctly? Many thanks in advance!
Allen
I encounter similar problems sending email on our network. I've found that using an alternate compression format, such as 7-zip (.7z), is adequate to get my content through the filters. This could resolve the issue if the block is not due strictly to size.
Looks like your mail server or spam service have removed your attachement and replaced it with the txt file, it sounds like your code is fine and you need to speak to an admin regarding the mail filters and send size quotas!
For anyone facing this problem, here is a solution. You have to explicitly set the file size for the zipentry.
ZipEntry newEntry = new ZipEntry(fileName);
newEntry.DateTime = DateTime.Now;
newEntry.Size = fileData.Length; // setting data size