blob: 00affefc57765baf9e2fd8c283a6e54f9c062492 [file] [log] [blame]
Shawn Willdend67afae2014-08-19 12:36:27 -06001/*
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
Shawn Willden95e13822014-12-15 16:12:16 -070017#include "key.h"
18
Shawn Willden437fbd12014-08-20 11:59:49 -060019#include <openssl/x509.h>
20
Shawn Willden2c8dd3e2014-09-18 15:16:31 -060021#include "ecdsa_key.h"
Shawn Willden437fbd12014-08-20 11:59:49 -060022#include "openssl_utils.h"
Shawn Willden2c8dd3e2014-09-18 15:16:31 -060023#include "rsa_key.h"
Shawn Willden95e13822014-12-15 16:12:16 -070024#include "symmetric_key.h"
Shawn Willden72014ad2014-09-17 13:04:10 -060025#include "unencrypted_key_blob.h"
Shawn Willdend67afae2014-08-19 12:36:27 -060026
Shawn Willdend67afae2014-08-19 12:36:27 -060027namespace keymaster {
28
Shawn Willdena278f612014-12-23 11:22:21 -070029/* static */
30template <> KeyFactoryRegistry* KeyFactoryRegistry::instance_ptr = 0;
Shawn Willden437fbd12014-08-20 11:59:49 -060031
Shawn Willden2f3be362014-08-25 11:31:39 -060032Key::Key(const KeyBlob& blob, const Logger& logger) : logger_(logger) {
Shawn Willdend67afae2014-08-19 12:36:27 -060033 authorizations_.push_back(blob.unenforced());
34 authorizations_.push_back(blob.enforced());
35}
36
Shawn Willdena278f612014-12-23 11:22:21 -070037struct PKCS8_PRIV_KEY_INFO_Delete {
38 void operator()(PKCS8_PRIV_KEY_INFO* p) const { PKCS8_PRIV_KEY_INFO_free(p); }
39};
Shawn Willden437fbd12014-08-20 11:59:49 -060040
Shawn Willdend67afae2014-08-19 12:36:27 -060041} // namespace keymaster