Skip to content

Commit

Permalink
fix api warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Aug 25, 2023
1 parent ab6ac58 commit 1068034
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions AuthenticatorPro.Droid/src/Activity/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,9 @@ public override void OnRequestPermissionsResult(int requestCode, string[] permis
}
}

#pragma warning disable CA1416
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
#pragma warning restore CA1416
}

#endregion
Expand Down
18 changes: 10 additions & 8 deletions AuthenticatorPro.Droid/src/Storage/SecureStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ namespace AuthenticatorPro.Droid.Storage
{
internal class SecureStorage
{
const string KeyStoreName = "AndroidKeyStore";
const string AsymmetricCipher = "RSA/ECB/PKCS1Padding";
const string SymmetricCipher = "AES/GCM/NoPadding";
const int IvLength = 12; // Android supports an IV of 12 for AES/GCM
private const string KeyStoreName = "AndroidKeyStore";
private const string AsymmetricCipher = "RSA/ECB/PKCS1Padding";
private const string SymmetricCipher = "AES/GCM/NoPadding";
private const string AsymmetricAlgorithm = "RSA";
private const string SymmetricAlgorithm = "AES";
private const int IvLength = 12; // Android supports an IV of 12 for AES/GCM

const string MasterKeyPreferenceKey = "SecureStorageKey";
const string UseSymmetricPreferenceKey = "essentials_use_symmetric";
private const string MasterKeyPreferenceKey = "SecureStorageKey";
private const string UseSymmetricPreferenceKey = "essentials_use_symmetric";

private readonly Context _context;
private readonly string _preferenceAlias;
Expand Down Expand Up @@ -138,7 +140,7 @@ private ISecretKey GetKey()
_preferences.Edit().Remove(MasterKeyPreferenceKey).Commit();
}

var keyGenerator = KeyGenerator.GetInstance(KeyProperties.KeyAlgorithmAes);
var keyGenerator = KeyGenerator.GetInstance(SymmetricAlgorithm);
var symmetricKey = keyGenerator.GenerateKey();

var newWrappedKey = WrapKey(symmetricKey, keyPair.Public);
Expand Down Expand Up @@ -223,7 +225,7 @@ private KeyPair GetAsymmetricKeyPair()
lock (_lock)
{
// Otherwise we create a new key
var generator = KeyPairGenerator.GetInstance(KeyProperties.KeyAlgorithmRsa, KeyStoreName);
var generator = KeyPairGenerator.GetInstance(AsymmetricAlgorithm, KeyStoreName);

#pragma warning disable CA1422
var soec = new KeyPairGeneratorSpec.Builder(_context)
Expand Down

0 comments on commit 1068034

Please sign in to comment.