Good day. How to save the public key for EDS to a file and then read it accordingly?
1 answer
Work with files is performed using standard C ++ library functions. These are functions of fopen , fclose , fread , fwrite . If they do not like them for any reason, but rather like working with streams, you can use the ifstream and ofstream , although they are more complicated. Well, of course, you can work through Win32API. Those. These are WriteFile CreateFile , WriteFile , ReadFile and others.
You can also use the TFileStream class from the VCL library supplied with C ++ Builder. An example of use is given in Delphi, but not the problem to adapt it.
In short, how many libraries and interfaces - so many ways to work with files. Choose the one that is more convenient for you and which you think is more correct.
PS there are no differences when working with digital signature with files compared to ordinary data. Therefore, it is proposed to work through standard functions.
- I know how to work with files. But I can not understand how to organize the recording of the key in the file. - Joseph
- Those. I generate a pair of keys for EDS and I can not extract the public key, then to write it to a file. Well, respectively, then to check the signature, I need to extract the public key from the file. But how to do it programmatically does not reach me - Joseph
- How is your key in memory? You only need to know the beginning of the memory block (have a pointer to it) and know the length. And then pass these values as arguments to the fwrite function. - gecube