44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2019 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Description:
|
|
// Declaration for abstract EC key generation class.
|
|
|
|
#ifndef COMMON_EC_KEY_SOURCE_H_
|
|
#define COMMON_EC_KEY_SOURCE_H_
|
|
|
|
#include <string>
|
|
|
|
#include "common/ec_key.h"
|
|
|
|
namespace widevine {
|
|
|
|
class ECKeySource {
|
|
public:
|
|
ECKeySource() = default;
|
|
virtual ~ECKeySource() = default;
|
|
|
|
// Get an EC key pair given a specific curve defined by EllipticCurve.
|
|
// Parameter |curve| is a standard curve which defines the parameters of the
|
|
// key generation.
|
|
// Parameter |private_key| is the serialized EC private key.
|
|
// Parameter |public_key| is the serialized EC public key.
|
|
// Caller retains ownership of all pointers and they cannot be nullptr.
|
|
// Returns true if successful, false otherwise.
|
|
virtual bool GetECKey(ECPrivateKey::EllipticCurve curve,
|
|
std::string* private_key, std::string* public_key) = 0;
|
|
|
|
private:
|
|
ECKeySource(const ECKeySource&) = delete;
|
|
ECKeySource& operator=(const ECKeySource&) = delete;
|
|
};
|
|
|
|
} // namespace widevine
|
|
|
|
#endif // COMMON_EC_KEY_SOURCE_H_
|