blob: f3b696f1a631c633f6562cd3a0064c4b495de0e7 [file] [log] [blame]
// Copyright 2018 Google Inc.
//
// 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
//
// http://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 TINK_SUBTLE_WYCHEPROOF_UTIL_H_
#define TINK_SUBTLE_WYCHEPROOF_UTIL_H_
#include <memory>
#include "include/rapidjson/document.h"
#include "tink/subtle/common_enums.h"
namespace crypto {
namespace tink {
namespace subtle {
// WycheproofUtil is a util that is used to read test vectors from project
// Wycheproof and convert the values in the test vectors into corresponding
// values for tink.
class WycheproofUtil {
public:
// Converts a JSON value into a byte array.
// Byte arrays are always hexadecimal representation.
static std::string GetBytes(const rapidjson::Value &val);
// Reads test vector from a file.
// The filename is relative to the directory with the test vectors.
static std::unique_ptr<rapidjson::Document> ReadTestVectors(
const std::string &filename);
static HashType GetHashType(const rapidjson::Value &val);
static EllipticCurveType GetEllipticCurveType(const rapidjson::Value &val);
};
} // namespace subtle
} // namespace tink
} // namespace crypto
#endif // TINK_SUBTLE_WYCHEPROOF_UTIL_H_