aboutsummaryrefslogtreecommitdiff
path: root/cc/registry.h
diff options
context:
space:
mode:
authorBartosz Przydatek <przydatek@google.com>2018-07-27 00:27:34 -0700
committerCharles Lee <ckl@google.com>2018-07-27 12:26:19 -0700
commitf8ebc9fe9823e38971834343c4f7ea7f3ab860fc (patch)
tree3224728f7b56ed807bb1a242b26afef588ab603b /cc/registry.h
parentee005226a31a4e5084a6c292f1d6363b8a955ac6 (diff)
downloadtink-f8ebc9fe9823e38971834343c4f7ea7f3ab860fc.tar.gz
Adding C++ API to get public keys from private keys.
PiperOrigin-RevId: 206279840 GitOrigin-RevId: d77309c992f7328cb4ef4ad193e82d8d175003a4
Diffstat (limited to 'cc/registry.h')
-rw-r--r--cc/registry.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/cc/registry.h b/cc/registry.h
index 42e497d05..79692237f 100644
--- a/cc/registry.h
+++ b/cc/registry.h
@@ -132,6 +132,15 @@ class Registry {
std::unique_ptr<google::crypto::tink::KeyData>>
NewKeyData(const google::crypto::tink::KeyTemplate& key_template);
+ // Convenience method for extracting the public key data from the
+ // private key given in serialized_private_key.
+ // It looks up a KeyManager identified by type_url, which must
+ // be a PrivateKeyManager, and calls PrivateKeyManager::GetPublicKeyData.
+ static crypto::tink::util::StatusOr<
+ std::unique_ptr<google::crypto::tink::KeyData>>
+ GetPublicKeyData(const std::string& type_url,
+ const std::string& serialized_private_key);
+
// Resets the registry.
// After reset the registry is empty, i.e. it contains neither catalogues
// nor key managers. This method is intended for testing only.