Merge "Added patch to store barbican data in ascii format in DB"

This commit is contained in:
Zuul 2022-06-02 13:15:52 +00:00 committed by Gerrit Code Review
commit e0592d6086
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From 754fc74974be3b854173f7ce51ed0e248eb24b03 Mon Sep 17 00:00:00 2001
From: Andy Ning <andy.ning@windriver.com>
Date: Tue, 24 May 2022 10:33:02 -0400
Subject: [PATCH] Store secret data in ascii format in DB
Store secret data (plugin_meta and cypher_text) in ascii format
instead of hex format in database.
Signed-off-by: Andy Ning <andy.ning@windriver.com>
---
barbican/plugin/store_crypto.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/barbican/plugin/store_crypto.py b/barbican/plugin/store_crypto.py
index c13e59c..843d5a8 100644
--- a/barbican/plugin/store_crypto.py
+++ b/barbican/plugin/store_crypto.py
@@ -311,7 +311,8 @@ def _store_secret_and_datum(
# setup and store encrypted datum
datum_model = models.EncryptedDatum(secret_model, kek_datum_model)
datum_model.content_type = context.content_type
- datum_model.cypher_text = base64.b64encode(generated_dto.cypher_text)
+ datum_model.cypher_text = \
+ base64.b64encode(generated_dto.cypher_text).decode('utf-8')
datum_model.kek_meta_extended = generated_dto.kek_meta_extended
repositories.get_encrypted_datum_repository().create_from(
datum_model)
@@ -333,4 +334,4 @@ def _indicate_bind_completed(kek_meta_dto, kek_datum):
kek_datum.algorithm = kek_meta_dto.algorithm
kek_datum.bit_length = kek_meta_dto.bit_length
kek_datum.mode = kek_meta_dto.mode
- kek_datum.plugin_meta = kek_meta_dto.plugin_meta
+ kek_datum.plugin_meta = kek_meta_dto.plugin_meta.decode('utf-8')
--
2.25.1

View File

@ -0,0 +1 @@
0001-Store-secret-data-in-ascii-format-in-DB.patch