password protected Base64 string convert into pdf file without password - c#

I have Encrypted PDF File and i have convert encypted PDF file To Base64 string. I want Base64 string convert into PDF File (Means PDF file will write without password). PDF File should open.
Encrypted Base64 string is perfectly convert into pdf file but when i am trying to open the pdf file it is asking password.
I want when file is convert into Encryted base64 to PDF File then it should open without password .File is saving on my folder.
How i can do it. with asp.net with c#.

Can’t be done.
Otherwise the mere act of emailing a password protected PDF removes the protection and I’m pretty sure the payslips I get are protected.

Related

Problem with sending attachment (ie.Pdf file) with Email from C# desktop application

I am sending a .pdf file (generated by code & stored in my computer) by email as attachment its working I am able to send it but the issue is I am not able to view it directly in the browser. Browser asks to download pdf which I don't want.
My pdf file path is in a string variable. when I pass this variable to attachment, browser asks to download it but if I pass static path of pdf instead of using variable the pdf gets open directly in browser which I want.
System.Net.Mail.Attachment attachment;
// mail.Attachments.Add(new Attachment("E:\\API_BILL\\TAX INV-10181-API RECHARGE-S G SHINDE.pdf"));
// above line gives me result as I want want but I want to set filepath dynamically.
attachment = new System.Net.Mail.Attachment(FilePath.ToString(), "fname/pdf");

C# open an encrypted file without writing the file to the disk?

I have encrypted a file with c# and gave it the extention .crypted. The file extention .crypted is associated with my program. So if i double click the file i get a password request dialog from my program. After entering the correct password my program decrypts the file and writes it unencrypted to the disk without the .crypted extention, so that i can run it. After using the file i just delete the unencrypted file and if the file was altered i use my program to reencrypt the file first. But u can easily use a file recovery program to get unauthorized access to the unencrypted file. Thats why i dont want to write unencrypted files to the disk after my program decrypts them. Is it possible to open an encrypted file without ever writing it to the disk? Like saving the unencrypted file to the ram/memory and opening it from there? I dont want to write a whole file system for that. The encrypted files should stay on NTFS or ext4. I think i need to change the code at this point:
using(CryptoStream cryptoStream = new CryptoStream(fileStream, rijndael.CreateDecryptor(), CryptoStreamMode.Read))
{
// write unencrypted file to memory and execute or something else?
}

Programatically enter password on encrypted pdf file using PDFsharp C#

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

Encoding of folders name on windows server and html

I opened a new account on an American Web-host and I didn't take into account that his server will not support Hebrew chars(on his file system):
Any way, after coping the gibberish path :
<pic src="..\_images\gallery\smallPictures\2010-08-02 âìøéä àåâåñè 2010\" width="150" height="120"></pic>
to my XML file and saving it with UTF-8 encoding it worked.
is there a way to generate this Gibberish in c#?
Is there a way to fix the encoding of the folders (to be in a certain encoding)?

Encrypting contents of a file when uploading

Am using asp.net's FileUpload control to upload a word file to the server.
I want to encrypt the contents of this file (using our custom encryption API) and then save it in the server.
How do i achieve this?what should be my approach?
Thanks.
Whatever you do on the server side, do realize that while the data is transfering over the wire, it will not be encrypted with your custom api. You will need to upload the file using an ssl connection in order ensure the data transfer is secure.
if you have your own custom encryption API, you should use it to encrypt in a temporary file and then upload the temporary encrypted result, and delete it after upload complete.
The FileUpload control gives you a handle to the file. Read the data from the file stream, encrypt it and write it to a FileStream. If the encryption process is CPU intensive and/or takes a lot of time, save the file in a temp directory and start a new thread that reads the file, encrypts its contents, saves it to a new file and deletes the temp file.
maybe u should write your own encryptor as an app and then decrypt that file on the server
this article could help u : file encrypt / decrypt

Categories