Loading core/java/android/security/keystore/BackwardsCompat.java +2 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,8 @@ class BackwardsCompat { static android.security.keystore.recovery.KeyDerivationParams fromLegacyKeyDerivationParams( KeyDerivationParams keyDerivationParams ) { return new android.security.keystore.recovery.KeyDerivationParams( keyDerivationParams.getAlgorithm(), keyDerivationParams.getSalt()); return android.security.keystore.recovery.KeyDerivationParams.createSha256Params( keyDerivationParams.getSalt()); } static android.security.keystore.recovery.WrappedApplicationKey fromLegacyWrappedApplicationKey( Loading core/java/android/security/keystore/recovery/KeyChainSnapshot.java +3 −3 Original line number Diff line number Diff line Loading @@ -84,8 +84,8 @@ public final class KeyChainSnapshot implements Parcelable { } /** * Snapshot version for given account. It is incremented when user secret or list of application * keys changes. * Snapshot version for given recovery agent. It is incremented when user secret or list of * application keys changes. */ public int getSnapshotVersion() { return mSnapshotVersion; Loading Loading @@ -178,7 +178,7 @@ public final class KeyChainSnapshot implements Parcelable { private KeyChainSnapshot mInstance = new KeyChainSnapshot(); /** * Snapshot version for given account. * Snapshot version for the recovery agent. * * @param snapshotVersion The snapshot version * @return This builder. Loading core/java/android/security/keystore/recovery/KeyDerivationParams.java +3 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import com.android.internal.util.Preconditions; import java.lang.annotation.Retention; Loading Loading @@ -63,7 +62,7 @@ public final class KeyDerivationParams implements Parcelable { * salt + key_material_len + key_material, where salt_len and key_material_len are one-byte, and * denote the number of bytes for salt and key_material, respectively. */ public static KeyDerivationParams createSha256Params(@NonNull byte[] salt) { public static @NonNull KeyDerivationParams createSha256Params(@NonNull byte[] salt) { return new KeyDerivationParams(ALGORITHM_SHA256, salt); } Loading @@ -76,7 +75,7 @@ public final class KeyDerivationParams implements Parcelable { * the parallelization parameter p is 1, the block size parameter r is 8, and the hashing output * length is 32-byte. */ public static KeyDerivationParams createScryptParams( public static @NonNull KeyDerivationParams createScryptParams( @NonNull byte[] salt, int memoryDifficulty) { return new KeyDerivationParams(ALGORITHM_SCRYPT, salt, memoryDifficulty); } Loading @@ -84,8 +83,7 @@ public final class KeyDerivationParams implements Parcelable { /** * @hide */ // TODO: Make private once legacy API is removed public KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt) { private KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt) { this(algorithm, salt, /*memoryDifficulty=*/ -1); } Loading core/java/android/security/keystore/recovery/RecoveryCertPath.java +2 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ public final class RecoveryCertPath implements Parcelable { * @param certPath The certificate path to be wrapped. * @throws CertificateException if the given certificate path cannot be encoded properly. */ public static RecoveryCertPath createRecoveryCertPath(@NonNull CertPath certPath) public static @NonNull RecoveryCertPath createRecoveryCertPath(@NonNull CertPath certPath) throws CertificateException { // Perform the encoding here to avoid throwing exceptions in writeToParcel try { Loading @@ -61,7 +61,7 @@ public final class RecoveryCertPath implements Parcelable { * @return the wrapped certificate path. * @throws CertificateException if the wrapped certificate path cannot be decoded properly. */ public CertPath getCertPath() throws CertificateException { public @NonNull CertPath getCertPath() throws CertificateException { // Perform the decoding here to avoid throwing exceptions in createFromParcel return decodeCertPath(mEncodedCertPath); } Loading core/java/android/security/keystore/recovery/RecoverySession.java +2 −2 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ public class RecoverySession implements AutoCloseable { * @throws InternalRecoveryServiceException if an error occurs internal to the recovery service. */ @RequiresPermission(Manifest.permission.RECOVER_KEYSTORE) public Map<String, Key> recoverKeyChainSnapshot( @NonNull public Map<String, Key> recoverKeyChainSnapshot( @NonNull byte[] recoveryKeyBlob, @NonNull List<WrappedApplicationKey> applicationKeys ) throws SessionExpiredException, DecryptionFailedException, InternalRecoveryServiceException { Loading @@ -257,7 +257,7 @@ public class RecoverySession implements AutoCloseable { } /** Given a map from alias to grant alias, returns a map from alias to a {@link Key} handle. */ private Map<String, Key> getKeysFromGrants(Map<String, String> grantAliases) private @NonNull Map<String, Key> getKeysFromGrants(Map<String, String> grantAliases) throws InternalRecoveryServiceException { ArrayMap<String, Key> keysByAlias = new ArrayMap<>(grantAliases.size()); for (String alias : grantAliases.keySet()) { Loading Loading
core/java/android/security/keystore/BackwardsCompat.java +2 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,8 @@ class BackwardsCompat { static android.security.keystore.recovery.KeyDerivationParams fromLegacyKeyDerivationParams( KeyDerivationParams keyDerivationParams ) { return new android.security.keystore.recovery.KeyDerivationParams( keyDerivationParams.getAlgorithm(), keyDerivationParams.getSalt()); return android.security.keystore.recovery.KeyDerivationParams.createSha256Params( keyDerivationParams.getSalt()); } static android.security.keystore.recovery.WrappedApplicationKey fromLegacyWrappedApplicationKey( Loading
core/java/android/security/keystore/recovery/KeyChainSnapshot.java +3 −3 Original line number Diff line number Diff line Loading @@ -84,8 +84,8 @@ public final class KeyChainSnapshot implements Parcelable { } /** * Snapshot version for given account. It is incremented when user secret or list of application * keys changes. * Snapshot version for given recovery agent. It is incremented when user secret or list of * application keys changes. */ public int getSnapshotVersion() { return mSnapshotVersion; Loading Loading @@ -178,7 +178,7 @@ public final class KeyChainSnapshot implements Parcelable { private KeyChainSnapshot mInstance = new KeyChainSnapshot(); /** * Snapshot version for given account. * Snapshot version for the recovery agent. * * @param snapshotVersion The snapshot version * @return This builder. Loading
core/java/android/security/keystore/recovery/KeyDerivationParams.java +3 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import com.android.internal.util.Preconditions; import java.lang.annotation.Retention; Loading Loading @@ -63,7 +62,7 @@ public final class KeyDerivationParams implements Parcelable { * salt + key_material_len + key_material, where salt_len and key_material_len are one-byte, and * denote the number of bytes for salt and key_material, respectively. */ public static KeyDerivationParams createSha256Params(@NonNull byte[] salt) { public static @NonNull KeyDerivationParams createSha256Params(@NonNull byte[] salt) { return new KeyDerivationParams(ALGORITHM_SHA256, salt); } Loading @@ -76,7 +75,7 @@ public final class KeyDerivationParams implements Parcelable { * the parallelization parameter p is 1, the block size parameter r is 8, and the hashing output * length is 32-byte. */ public static KeyDerivationParams createScryptParams( public static @NonNull KeyDerivationParams createScryptParams( @NonNull byte[] salt, int memoryDifficulty) { return new KeyDerivationParams(ALGORITHM_SCRYPT, salt, memoryDifficulty); } Loading @@ -84,8 +83,7 @@ public final class KeyDerivationParams implements Parcelable { /** * @hide */ // TODO: Make private once legacy API is removed public KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt) { private KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt) { this(algorithm, salt, /*memoryDifficulty=*/ -1); } Loading
core/java/android/security/keystore/recovery/RecoveryCertPath.java +2 −2 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ public final class RecoveryCertPath implements Parcelable { * @param certPath The certificate path to be wrapped. * @throws CertificateException if the given certificate path cannot be encoded properly. */ public static RecoveryCertPath createRecoveryCertPath(@NonNull CertPath certPath) public static @NonNull RecoveryCertPath createRecoveryCertPath(@NonNull CertPath certPath) throws CertificateException { // Perform the encoding here to avoid throwing exceptions in writeToParcel try { Loading @@ -61,7 +61,7 @@ public final class RecoveryCertPath implements Parcelable { * @return the wrapped certificate path. * @throws CertificateException if the wrapped certificate path cannot be decoded properly. */ public CertPath getCertPath() throws CertificateException { public @NonNull CertPath getCertPath() throws CertificateException { // Perform the decoding here to avoid throwing exceptions in createFromParcel return decodeCertPath(mEncodedCertPath); } Loading
core/java/android/security/keystore/recovery/RecoverySession.java +2 −2 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ public class RecoverySession implements AutoCloseable { * @throws InternalRecoveryServiceException if an error occurs internal to the recovery service. */ @RequiresPermission(Manifest.permission.RECOVER_KEYSTORE) public Map<String, Key> recoverKeyChainSnapshot( @NonNull public Map<String, Key> recoverKeyChainSnapshot( @NonNull byte[] recoveryKeyBlob, @NonNull List<WrappedApplicationKey> applicationKeys ) throws SessionExpiredException, DecryptionFailedException, InternalRecoveryServiceException { Loading @@ -257,7 +257,7 @@ public class RecoverySession implements AutoCloseable { } /** Given a map from alias to grant alias, returns a map from alias to a {@link Key} handle. */ private Map<String, Key> getKeysFromGrants(Map<String, String> grantAliases) private @NonNull Map<String, Key> getKeysFromGrants(Map<String, String> grantAliases) throws InternalRecoveryServiceException { ArrayMap<String, Key> keysByAlias = new ArrayMap<>(grantAliases.size()); for (String alias : grantAliases.keySet()) { Loading