chromium/components/webcrypto/algorithms/rsa_oaep_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <stddef.h>
#include <stdint.h>

#include <string_view>

#include "base/base64url.h"
#include "base/containers/span.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/jwk.h"
#include "components/webcrypto/status.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_crypto_algorithm_params.h"
#include "third_party/blink/public/platform/web_crypto_key_algorithm.h"

namespace webcrypto {

namespace {

// Creates an RSA-OAEP algorithm
blink::WebCryptoAlgorithm CreateRsaOaepAlgorithm(
    const std::vector<uint8_t>& label) {}

std::string Base64EncodeUrlSafe(const std::vector<uint8_t>& input) {}

base::Value::Dict CreatePublicKeyJwkDict(
    base::flat_map<std::string, std::string> extra_properties) {}

class WebCryptoRsaOaepTest : public WebCryptoTestBase {};

// Import a PKCS#8 private key that uses RSAPrivateKey with the
// id-rsaEncryption OID.
TEST_F(WebCryptoRsaOaepTest, ImportPkcs8WithRsaEncryption) {}

TEST_F(WebCryptoRsaOaepTest, ImportPublicJwkWithNoAlg) {}

TEST_F(WebCryptoRsaOaepTest, ImportPublicJwkWithMatchingAlg) {}

TEST_F(WebCryptoRsaOaepTest, ImportPublicJwkWithMismatchedAlgFails) {}

TEST_F(WebCryptoRsaOaepTest, ImportPublicJwkWithMismatchedTypeFails) {}

TEST_F(WebCryptoRsaOaepTest, ExportPublicJwk) {}

struct RsaOaepKnownAnswer {};

const RsaOaepKnownAnswer kRsaOaepKnownAnswers[] =;

TEST_F(WebCryptoRsaOaepTest, EncryptDecryptKnownAnswerTest) {}

TEST_F(WebCryptoRsaOaepTest, EncryptWithLargeMessageFails) {}

// Ensures that if the selected hash algorithm for the RSA-OAEP message is too
// large, then it is rejected, independent of the actual message to be
// encrypted.
// For example, a 1024-bit RSA key is too small to accomodate a message that
// uses OAEP with SHA-512, since it requires 1040 bits to encode
// (2 * hash size + 2 padding bytes).
TEST_F(WebCryptoRsaOaepTest, EncryptWithLargeDigestFails) {}

TEST_F(WebCryptoRsaOaepTest, DecryptWithLargeMessageFails) {}

TEST_F(WebCryptoRsaOaepTest, WrapUnwrapRawKey) {}

TEST_F(WebCryptoRsaOaepTest, WrapUnwrapJwkSymKey) {}

TEST_F(WebCryptoRsaOaepTest, ImportExportJwkRsaPublicKey) {}

}  // namespace

}  // namespace webcrypto