Appearance
IsValidKey Method
Definition
- Namespace:
JASE.Crypto - Assembly:
JASE.Crypto.dll
Overloads
| Name | Description |
|---|---|
bool IsValidKey(byte[] key, SymmetricAlgorithms algorithm = null) | Determines whether the supplied binary key material meets the legal key-size requirements for the specified symmetric encryption algorithm. |
bool IsValidKey(string key, SymmetricAlgorithms algorithm = null) | Determines whether the specified key string represents a valid key for the selected symmetric encryption algorithm. |
bool IsValidKey(byte[] key, SymmetricAlgorithms algorithm = null)
csharp
bool IsValidKey(byte[] key, SymmetricAlgorithms algorithm = null)Determines whether the supplied binary key material meets the legal key-size requirements for the specified symmetric encryption algorithm.
Parameters
| Name | Description |
|---|---|
algorithm | The symmetric algorithm whose permitted key sizes should be validated. Defaults to AES256. |
key | The key material as a byte array. If , the method returns . |
Returns
if the key length (in bits) falls within the algorithm’s allowed size range and aligns with the required skip increments; otherwise .
bool IsValidKey(string key, SymmetricAlgorithms algorithm = null)
csharp
bool IsValidKey(string key, SymmetricAlgorithms algorithm = null)Determines whether the specified key string represents a valid key for the selected symmetric encryption algorithm.
Parameters
| Name | Description |
|---|---|
algorithm | The symmetric algorithm whose key-size requirements should be validated. Defaults to AES256. |
key | The key material as a text string. The string is converted to bytes using Encoding rules via ToByteArray(). |
Returns
if the encoded byte representation of key satisfies the legal key sizes for the specified algorithm; otherwise .