public void Add(string key, string value)
		{
			PBEKeySpec keyspec = new PBEKeySpec(value.ToCharArray());
			SecretKeyFactory fk = SecretKeyFactory.GetInstance("PBEWithMD5andDES");
			ISecretKey mysec = fk.GenerateSecret(keyspec);
			KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(mysec);

			keyStore.SetEntry(key, entry, Password);
			Save();
		}
 public AESObfuscator(byte[] salt, string password)
 {
     try {
         SecretKeyFactory factory = SecretKeyFactory.GetInstance(KEYGEN_ALGORITHM);
         PBEKeySpec keySpec =
             new PBEKeySpec(password.ToCharArray(), salt, 1024, 256);
         ISecretKey tmp = factory.GenerateSecret(keySpec);
         ISecretKey secret = new SecretKeySpec(tmp.GetEncoded(), "AES");
         mEncryptor = Cipher.GetInstance(CIPHER_ALGORITHM);
         mEncryptor.Init(Cipher.EncryptMode, secret, new IvParameterSpec(IV));
         mDecryptor = Cipher.GetInstance(CIPHER_ALGORITHM);
         mDecryptor.Init(Cipher.DecryptMode, secret, new IvParameterSpec(IV));
     } catch (GeneralSecurityException e) {
         // This can't happen on a compatible Android device.
         throw new RuntimeException("Invalid environment", e);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AesObfuscator"/> class. 
 /// The aes obfuscator.
 /// </summary>
 /// <param name="salt">
 /// an array of random bytes to use for each (un)obfuscation
 /// </param>
 /// <param name="applicationId">
 /// application identifier, e.g. the package name
 /// </param>
 /// <param name="deviceId">
 /// device identifier. Use as many sources as possible to 
 /// create this unique identifier.
 /// </param>
 public AesObfuscator(byte[] salt, string applicationId, string deviceId)
 {
     try
     {
         SecretKeyFactory factory = SecretKeyFactory.GetInstance(KeygenAlgorithm);
         IKeySpec keySpec = new PBEKeySpec((applicationId + deviceId).ToCharArray(), salt, 1024, 256);
         ISecretKey tmp = factory.GenerateSecret(keySpec);
         ISecretKey secret = new SecretKeySpec(tmp.GetEncoded(), "AES");
         this.encryptor = Cipher.GetInstance(CipherAlgorithm);
         this.encryptor.Init(CipherMode.EncryptMode, secret, new IvParameterSpec(Iv));
         this.decryptor = Cipher.GetInstance(CipherAlgorithm);
         this.decryptor.Init(CipherMode.DecryptMode, secret, new IvParameterSpec(Iv));
     }
     catch (GeneralSecurityException e)
     {
         // This can't happen on a compatible Android device.
         throw new RuntimeException("Invalid environment", e);
     }
 }