diff --git a/changelog.txt b/changelog.txt index ea5020844b..cb7c8f5c85 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ vNext - [MINOR] Organize browser selection classes and change signature for get AuthorizationStrategy (#2564) - [MINOR] Add support for OneBox Environment (#2559) - [MINOR] Add support for claims requests for native authentication (#2572) +- [MINOR] Removing unnecessary attributes from keystore wrap operation (#2578) Version 19.0.0 ---------- diff --git a/common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoader.java b/common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoader.java index 019d108b97..d3d4566593 100644 --- a/common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoader.java +++ b/common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoader.java @@ -46,9 +46,7 @@ import java.security.KeyStore; import java.security.spec.AlgorithmParameterSpec; import java.util.Calendar; -import java.util.Date; import java.util.Locale; -import java.util.concurrent.TimeUnit; import javax.crypto.SecretKey; import javax.security.auth.x500.X500Principal; @@ -311,18 +309,11 @@ private static AlgorithmParameterSpec getSpecForKeyStoreKey(@NonNull final Conte if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { return getLegacySpecForKeyStoreKey(context, alias); } else { - final String certInfo = String.format(Locale.ROOT, "CN=%s, OU=%s", - alias, - context.getPackageName()); - final int certValidYears = 100; - int purposes = KeyProperties.PURPOSE_WRAP_KEY | KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT; + int purposes = KeyProperties.PURPOSE_WRAP_KEY | KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT; return new KeyGenParameterSpec.Builder(alias, purposes) - .setCertificateSubject(new X500Principal(certInfo)) - .setCertificateSerialNumber(BigInteger.ONE) - .setCertificateNotBefore(new Date()) - .setCertificateNotAfter(new Date(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(365 * certValidYears))) .setKeySize(2048) .setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512) + .setBlockModes(KeyProperties.BLOCK_MODE_ECB) // Ensure compatibility with RSA .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1) .build(); }