• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014 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 #ifndef SYSTEM_KEYMASTER_ASYMMETRIC_KEY_H
18 #define SYSTEM_KEYMASTER_ASYMMETRIC_KEY_H
19 
20 #include <openssl/evp.h>
21 
22 #include "key.h"
23 
24 namespace keymaster {
25 
26 class AsymmetricKey : public Key {
27   public:
AsymmetricKey(const AuthorizationSet & hw_enforced,const AuthorizationSet & sw_enforced,keymaster_error_t * error)28     AsymmetricKey(const AuthorizationSet& hw_enforced, const AuthorizationSet& sw_enforced,
29                   keymaster_error_t* error)
30         : Key(hw_enforced, sw_enforced, error) {}
31 
32     keymaster_error_t formatted_key_material(keymaster_key_format_t format,
33                                              UniquePtr<uint8_t[]>* material,
34                                              size_t* size) const override;
35 
36     keymaster_error_t GenerateAttestation(const KeymasterContext& context,
37                                           const AuthorizationSet& attest_params,
38                                           const AuthorizationSet& tee_enforced,
39                                           const AuthorizationSet& sw_enforced,
40                                           keymaster_cert_chain_t* certificate_chain) const override;
41 
42     virtual bool InternalToEvp(EVP_PKEY* pkey) const = 0;
43     virtual bool EvpToInternal(const EVP_PKEY* pkey) = 0;
44 };
45 
46 }  // namespace keymaster
47 
48 #endif  // SYSTEM_KEYMASTER_ASYMMETRIC_KEY_H
49