483b06
From c6b9b76307faa001670bc990fbe88aeb23bad403 Mon Sep 17 00:00:00 2001
483b06
From: Christian Heimes <cheimes@redhat.com>
483b06
Date: Wed, 26 Apr 2017 18:15:40 +0200
483b06
Subject: [PATCH] Vault: Explicitly default to 3DES CBC
483b06
483b06
The server-side plugin for IPA Vault relied on the fact that the default
483b06
oid for encryption algorithm is 3DES in CBC mode (DES-EDE3-CBC). Dogtag
483b06
10.4 has changed the default from 3DES to AES. Pass the correct
483b06
algorithm OID to KeyClient.archive_encrypted_data().
483b06
483b06
Closes: https://pagure.io/freeipa/issue/6899
483b06
Signed-off-by: Christian Heimes <cheimes@redhat.com>
483b06
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
483b06
---
483b06
 ipaserver/plugins/vault.py | 12 ++++++++++--
483b06
 1 file changed, 10 insertions(+), 2 deletions(-)
483b06
483b06
diff --git a/ipaserver/plugins/vault.py b/ipaserver/plugins/vault.py
483b06
index 57e1ed7800063822f87da5a71f0f3a0df4d8dd33..d46aca821d2ec94a38dd7cc930f26038d5d80a90 100644
483b06
--- a/ipaserver/plugins/vault.py
483b06
+++ b/ipaserver/plugins/vault.py
483b06
@@ -38,6 +38,14 @@ from ipapython.dn import DN
483b06
 if api.env.in_server:
483b06
     import pki.account
483b06
     import pki.key
483b06
+    # pylint: disable=no-member
483b06
+    try:
483b06
+        # pki >= 10.4.0
483b06
+        from pki.crypto import DES_EDE3_CBC_OID
483b06
+    except ImportError:
483b06
+        DES_EDE3_CBC_OID = pki.key.KeyClient.DES_EDE3_CBC_OID
483b06
+    # pylint: enable=no-member
483b06
+
483b06
 
483b06
 if six.PY3:
483b06
     unicode = str
483b06
@@ -1059,8 +1067,8 @@ class vault_archive_internal(PKQuery):
483b06
                 pki.key.KeyClient.PASS_PHRASE_TYPE,
483b06
                 wrapped_vault_data,
483b06
                 wrapped_session_key,
483b06
-                None,
483b06
-                nonce,
483b06
+                algorithm_oid=DES_EDE3_CBC_OID,
483b06
+                nonce_iv=nonce,
483b06
             )
483b06
 
483b06
             kra_account.logout()
483b06
-- 
483b06
2.12.2
483b06