This new PresentationSession interface enables an application to do a multi-document presentation, something which isn't possible with the existing API. As a practical example of this consider presenting both your Mobile Driving License and your Vaccination Certificate in a single transaction. Also update the documentation for IdentityCredential to clarify that the same AuthKey is used for multiple getEntries() calls on the same credential. Also deprecate existing IdentityCredential.getEntries() method and related methods and classes. Bug: 197965513 Test: New CTS tests and new screen in CtsVerifier Change-Id: I74534969143882552407917a82f44d43da12711c
107 lines
3.3 KiB
Java
107 lines
3.3 KiB
Java
/*
|
|
* Copyright 2021 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package android.security.identity;
|
|
|
|
import android.annotation.NonNull;
|
|
import android.annotation.Nullable;
|
|
|
|
import java.util.Collection;
|
|
import java.util.LinkedList;
|
|
|
|
class CredstoreCredentialDataResult extends CredentialDataResult {
|
|
|
|
ResultData mDeviceSignedResult;
|
|
ResultData mIssuerSignedResult;
|
|
CredstoreEntries mDeviceSignedEntries;
|
|
CredstoreEntries mIssuerSignedEntries;
|
|
|
|
CredstoreCredentialDataResult(ResultData deviceSignedResult, ResultData issuerSignedResult) {
|
|
mDeviceSignedResult = deviceSignedResult;
|
|
mIssuerSignedResult = issuerSignedResult;
|
|
mDeviceSignedEntries = new CredstoreEntries(deviceSignedResult);
|
|
mIssuerSignedEntries = new CredstoreEntries(issuerSignedResult);
|
|
}
|
|
|
|
@Override
|
|
public @NonNull byte[] getDeviceNameSpaces() {
|
|
return mDeviceSignedResult.getAuthenticatedData();
|
|
}
|
|
|
|
@Override
|
|
public @Nullable byte[] getDeviceMac() {
|
|
return mDeviceSignedResult.getMessageAuthenticationCode();
|
|
}
|
|
|
|
@Override
|
|
public @NonNull byte[] getStaticAuthenticationData() {
|
|
return mDeviceSignedResult.getStaticAuthenticationData();
|
|
}
|
|
|
|
@Override
|
|
public @NonNull CredentialDataResult.Entries getDeviceSignedEntries() {
|
|
return mDeviceSignedEntries;
|
|
}
|
|
|
|
@Override
|
|
public @NonNull CredentialDataResult.Entries getIssuerSignedEntries() {
|
|
return mIssuerSignedEntries;
|
|
}
|
|
|
|
static class CredstoreEntries implements CredentialDataResult.Entries {
|
|
ResultData mResultData;
|
|
|
|
CredstoreEntries(ResultData resultData) {
|
|
mResultData = resultData;
|
|
}
|
|
|
|
@Override
|
|
public @NonNull Collection<String> getNamespaces() {
|
|
return mResultData.getNamespaces();
|
|
}
|
|
|
|
@Override
|
|
public @NonNull Collection<String> getEntryNames(@NonNull String namespaceName) {
|
|
Collection<String> ret = mResultData.getEntryNames(namespaceName);
|
|
if (ret == null) {
|
|
ret = new LinkedList<String>();
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
@Override
|
|
public @NonNull Collection<String> getRetrievedEntryNames(@NonNull String namespaceName) {
|
|
Collection<String> ret = mResultData.getRetrievedEntryNames(namespaceName);
|
|
if (ret == null) {
|
|
ret = new LinkedList<String>();
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
@Override
|
|
@Status
|
|
public int getStatus(@NonNull String namespaceName, @NonNull String name) {
|
|
return mResultData.getStatus(namespaceName, name);
|
|
}
|
|
|
|
@Override
|
|
public @Nullable byte[] getEntry(@NonNull String namespaceName, @NonNull String name) {
|
|
return mResultData.getEntry(namespaceName, name);
|
|
}
|
|
}
|
|
|
|
}
|