Merge "Keystore 2.0: Fix correct handling of Uid/Namespace"
This commit is contained in:
@@ -59,7 +59,7 @@ public final class ParcelableKeyGenParameterSpec implements Parcelable {
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeString(mSpec.getKeystoreAlias());
|
||||
out.writeInt(mSpec.getPurposes());
|
||||
out.writeInt(mSpec.getUid());
|
||||
out.writeInt(mSpec.getNamespace());
|
||||
out.writeInt(mSpec.getKeySize());
|
||||
|
||||
// Only needs to support RSAKeyGenParameterSpec and ECGenParameterSpec.
|
||||
@@ -125,7 +125,7 @@ public final class ParcelableKeyGenParameterSpec implements Parcelable {
|
||||
private ParcelableKeyGenParameterSpec(Parcel in) {
|
||||
final String keystoreAlias = in.readString();
|
||||
final int purposes = in.readInt();
|
||||
final int uid = in.readInt();
|
||||
final int namespace = in.readInt();
|
||||
final int keySize = in.readInt();
|
||||
|
||||
final int keySpecType = in.readInt();
|
||||
@@ -177,7 +177,7 @@ public final class ParcelableKeyGenParameterSpec implements Parcelable {
|
||||
// KeyGenParameterSpec constructor (whereas using a builder would silently drop them).
|
||||
mSpec = new KeyGenParameterSpec(
|
||||
keystoreAlias,
|
||||
uid,
|
||||
namespace,
|
||||
keySize,
|
||||
algorithmSpec,
|
||||
certificateSubject,
|
||||
|
||||
@@ -154,7 +154,7 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
|
||||
private KeyGenParameterSpec mSpec;
|
||||
|
||||
private String mEntryAlias;
|
||||
private int mEntryUid;
|
||||
private int mEntryNamespace;
|
||||
private @KeyProperties.KeyAlgorithmEnum String mJcaKeyAlgorithm;
|
||||
private int mKeymasterAlgorithm = -1;
|
||||
private int mKeySizeBits;
|
||||
@@ -218,7 +218,7 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
|
||||
}
|
||||
|
||||
mEntryAlias = spec.getKeystoreAlias();
|
||||
mEntryUid = spec.getUid();
|
||||
mEntryNamespace = spec.getNamespace();
|
||||
mSpec = spec;
|
||||
mKeymasterAlgorithm = keymasterAlgorithm;
|
||||
mKeySizeBits = spec.getKeySize();
|
||||
@@ -439,7 +439,7 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
|
||||
|
||||
private void resetAll() {
|
||||
mEntryAlias = null;
|
||||
mEntryUid = KeyProperties.NAMESPACE_APPLICATION;
|
||||
mEntryNamespace = KeyProperties.NAMESPACE_APPLICATION;
|
||||
mJcaKeyAlgorithm = null;
|
||||
mKeymasterAlgorithm = -1;
|
||||
mKeymasterPurposes = null;
|
||||
@@ -541,10 +541,10 @@ public abstract class AndroidKeyStoreKeyPairGeneratorSpi extends KeyPairGenerato
|
||||
|
||||
KeyDescriptor descriptor = new KeyDescriptor();
|
||||
descriptor.alias = mEntryAlias;
|
||||
descriptor.domain = mEntryUid == KeyProperties.NAMESPACE_APPLICATION
|
||||
descriptor.domain = mEntryNamespace == KeyProperties.NAMESPACE_APPLICATION
|
||||
? Domain.APP
|
||||
: Domain.SELINUX;
|
||||
descriptor.nspace = mEntryUid;
|
||||
descriptor.nspace = mEntryNamespace;
|
||||
descriptor.blob = null;
|
||||
|
||||
boolean success = false;
|
||||
|
||||
Reference in New Issue
Block a user