refactor(RSADecryptor): Lazy Loading in Encryptor Getter integriert, um die Leistung zu verbessern.
This commit is contained in:
parent
777a8a73ac
commit
f28b43cc06
@ -10,19 +10,18 @@ namespace DigitalData.Core.Security
|
||||
|
||||
public bool IsEncrypted => Password is not null;
|
||||
|
||||
public IRSAEncryptor Encryptor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RSAEncryptor()
|
||||
{
|
||||
Pem = _rsa.ExportRSAPublicKeyPem(),
|
||||
Padding = Padding
|
||||
};
|
||||
}
|
||||
}
|
||||
private readonly Lazy<IRSAEncryptor> _lazyEncryptor;
|
||||
|
||||
internal RSADecryptor() { }
|
||||
public IRSAEncryptor Encryptor => _lazyEncryptor.Value;
|
||||
|
||||
internal RSADecryptor()
|
||||
{
|
||||
_lazyEncryptor = new(() => new RSAEncryptor()
|
||||
{
|
||||
Pem = _rsa.ExportRSAPublicKeyPem(),
|
||||
Padding = Padding
|
||||
});
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context) => Init();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user