1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.car.trust;
18 
19 /**
20  * A utility class that provides validations.
21  */
22 final class CarTrustAgentValidator {
23 
24     /**
25      * Returns whether device id received during trust agent enrollment is valid.
26      * <p>
27      * Default implementation has no expectation (always returns true).
28      *
29      * @param value Data received in the initial state of enrollment.
30      * @return {@code True} if input is valid; {@code false} otherwise.
31      */
isValidEnrollmentDeviceId(byte[] value)32     static boolean isValidEnrollmentDeviceId(byte[] value) {
33         return true;
34     }
35 
36     /**
37      * Returns whether device id received during trust agent unlock is valid.
38      * <p>
39      * Default implementation has no expectation (always returns true).
40      *
41      * @param value Data received in the initial state of unlocking.
42      * @return {@code True} if input is valid; {@code false} otherwise.
43      */
isValidUnlockDeviceId(byte[] value)44     static boolean isValidUnlockDeviceId(byte[] value) {
45         return true;
46     }
47 
CarTrustAgentValidator()48     private CarTrustAgentValidator() {
49         // Do not instantiate.
50     }
51 }
52