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_HYBRID_HYBRID_DECRYPT_FACTORY_H_ 18 #define TINK_HYBRID_HYBRID_DECRYPT_FACTORY_H_ 19 20 #include <memory> 21 22 #include "absl/base/macros.h" 23 #include "tink/hybrid_decrypt.h" 24 #include "tink/key_manager.h" 25 #include "tink/keyset_handle.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<HybridDecrypt>() 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 // * HybridConfig::Register() 39 // * TinkConfig::Register() 40 class ABSL_DEPRECATED( 41 "Call getPrimitive<HybridDecrypt>() on the keyset_handle after registering " 42 "the HybridDecryptWrapper instead.") HybridDecryptFactory { 43 public: 44 // Returns a HybridDecrypt-primitive that uses key material from the keyset 45 // specified via 'keyset_handle'. 46 ABSL_DEPRECATED( 47 "Call getPrimitive<HybridDecrypt>() on the keyset_handle after " 48 "registering " 49 "the HybridEncryptWrapper instead.") 50 static crypto::tink::util::StatusOr<std::unique_ptr<HybridDecrypt>> 51 GetPrimitive(const KeysetHandle& keyset_handle); 52 53 // Returns a HybridDecrypt-primitive that uses key material from the keyset 54 // specified via 'keyset_handle' and is instantiated by the given 55 // 'custom_key_manager' (instead of the key manager from the Registry). 56 static crypto::tink::util::StatusOr<std::unique_ptr<HybridDecrypt>> 57 GetPrimitive(const KeysetHandle& keyset_handle, 58 const KeyManager<HybridDecrypt>* custom_key_manager); 59 60 private: HybridDecryptFactory()61 HybridDecryptFactory() {} 62 }; 63 64 } // namespace tink 65 } // namespace crypto 66 67 #endif // TINK_HYBRID_HYBRID_DECRYPT_FACTORY_H_ 68