aboutsummaryrefslogtreecommitdiff
path: root/cc/key_manager.h
diff options
context:
space:
mode:
authorThomas Holenstein <tholenst@google.com>2018-09-27 09:24:36 -0700
committerTink Team <noreply@google.com>2018-10-02 14:32:52 -0400
commit5ff4236ce9caee5dace1882a89d91df7576decfb (patch)
tree1474fb10a4251b00c5ef58ba11142a113c314834 /cc/key_manager.h
parentc57b27a66e8bf7fc1ff2cd893a80f89abd43b71b (diff)
downloadtink-5ff4236ce9caee5dace1882a89d91df7576decfb.tar.gz
Add a new static method AlwaysFailingFactory(Status) to the KeyFactory class.
This allows us to remove a bunch of copy-paste code which was creating failing factories in the various public-key key-managers. PiperOrigin-RevId: 214785864 GitOrigin-RevId: ff3bab3cb46159e970577331488bbf2f96902c3b
Diffstat (limited to 'cc/key_manager.h')
-rw-r--r--cc/key_manager.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/cc/key_manager.h b/cc/key_manager.h
index 4b2b1ce6f..99e62a273 100644
--- a/cc/key_manager.h
+++ b/cc/key_manager.h
@@ -35,6 +35,11 @@ namespace tink {
// is independent of the primitive of the corresponding KeyManager.
class KeyFactory {
public:
+ // Helper function which creates a factory which always fails with a specified
+ // status.
+ static std::unique_ptr<KeyFactory> AlwaysFailingFactory(
+ const crypto::tink::util::Status& status);
+
// Generates a new random key, based on the specified 'key_format'.
virtual
crypto::tink::util::StatusOr<std::unique_ptr<portable_proto::MessageLite>>