Class KeyManager
- Namespace
- AetherUtils.Core.Licensing
- Assembly
- AetherUtils.Core.dll
Handles loading and saving private and public keys to file system.
[UsedImplicitly]
public static class KeyManager
- Inheritance
-
KeyManager
- Inherited Members
Methods
CreateKeys(string)
Create a new public and private key pair using the specified passphrase.
[UsedImplicitly]
public static KeyPair CreateKeys(string passphrase)
Parameters
passphrasestring- The passphrase used to derive the key pair.
Returns
LoadAllKeys(IEnumerable<string>)
Loads all key pairs specified by the list of full paths.
[UsedImplicitly]
public static List<KeyPair> LoadAllKeys(IEnumerable<string> paths)
Parameters
pathsIEnumerable<string>- A list of full file paths to key files.
Returns
- List<KeyPair>
- A list of KeyPairs loaded from the file paths. This list is in the same order as the paths.
LoadKeys(string)
Load a key pair from a file.
[UsedImplicitly]
public static KeyPair? LoadKeys(string fullPath)
Parameters
fullPathstring- The full, absolute path to a key file.
Returns
Exceptions
- ArgumentException
- If
fullPathwasnullor empty.
LoadKeys(string, string)
Load a key pair from a file.
[UsedImplicitly]
public static KeyPair? LoadKeys(string basePath, string fileName)
Parameters
basePathstring- The base folder the keys are located in.
fileNamestring- The name of the file to load.
Returns
Exceptions
- ArgumentException
- If
basePathwasnullor empty. - ArgumentException
- If
fileNamewasnullor empty.
SaveAllKeys(IEnumerable<Pair<string, KeyPair>>)
Save all the key pair files specified in the list to disk. Each pair in the list should be in this format:
Full Path, Key Pair[UsedImplicitly]
public static void SaveAllKeys(IEnumerable<Pair<string, KeyPair>> pathsAndKeys)
Parameters
pathsAndKeysIEnumerable<Pair<string, KeyPair>>- A list of paths and KeyPair objects to save.
SaveKeys(KeyPair, string)
Save the full key pair to a file.
[UsedImplicitly]
public static void SaveKeys(KeyPair keys, string fullPath)
Parameters
keysKeyPair- The pair of keys (public and private). Public key should be first.
fullPathstring- The full path of the file to save.
Exceptions
- ArgumentException
- If
fullPathwasnullor empty. - ArgumentException
- If
keyswasnull.
SaveKeys(KeyPair, string, string)
Save the full key pair to a file.
[UsedImplicitly]
public static void SaveKeys(KeyPair keys, string basePath, string fileName)
Parameters
keysKeyPair- The pair of keys (public and private). Public key should be first.
basePathstring- The base folder to save the keys in.
fileNamestring- The name of the file to save: recommended is
keyPair.keys
Exceptions
- ArgumentException
- If
basePathwasnullor empty. - ArgumentException
- If
fileNamewasnullor empty. - ArgumentException
- If
keyswasnull.
SavePublicKey(string, string)
Save only the public key to a file.
[UsedImplicitly]
public static void SavePublicKey(string publicKey, string fullPath)
Parameters
Exceptions
- ArgumentException
- If
fullPathwasnullor empty. - ArgumentException
- If
publicKeywasnullor empty.
SavePublicKey(string, string, string)
Save only the public key to a file.
[UsedImplicitly]
public static void SavePublicKey(string publicKey, string basePath, string fileName)
Parameters
publicKeystring- The public key to save.
basePathstring- The base folder to save the public key in.
fileNamestring- The name of the file to save: recommended is
public.key
Exceptions
- ArgumentException
- If
basePathwasnullor empty. - ArgumentException
- If
fileNamewasnullor empty. - ArgumentException
- If
publicKeywasnullor empty.