Refactor KeyBlob to separate encryption functionality.
This CL is in preparation for another which will refactor libkeymaster
into libkeymaster and libkeymasterclient, the latter for use by programs
which merely interface with keymaster and don't do any crypto on their
own, but do need to parse key blobs to extract authorization list
entries. To make that possible it moves KeyBlob's key encryption and
decryption capabilities into a subclass, PlaintextKeyBlob.
Change-Id: Ic6a65b6f237c122796ea70458655111316f902d8
diff --git a/key.cpp b/key.cpp
index 74cb508..b665919 100644
--- a/key.cpp
+++ b/key.cpp
@@ -16,10 +16,9 @@
#include <openssl/x509.h>
-#include <keymaster/key_blob.h>
-
#include "asymmetric_key.h"
#include "openssl_utils.h"
+#include "unencrypted_key_blob.h"
#include "key.h"
@@ -35,7 +34,8 @@
}
/* static */
-Key* Key::CreateKey(const KeyBlob& blob, const Logger& logger, keymaster_error_t* error) {
+Key* Key::CreateKey(const UnencryptedKeyBlob& blob, const Logger& logger,
+ keymaster_error_t* error) {
switch (blob.algorithm()) {
case KM_ALGORITHM_RSA:
return new RsaKey(blob, logger, error);