The following code is used to store password/key in a binary file "rs1.dat" whose sole purpose is that it shouldn't be directly readable from "rs1.dat" but, still the password is stored as a plain text in "rs1.dat" and hence is directly readable from there. pls help me to resolve it.
void changeKey(authenticate m) {
rs1.open("rs1.dat",ios::in|ios::out|ios::ate|ios::binary);
if(rs1.is_open()) {
cout<<"\n\tEnter New Password\n";
string s = m.getPass();
cout<<"\n\tConfirm New Password\n";
if(m.getPass()!=s) {
cout<<"\n\t!!Password Doesn't match!!Pls ReEnter\n";
system("pause");
changeKey(m);
}
rs1.seekp(0,ios::beg);
rs1.write(s.c_str(),s.size());
cout<<"\n\tPassword changed successfully\n";
rs1.close();
}else {
cout<<"Error opening rs1.dat file!!\n";
exit(0);
}
}
Aucun commentaire:
Enregistrer un commentaire