| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.security.keymaster; |
| 18 |
|
| 19 |
import android.os.Parcel; |
| 20 |
import android.os.Parcelable; |
| 21 |
|
| 22 |
import java.util.ArrayList; |
| 23 |
import java.util.List; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public class KeymasterCertificateChain implements Parcelable { |
| 32 |
|
| 33 |
private List<byte[]> mCertificates; |
| 34 |
|
| 35 |
public static final @android.annotation.NonNull Parcelable.Creator<KeymasterCertificateChain> CREATOR = new |
| 36 |
Parcelable.Creator<KeymasterCertificateChain>() { |
| 37 |
public KeymasterCertificateChain createFromParcel(Parcel in) { |
| 38 |
return new KeymasterCertificateChain(in); |
| 39 |
} |
| 40 |
public KeymasterCertificateChain[] newArray(int size) { |
| 41 |
return new KeymasterCertificateChain[size]; |
| 42 |
} |
| 43 |
}; |
| 44 |
|
| 45 |
public KeymasterCertificateChain() { |
| 46 |
mCertificates = null; |
| 47 |
} |
| 48 |
|
| 49 |
public KeymasterCertificateChain(List<byte[]> mCertificates) { |
| 50 |
this.mCertificates = mCertificates; |
| 51 |
} |
| 52 |
|
| 53 |
private KeymasterCertificateChain(Parcel in) { |
| 54 |
readFromParcel(in); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public void shallowCopyFrom(KeymasterCertificateChain other) { |
| 62 |
this.mCertificates = other.mCertificates; |
| 63 |
} |
| 64 |
|
| 65 |
public List<byte[]> getCertificates() { |
| 66 |
return mCertificates; |
| 67 |
} |
| 68 |
|
| 69 |
@Override |
| 70 |
public void writeToParcel(Parcel out, int flags) { |
| 71 |
if (mCertificates == null) { |
| 72 |
out.writeInt(0); |
| 73 |
} else { |
| 74 |
out.writeInt(mCertificates.size()); |
| 75 |
for (byte[] arg : mCertificates) { |
| 76 |
out.writeByteArray(arg); |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
public void readFromParcel(Parcel in) { |
| 82 |
int length = in.readInt(); |
| 83 |
mCertificates = new ArrayList<byte[]>(length); |
| 84 |
for (int i = 0; i < length; i++) { |
| 85 |
mCertificates.add(in.createByteArray()); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
@Override |
| 90 |
public int describeContents() { |
| 91 |
return 0; |
| 92 |
} |
| 93 |
} |