Closed jwdonahue closed 1 month ago
one way of sloving this is by introducing to interfaces one fo RSA and one for AES, some thing like
public interface ICryptoNetAes : ICryptoNet
{
string ExportKey();
void ExportKeyAndSave(FileInfo fileInfo);
}
and
public interface ICryptoNetRsa : ICryptoNet
{
string ExportKey(bool privateKey = false);
void ExportKeyAndSave(FileInfo fileInfo, bool privateKey = false);
}
I am going this way, is there otehr options?
Something like this maybe?
public record Key : IGetKey, ISaveKey
{
string Getkey();
void SaveKey(string filename);
void SaveKey(FileInfo fileInfo);
}
public interface ICryptoNetAes : ICryptoNet
{
Key GetKey();
}
public interface ICryptoNetRsa : ICryptoNet
{
Key GetPrivateKey()
Key GetPublicKey()
}
I need to sleep on it.
Have a nice evening and sleep well
Maybe a hierarchy of Key types, derived from Key, with a handful of static factory methods for each of the specialized types?
I like your suggestion https://github.com/maythamfahmi/CryptoNet/issues/101#issuecomment-2421884593, but at this stage I just chosen to keep it on this suggestion https://github.com/maythamfahmi/CryptoNet/issues/101#issuecomment-2421773796. If we think at later point it need more attention, we could perhaps revisit your suggestion.
Contact Details
No response
What happened?
Naming vs function aside, why default a bool to null, and never use it?
Version
2.4.x >= (Default)
What Operating System are you seeing the problem on?
No response
Relevant log output
Code of Conduct