1 // Copyright 2021 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 /////////////////////////////////////////////////////////////////////////////// 16 17 #ifndef TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SUBTLE_SPHINCS_VERIFY_H_ 18 #define TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SUBTLE_SPHINCS_VERIFY_H_ 19 20 #include <memory> 21 #include <string> 22 #include <utility> 23 24 #include "tink/experimental/pqcrypto/signature/subtle/sphincs_subtle_utils.h" 25 #include "tink/internal/fips_utils.h" 26 #include "tink/public_key_verify.h" 27 #include "tink/util/secret_data.h" 28 #include "tink/util/statusor.h" 29 30 namespace crypto { 31 namespace tink { 32 namespace subtle { 33 34 class SphincsVerify : public PublicKeyVerify { 35 public: 36 static constexpr crypto::tink::internal::FipsCompatibility kFipsStatus = 37 crypto::tink::internal::FipsCompatibility::kNotFips; 38 39 static crypto::tink::util::StatusOr<std::unique_ptr<PublicKeyVerify>> New( 40 SphincsPublicKeyPqclean key); 41 42 // Verifies that 'signature' is a digital signature for 'data'. 43 crypto::tink::util::Status Verify(absl::string_view signature, 44 absl::string_view data) const override; 45 46 private: SphincsVerify(SphincsPublicKeyPqclean key)47 explicit SphincsVerify(SphincsPublicKeyPqclean key) : key_(std::move(key)) {} 48 49 const SphincsPublicKeyPqclean key_; 50 }; 51 52 } // namespace subtle 53 } // namespace tink 54 } // namespace crypto 55 56 #endif // TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SUBTLE_SPHINCS_VERIFY_H_ 57