1 // Copyright 2017 Google Inc. 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_SIGNATURE_PUBLIC_KEY_VERIFY_FACTORY_H_ 18 #define TINK_SIGNATURE_PUBLIC_KEY_VERIFY_FACTORY_H_ 19 20 #include <memory> 21 22 #include "absl/base/macros.h" 23 #include "tink/key_manager.h" 24 #include "tink/keyset_handle.h" 25 #include "tink/public_key_verify.h" 26 #include "tink/util/statusor.h" 27 28 namespace crypto { 29 namespace tink { 30 31 /////////////////////////////////////////////////////////////////////////////// 32 // This class is deprecated. Call keyset_handle->GetPrimitive<PublicKeyVerify>() 33 // instead. 34 // 35 // Note that in order to for this change to be safe, the AeadSetWrapper has to 36 // be registered in your binary before this call. This happens automatically if 37 // you call one of 38 // * SignatureConfig::Register() 39 // * TinkConfig::Register() 40 class ABSL_DEPRECATED( 41 "Call getPrimitive<PublicKeyVerify>() on the keyset_handle after " 42 "registering the PublicKeyVerifyWrapper instead.") PublicKeyVerifyFactory { 43 public: 44 // Returns a PublicKeyVerify-primitive that uses key material from the keyset 45 // specified via 'keyset_handle'. 46 static crypto::tink::util::StatusOr<std::unique_ptr<PublicKeyVerify>> 47 GetPrimitive(const KeysetHandle& keyset_handle); 48 49 // Returns a PublicKeyVerify-primitive that uses key material from the keyset 50 // specified via 'keyset_handle' and is instantiated by the given 51 // 'custom_key_manager' (instead of the key manager from the Registry). 52 static crypto::tink::util::StatusOr<std::unique_ptr<PublicKeyVerify>> 53 GetPrimitive(const KeysetHandle& keyset_handle, 54 const KeyManager<PublicKeyVerify>* custom_key_manager); 55 56 private: PublicKeyVerifyFactory()57 PublicKeyVerifyFactory() {} 58 }; 59 60 } // namespace tink 61 } // namespace crypto 62 63 #endif // TINK_SIGNATURE_PUBLIC_KEY_VERIFY_FACTORY_H_ 64