Exemple #1
0
 /// <summary>
 /// Load API keys from an encrypted file - keys will stay encrypted in memory
 /// </summary>
 /// <param name="encryptedFile">Encrypted file to load keys from</param>
 public void LoadAPIKeys(string encryptedFile)
 {
     SecureString[] strings = CryptoUtility.LoadProtectedStringsFromFile(encryptedFile);
     if (strings.Length < 2)
     {
         throw new InvalidOperationException("Encrypted keys file should have at least a public and private key, and an optional pass phrase");
     }
     PublicApiKey  = strings[0];
     PrivateApiKey = strings[1];
     if (strings.Length > 2)
     {
         Passphrase = strings[2];
     }
 }