// Copyright 2023 Google LLC. All Rights Reserved. This file and proprietary // source code may only be used and distributed under the Widevine License // Agreement. #ifndef BCC_PARSER_H_ #define BCC_PARSER_H_ #include #include #include #include #include #include #include namespace widevine { // BccParser processes a Provisioning 4.0 device root of trust. It extracts // relevant pieces of information and outputs to std::string. // Relevant documents: // Android definition: go/remote-provisioning-hal#bcc. // Google Dice Profile: go/dice-profile class BccParser { public: explicit BccParser() {} virtual ~BccParser() = default; BccParser(const BccParser&) = delete; BccParser& operator=(const BccParser&) = delete; // Parse and verify a client generated root of trust. This message is part of // an attestation model conforming to the Google Open Dice Profile. This // message is received from a client device to attest it is a valid Widevine // device. virtual std::string Parse(const std::vector& bcc); private: // Process and print CoseKey PubKeyEd25519 / PubKeyECDSA256. bool ProcessDevicePublicKeyInfo(std::stringstream& ss, const cppbor::Map& public_key_info_map); // Process and print the DiceChainEntryPayload, which contains subject public // key. bool ProcessDiceChainEntryPayload(std::stringstream& ss, std::string& payload); }; } // namespace widevine #endif // BCC_PARSER_H_