diff options
Diffstat (limited to 'Emby.Server.Implementations/Cryptography/CryptographyProvider.cs')
| -rw-r--r-- | Emby.Server.Implementations/Cryptography/CryptographyProvider.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs index fec7d161e..776074b72 100644 --- a/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs +++ b/Emby.Server.Implementations/Cryptography/CryptographyProvider.cs @@ -6,6 +6,9 @@ using static MediaBrowser.Common.Cryptography.Constants; namespace Emby.Server.Implementations.Cryptography { + /// <summary> + /// Class providing abstractions over cryptographic functions. + /// </summary> public class CryptographyProvider : ICryptoProvider, IDisposable { private static readonly HashSet<string> _supportedHashMethods = new HashSet<string>() @@ -42,8 +45,10 @@ namespace Emby.Server.Implementations.Cryptography _randomNumberGenerator = RandomNumberGenerator.Create(); } + /// <inheritdoc /> public string DefaultHashMethod => "PBKDF2"; + /// <inheritdoc /> public IEnumerable<string> GetSupportedHashMethods() => _supportedHashMethods; @@ -62,6 +67,7 @@ namespace Emby.Server.Implementations.Cryptography throw new CryptographicException($"Cannot currently use PBKDF2 with requested hash method: {method}"); } + /// <inheritdoc /> public byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt) { if (hashMethod == DefaultHashMethod) @@ -89,12 +95,15 @@ namespace Emby.Server.Implementations.Cryptography throw new CryptographicException($"Requested hash method is not supported: {hashMethod}"); } + /// <inheritdoc /> public byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt) => PBKDF2(DefaultHashMethod, bytes, salt, DefaultIterations); + /// <inheritdoc /> public byte[] GenerateSalt() => GenerateSalt(DefaultSaltLength); + /// <inheritdoc /> public byte[] GenerateSalt(int length) { byte[] salt = new byte[length]; @@ -109,6 +118,10 @@ namespace Emby.Server.Implementations.Cryptography GC.SuppressFinalize(this); } + /// <summary> + /// Releases unmanaged and - optionally - managed resources. + /// </summary> + /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (_disposed) |
