key_util.h 948 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_TEST_KEY_UTIL_H_
  5. #define NET_TEST_KEY_UTIL_H_
  6. #include "base/memory/scoped_refptr.h"
  7. #include "third_party/boringssl/src/include/openssl/base.h"
  8. namespace base {
  9. class FilePath;
  10. }
  11. namespace net {
  12. class SSLPrivateKey;
  13. namespace key_util {
  14. // Loads a PEM-encoded private key file from |filepath| into an EVP_PKEY object.
  15. // Returns the new EVP_PKEY or nullptr on error.
  16. bssl::UniquePtr<EVP_PKEY> LoadEVP_PKEYFromPEM(const base::FilePath& filepath);
  17. // Loads a PEM-encoded private key file into a SSLPrivateKey object.
  18. // |filepath| is the private key file path.
  19. // Returns the new SSLPrivateKey.
  20. scoped_refptr<SSLPrivateKey> LoadPrivateKeyOpenSSL(
  21. const base::FilePath& filepath);
  22. } // namespace key_util
  23. } // namespace net
  24. #endif // NET_TEST_KEY_UTIL_H_