-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move AddHybridV0() to hybrid/internal/.
PiperOrigin-RevId: 575942022 Change-Id: I34055e26a8a4bd265e792d94f53daa0f8b7ee47d
- Loading branch information
1 parent
7419feb
commit 00e4b50
Showing
11 changed files
with
431 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// 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. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "tink/hybrid/internal/config_v0.h" | ||
|
||
#include "absl/memory/memory.h" | ||
#include "tink/configuration.h" | ||
#include "tink/hybrid/ecies_aead_hkdf_private_key_manager.h" | ||
#include "tink/hybrid/ecies_aead_hkdf_public_key_manager.h" | ||
#include "tink/hybrid/hybrid_decrypt_wrapper.h" | ||
#include "tink/hybrid/hybrid_encrypt_wrapper.h" | ||
#include "tink/hybrid/internal/hpke_private_key_manager.h" | ||
#include "tink/hybrid/internal/hpke_public_key_manager.h" | ||
#include "tink/internal/configuration_impl.h" | ||
#include "tink/util/status.h" | ||
|
||
namespace crypto { | ||
namespace tink { | ||
namespace internal { | ||
|
||
util::Status AddHybridConfigV0(Configuration& config) { | ||
util::Status status = ConfigurationImpl::AddPrimitiveWrapper( | ||
absl::make_unique<HybridEncryptWrapper>(), config); | ||
if (!status.ok()) { | ||
return status; | ||
} | ||
status = ConfigurationImpl::AddPrimitiveWrapper( | ||
absl::make_unique<HybridDecryptWrapper>(), config); | ||
if (!status.ok()) { | ||
return status; | ||
} | ||
|
||
status = ConfigurationImpl::AddAsymmetricKeyManagers( | ||
absl::make_unique<EciesAeadHkdfPrivateKeyManager>(), | ||
absl::make_unique<EciesAeadHkdfPublicKeyManager>(), config); | ||
if (!status.ok()) { | ||
return status; | ||
} | ||
return ConfigurationImpl::AddAsymmetricKeyManagers( | ||
absl::make_unique<HpkePrivateKeyManager>(), | ||
absl::make_unique<HpkePublicKeyManager>(), config); | ||
} | ||
|
||
} // namespace internal | ||
} // namespace tink | ||
} // namespace crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// 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_HYBRID_INTERNAL_CONFIG_V0_H_ | ||
#define TINK_HYBRID_INTERNAL_CONFIG_V0_H_ | ||
|
||
#include "tink/configuration.h" | ||
#include "tink/util/status.h" | ||
|
||
namespace crypto { | ||
namespace tink { | ||
namespace internal { | ||
|
||
// Add recommended Hybrid Encryption primitive wrappers and key managers to | ||
// `config`, used to generate primitives. | ||
util::Status AddHybridConfigV0(Configuration& config); | ||
|
||
} // namespace internal | ||
} // namespace tink | ||
} // namespace crypto | ||
|
||
#endif // TINK_HYBRID_INTERNAL_CONFIG_V0_H_ |
Oops, something went wrong.