from pysap.SAPPSE import *
from IPython.display import display

"""
Explanation: SAP PSE
The following subsections show a representation of the file format portions and how to generate them.
First we need to perform some setup to import the packet classes:
End of explanation
"""


with open("../../tests/data/pse_v2_lps_off_pbes1_3des_sha1.pse", "rb") as fd:
    pse_v2_string = fd.read()
    
pse_v2 = SAPPSEFile(pse_v2_string)          

with open("../../tests/data/pse_v4_lps_off_pbes1_3des_sha1.pse", "rb") as fd:
    pse_v4_string = fd.read()

pse_v4 = SAPPSEFile(pse_v4_string)

"""
Explanation: PSE file
We'll read the files used in the test case suite and use them as example:
End of explanation
"""


pse_v2.show()

"""
Explanation: The PSE file is comprised of the following main structures:
PSE version 2 Encrypted content
End of explanation
"""


pse_v4.show()

"""
Explanation: PSE version 4 Encrypted content
End of explanation
"""


pse_v2.decrypt("1234567980")

"""
Explanation: PSE Encrypted content decryption
The content of the PSE file can be decrypted given the proper PIN is provided.
End of explanation
"""


