From 69c3d7da2c68501d4f2c003476b9d16f2a474401 Mon Sep 17 00:00:00 2001 From: Artem Petrenko <47205258+li0ard@users.noreply.github.com> Date: Tue, 25 Oct 2022 20:35:29 +0600 Subject: [PATCH] Update cpfx.py --- cpfx.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpfx.py b/cpfx.py index faab30d..e4140a6 100644 --- a/cpfx.py +++ b/cpfx.py @@ -3,7 +3,7 @@ from pygost.asn1schemas.x509 import GostR34102012PublicKeyParameters from pygost.gost341194 import GOST341194 from pygost.gost28147 import cfb_decrypt, ecb_decrypt, DEFAULT_SBOX -import sys, pyderasn, asn1, getpass +import sys, pyderasn, asn1, getpass, uuid from pyderasn import ObjectIdentifier, OctetString, Integer from schemas import * from pygost.kdf import kdf_gostr3411_2012_256 @@ -113,4 +113,8 @@ def unwrap_gost(kek, data, sbox=DEFAULT_SBOX): buff.append(unwrap_gost(KEKe, bytes.fromhex(ukm + i + cek_mac)).hex()) Ks = bytes.fromhex("".join(buff)) print(" K = " + Ks.hex()) -print(key2pem(Ks, oids, algooid)) \ No newline at end of file +uid = str(uuid.uuid4()) +f = open("exported_" + uid + ".pem", "w") +f.write(key2pem(Ks, oids, algooid)) +f.close() +print("Сохранено в exported_" + uid + ".pem")