Click here to Skip to main content
15,668,220 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Read Encrypted .Cer file line by line in I want to get some data from that file.
I can also decrypt file but I dont know how to get the data from Decrypted file.
Pls help me.

Updated 8-Nov-10 22:21pm

This[^] is not the best sample in terms of what you ask, but it may help.

You cannot actually "read" this file, but rather "use" it as the security key.
Share this answer
Rajesh Anuhya 9-Nov-10 6:30am    
Good link..
I don't know much about the .Cer file but can't you just read it using System.IO library?

Here is a sample:

/*--[using directives]-------------------------------------------------*/
using System.IO

/*--[ Function ]---------------------------------------*/
  Name            : ReadTxtFile_ToLst
  Description     : Reads data line- for line from a text file and stores
                    it to a list buffer.

  Access Modifier : public
  Param           : string txtFilePath

  Retval          : List<string>
public List<string> ReadTxtFile_ToLst(string txtFilePath)
  List<string> returnValue = new List<string>();
  FileInfo genericFileInfo = new FileInfo(txtFilePath);
  StreamReader sr = genericFileInfo.OpenText();
  string lineContents;

  while (sr.EndOfStream != true)
    lineContents = sr.ReadLine();
  return returnValue;

Hope this is what you were looking for!

Rudolf, :)
Share this answer
Rajesh Anuhya 9-Nov-10 6:30am    
.CER files are Security Certificate files.., you can't read it normally...
R. Erasmus 9-Nov-10 6:37am    
I just tried to read a .cer file and had no trouble doing so, it obviously read a bunch of senceless giberish. But if that is what you wanted, you shouldn't have any trouble with this function.
Rajesh Anuhya 9-Nov-10 6:47am    
in my view READ means USE, .cer files contains a security key which is used in our application. there is no use of reading senseless data..,
R. Erasmus 9-Nov-10 6:53am    
I see your point, maybe the question should of been restructured better (unless the author can perform miracles) as you mentioned in your first answer. ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900