1 /* 2 * Copyright 2020 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 #pragma once 18 19 #include <keymaster/attestation_context.h> 20 21 #include <keymaster/contexts/soft_attestation_cert.h> 22 23 namespace keymaster { 24 25 class SoftAttestationContext : public AttestationContext { 26 public: SoftAttestationContext(KmVersion version)27 explicit SoftAttestationContext(KmVersion version) : AttestationContext(version) {} 28 GetSecurityLevel()29 keymaster_security_level_t GetSecurityLevel() const override { 30 return KM_SECURITY_LEVEL_SOFTWARE; 31 } 32 33 const VerifiedBootParams* GetVerifiedBootParams(keymaster_error_t* error) const override; 34 GetAttestationKey(keymaster_algorithm_t algorithm,keymaster_error_t * error)35 KeymasterKeyBlob GetAttestationKey(keymaster_algorithm_t algorithm, 36 keymaster_error_t* error) const override { 37 return KeymasterKeyBlob(*getAttestationKey(algorithm, error)); 38 } 39 GetAttestationChain(keymaster_algorithm_t algorithm,keymaster_error_t * error)40 CertificateChain GetAttestationChain(keymaster_algorithm_t algorithm, 41 keymaster_error_t* error) const override { 42 return getAttestationChain(algorithm, error); 43 } 44 }; 45 46 } // namespace keymaster 47