diff options
Diffstat (limited to 'brillo/secure_blob.h')
-rw-r--r-- | brillo/secure_blob.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/brillo/secure_blob.h b/brillo/secure_blob.h index 7b6d03c..7705c1a 100644 --- a/brillo/secure_blob.h +++ b/brillo/secure_blob.h @@ -14,7 +14,10 @@ namespace brillo { +// TODO(sarthakkukreti): remove temp. SecureVector once we break SecureBlob's +// dependence on std::vector<uint8_t> using Blob = std::vector<uint8_t>; +using SecureVector = std::vector<uint8_t>; // Conversion of Blob to/from std::string, where the string holds raw byte // contents. @@ -69,6 +72,14 @@ BRILLO_EXPORT BRILLO_DISABLE_ASAN void* SecureMemset(void* v, int c, size_t n); // [n] and not on the relationship of the match between [s1] and [s2]. BRILLO_EXPORT int SecureMemcmp(const void* s1, const void* s2, size_t n); +// Conversion of SecureBlob data to/from SecureBlob hex. This is useful +// for sensitive data like encryption keys, that should, in the ideal case never +// be exposed as strings in the first place. In case the existing data or hex +// string is already exposed as a std::string, it is preferable to use the +// BlobToString variant. +BRILLO_EXPORT SecureBlob SecureBlobToSecureHex(const SecureBlob& blob); +BRILLO_EXPORT SecureBlob SecureHexToSecureBlob(const SecureBlob& hex); + } // namespace brillo #endif // LIBBRILLO_BRILLO_SECURE_BLOB_H_ |