-
Notifications
You must be signed in to change notification settings - Fork 38
Replace AbstractSecretKeyLoader with ISecretKeyProvider, Fixes AB#3297746 #2666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ Work item link check failed. Description does not contain AB#{ID}. Click here to Learn more. |
✅ Work item link check complete. Description contains link AB#3297746 to an Azure Boards work item. |
...n/src/androidTest/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoaderTest.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoaderFactory.kt
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoaderFactory.kt
Outdated
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/crypto/key/ISecretKeyGenerator.kt
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoader.java
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoaderFactory.kt
Outdated
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java
Outdated
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/crypto/key/ISecretKeyLoader.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions
…eplacing ISecretKeyLoader. Update related classes and tests to ensure compatibility with new key provider structure. Remove deprecated AndroidWrappedKeyLoaderFactory and adjust encryption manager implementations accordingly.
…nd AES256SecretKeyGenerator. Update tests accordingly to reflect these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few suggestions. otherwise lgtm.
...c/main/java/com/microsoft/identity/common/crypto/AndroidAuthSdkStorageEncryptionManager.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyLoader.java
Outdated
Show resolved
Hide resolved
.../src/main/com/microsoft/identity/common/java/crypto/key/AbstractAES256SecretKeyProvider.java
Outdated
Show resolved
Hide resolved
…placing AbstractAES256SecretKeyProvider. Update related classes and tests for compatibility. Remove deprecated classes.
- Updated the AndroidAuthSdkStorageEncryptionManagerTest to replace instances of ISecretKeyLoader with ISecretKeyProvider. - Refactored StorageEncryptionManager to use key providers instead of key loaders for encryption and decryption processes. - Introduced MockAES256KeyProvider and MockAES256KeyProviderWithGetKeyError classes to facilitate testing with the new key provider interface. - Adjusted StorageEncryptionManagerTest to utilize the new MockAES256KeyProvider for testing encryption and decryption functionalities. - Ensured all references to key loaders in the codebase are replaced with key providers for consistency and clarity.
… AuthenticationSettings
…AuthSdkStorageEncryptionManager and update related test assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the legacy AbstractSecretKeyLoader
abstraction with the new ISecretKeyProvider
interface and delegates secret key generation to a dedicated AES256SecretKeyGenerator
object for clearer separation of concerns.
- Introduce
ISecretKeyProvider
andISecretKeyGenerator
interfaces - Implement
AES256SecretKeyGenerator
and refactor existing loaders/providers - Update all consumers and tests to use the new interfaces and generator
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
common4j/src/main/java/com/microsoft/identity/common/java/crypto/key/ISecretKeyProvider.kt | New interface defining key providers |
common4j/src/main/java/com/microsoft/identity/common/java/crypto/key/AES256SecretKeyGenerator.kt | New singleton implementing key generation |
common4j/src/main/java/com/microsoft/identity/common/java/crypto/StorageEncryptionManager.java | Refactored to call ISecretKeyProvider methods |
common4j/src/test/java/com/microsoft/identity/common/java/crypto/MockAES256KeyProvider*.java | Updated mocks to implement ISecretKeyProvider |
common/src/main/java/com/microsoft/identity/common/crypto/AndroidWrappedKeyProvider.java | Refactored loader to provider |
…redefinedKeyProvider
…ovider for key management, Fixes AB#3297746 (#2326) Update necessary from: AzureAD/microsoft-authentication-library-common-for-android#2666 [AB#3297746](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3297746)
In the next PR:
All these changes lay the groundwork for the next PR, where the new implementation will be introduced and the feature flag will be used to switch between the two implementations.
AB#3297746