| // Copyright 2026 Google LLC | |
| // | |
| // Licensed under the Apache License, Version 2.0 (the "License"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // https://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software | |
| // distributed under the License is distributed on an "AS IS" BASIS, | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| // See the License for the specific language governing permissions and | |
| // limitations under the License. | |
| // | |
| // Constants for use in parsing JUMBF data. All values from ISO/IEC 19566-5. | |
| // | |
| // Note that all values here are in machine endianness. The standard calls for | |
| // them to be serialized in big-endian order. | |
| #ifndef THIRD_PARTY_CREDENTIO_JUMBF_CONSTANTS_H_ | |
| #define THIRD_PARTY_CREDENTIO_JUMBF_CONSTANTS_H_ | |
| #include <cstdint> | |
| #include "uuid/uuid.h" | |
| namespace jumbf { | |
| // Toggle masks for description boxes. (See A.3) | |
| inline constexpr uint8_t kDescriptionToggleEmpty = 0b0000'0000; | |
| inline constexpr uint8_t kDescriptionToggleRequestable = 0b0000'0001; | |
| inline constexpr uint8_t kDescriptionToggleLabelPresent = 0b0000'0010; | |
| inline constexpr uint8_t kDescriptionToggleIdPresent = 0b0000'0100; | |
| inline constexpr uint8_t kDescriptionToggleHashPresent = 0b0000'1000; | |
| inline constexpr uint8_t kDescriptionTogglePrivatePresent = 0b0001'0000; | |
| // Toggle masks for embedded file description boxes (EFDB). (See B.6.2) | |
| inline constexpr uint8_t kEfdbToggleFileNamePresent = 0b0000'0001; | |
| inline constexpr uint8_t kEfdbToggleExternal = 0b0000'0010; | |
| // Box types (TBox values). These are the values that apply to individual boxes, | |
| // not description boxes. (See 4.3, A.1 and B) | |
| // | |
| // "jumb" - Superbox (also referred to in the standard as simply "box") | |
| inline constexpr uint32_t kSuperBoxType = 0x6a75'6d62; | |
| // "jumd" - Description box | |
| inline constexpr uint32_t kDescriptionBoxType = 0x6a75'6d64; | |
| // "cbor" - CBOR content box | |
| inline constexpr uint32_t kCborBoxType = 0x6362'6f72; | |
| // "free" - Padding box | |
| inline constexpr uint32_t kPaddingBoxType = 0x6672'6565; | |
| // "bfdb" - Embedded file description box | |
| inline constexpr uint32_t kEmbeddedFileDescriptionBoxType = 0x6266'6462; | |
| // "bidb" - Binary data box | |
| inline constexpr uint32_t kBinaryDataBoxType = 0x6269'6462; | |
| // "priv" - Private content super box | |
| inline constexpr uint32_t kPrivateContentBoxType = 0x7072'6976; | |
| // "c2sh" - C2PA salt box, see C2PA 2.0 section 8.3.1.3 | |
| inline constexpr uint32_t kC2paSaltBoxType = 0x6332'7368; | |
| // "json" - JSON content box | |
| inline constexpr uint32_t kJsonBoxType = 0x6a73'6f6e; | |
| // "uuid" - UUID content box | |
| inline constexpr uint32_t kUuidBoxType = 0x7575'6964; | |
| inline constexpr auto kCborBoxTypeUuid = | |
| credentio::Uuid::FromStringOrDie("63626F72-0011-0010-8000-00AA00389B71"); | |
| inline constexpr auto kJsonBoxTypeUuid = | |
| credentio::Uuid::FromStringOrDie("6A736F6E-0011-0010-8000-00AA00389B71"); | |
| inline constexpr auto kC2PARedactionUuid = | |
| credentio::Uuid::FromStringOrDie("CAA98EEE-9D4D-F80E-86AD-4DFFCA263973"); | |
| } // namespace jumbf | |
| #endif // THIRD_PARTY_CREDENTIO_JUMBF_CONSTANTS_H_ |