//////////////////////////////////////////////////////////////////////////////// // 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. //////////////////////////////////////////////////////////////////////////////// #ifndef COMMON_SIGNER_PUBLIC_KEY_H_ #define COMMON_SIGNER_PUBLIC_KEY_H_ #include #include "common/hash_algorithm.h" #include "protos/public/drm_certificate.pb.h" namespace widevine { // SignerPublicKey is implemented for each provisioning key type that are // defined in video/widevine/proto/public.drm_certificate.proto. class SignerPublicKey { public: SignerPublicKey() = default; virtual ~SignerPublicKey() = default; SignerPublicKey(const SignerPublicKey&) = delete; SignerPublicKey& operator=(const SignerPublicKey&) = delete; // Verify message using |signer_public_key_| and |hash_algorithm|. virtual bool VerifySignature(const std::string& message, HashAlgorithm hash_algorithm, const std::string& signature) const = 0; // A factory method to create a SignerPublicKey. The |algorithm| is used to // create an appropriate SignerPublicKey for the key type. // The returned pointer is a nullptr if the key cannot be deserialized. static std::unique_ptr Create( const std::string& signer_public_key, DrmCertificate::Algorithm algorithm); }; } // namespace widevine #endif // COMMON_SIGNER_PUBLIC_KEY_H_