blob: 4e1efcdbf7fc940e70dee48579bf547ac64d803c [file]
// 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.
//
#ifndef THIRD_PARTY_CREDENTIO_CRYPTO_DEFAULT_CMS_OIDS_H_
#define THIRD_PARTY_CREDENTIO_CRYPTO_DEFAULT_CMS_OIDS_H_
#include <cstdint>
#include "openssl/bytestring.h"
#include "openssl/x509.h"
namespace credentio_cms {
// Abbreviations:
// rsadsi = RSA Data Security Inc
// pkcs = Public Key Cryptographic Standards
// https://tools.ietf.org/html/rfc5652#section-4
// iso(1) member-body(2) US(840) rsadsi(113549) pkcs(1) { pkcs-7 1 }
constexpr uint8_t kDataOid[] = {1 * 40 + 2, 0x86, 0x48, 0x86, 0xf7,
0x0d, 1, 7, 1};
// https://tools.ietf.org/html/rfc5652#section-5.1
// iso(1) member-body(2) US(840) rsadsi(113549) pkcs(1) { pkcs-7 2 }
constexpr uint8_t kSignedDataOid[] = {1 * 40 + 2, 0x86, 0x48, 0x86, 0xf7,
0x0d, 1, 7, 2};
// https://tools.ietf.org/html/rfc5652#section-5.3
// iso(1) member-body(2) US(840) rsadsi(113549) pkcs(1) { pkcs-7 3 }
constexpr uint8_t kEnvelopedDataOid[] = {1 * 40 + 2, 0x86, 0x48, 0x86, 0xf7,
0x0d, 1, 7, 3};
// https://tools.ietf.org/html/rfc5652#section-11.1
// iso(1) member-body(2) US(840) rsadsi(113549) pkcs(1) { pkcs-9 3 }
constexpr uint8_t kContentAttributeType[] = {1 * 40 + 2, 0x86, 0x48, 0x86, 0xf7,
0x0d, 1, 9, 3};
// https://tools.ietf.org/html/rfc5652#section-11.2
// iso(1) member-body(2) US(840) rsadsi(113549) pkcs(1) { pkcs-9 4 }
constexpr uint8_t kContentAttributeMessageDigest[] = {
1 * 40 + 2, 0x86, 0x48, 0x86, 0xf7, 0x0d, 1, 9, 4};
// https://tools.ietf.org/html/rfc5751
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 5
constexpr uint8_t kSigningTimeOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x09, 0x05};
// https://tools.ietf.org/html/rfc5751
constexpr uint8_t kSmimeCapabilitiesOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x09, 0x0F};
// https://tools.ietf.org/html/rfc7508#section-4.1
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
// attributes(2) 55
constexpr uint8_t kSecureHeaderFieldsIdentifierOid[] = {
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x10, 0x2, 55};
// SMIMEEncryptionKeyPreference
// https://tools.ietf.org/html/rfc5751#section-2.5.3
// {iso(1) member-body(2) usa(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
// attributes(2)} 11
constexpr uint8_t kSmimeEncryptionKeyPreferenceOid[] = {
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x10, 0x2, 11};
// http://csrc.nist.gov/groups/ST/crypto_apps_infra/csor/algorithms.html
constexpr uint8_t kSha256Oid[] = {0x60, 0x86, 0x48, 0x01, 0x65,
0x03, 0x04, 0x02, 0x01};
constexpr uint8_t kSha1WithRsaOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 1, 1, 1};
// https://tools.ietf.org/html/rfc5754#section-3.2
constexpr uint8_t kSha256WithRsaOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 1, 1, 11};
// https://tools.ietf.org/html/rfc5754#section-3.2
constexpr uint8_t kSha384WithRsaOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 1, 1, 12};
// https://tools.ietf.org/html/rfc5754#section-3.2
constexpr uint8_t kSha512WithRsaOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 1, 1, 13};
// https://tools.ietf.org/html/rfc4056
constexpr uint8_t kRsaSsaPssOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x01, 0x0a};
// https://tools.ietf.org/html/rfc4056
constexpr uint8_t kRsaEsOaepOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x01, 0x07};
// https://tools.ietf.org/html/rfc4056
constexpr uint8_t kRsaPkcs1Oid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x01, 0x01};
// https://tools.ietf.org/html/rfc3565
constexpr uint8_t kAes128CbcOid[] = {0x60, 0x86, 0x48, 0x01, 0x65, 3, 4, 1, 2};
// https://tools.ietf.org/html/rfc3565
constexpr uint8_t kAes192CbcOid[] = {0x60, 0x86, 0x48, 0x01, 0x65, 3, 4, 1, 22};
// https://tools.ietf.org/html/rfc3565
constexpr uint8_t kAes256CbcOid[] = {0x60, 0x86, 0x48, 0x01, 0x65, 3, 4, 1, 42};
// https://tools.ietf.org/html/rfc3370#section-5.1
constexpr uint8_t kDesEde3CbcOid[] = {0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x03, 0x07};
// https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.2
// iso(1) member-body(2) US(840) rsadsi(113549) pkcs(1) { pkcs-9 1 smime(16)
// ct(1) 4 }
constexpr uint8_t kCtTstInfoOid[] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
0x01, 0x09, 0x10, 0x01, 0x04};
// Returns true if the contents of data match expected.
bool CompareOid(const CBS& data, const uint8_t expected[],
size_t expected_length);
bool CompareOid(const CBS& a, const CBS& b);
} // namespace credentio_cms
#endif // THIRD_PARTY_CREDENTIO_CRYPTO_DEFAULT_CMS_OIDS_H_