Skip to content

Commit

Permalink
Update cpfx.py
Browse files Browse the repository at this point in the history
  • Loading branch information
li0ard authored Oct 25, 2022
1 parent aae6b74 commit 69c3d7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
uid = str(uuid.uuid4())
f = open("exported_" + uid + ".pem", "w")
f.write(key2pem(Ks, oids, algooid))
f.close()
print("Сохранено в exported_" + uid + ".pem")

0 comments on commit 69c3d7d

Please sign in to comment.