summaryrefslogtreecommitdiff
path: root/chromium/net/test/key_util.h
blob: fdad8160744adeb70aee81b9de92a38e220154d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_TEST_KEY_UTIL_H_
#define NET_TEST_KEY_UTIL_H_

#include "base/memory/scoped_refptr.h"
#include "third_party/boringssl/src/include/openssl/base.h"

namespace base {
class FilePath;
}

namespace net {

class SSLPrivateKey;

namespace key_util {

// Loads a PEM-encoded private key file from |filepath| into an EVP_PKEY object.
// Returns the new EVP_PKEY or nullptr on error.
bssl::UniquePtr<EVP_PKEY> LoadEVP_PKEYFromPEM(const base::FilePath& filepath);

// Loads a PEM-encoded private key file into a SSLPrivateKey object.
// |filepath| is the private key file path.
// Returns the new SSLPrivateKey.
scoped_refptr<SSLPrivateKey> LoadPrivateKeyOpenSSL(
    const base::FilePath& filepath);

}  // namespace key_util

}  // namespace net

#endif  // NET_TEST_KEY_UTIL_H_