def test_cred_v2_lps_off_3des_decrypt(self): """Test decryption of a 3DES encrypted credential with LPS off""" with open(data_filename("cred_v2_lps_off_3des"), "rb") as fd: s = fd.read() cred = SAPCredv2(s).creds[0].cred plain = cred.decrypt(self.decrypt_username) self.assertEqual(plain.pin.val, self.decrypt_pin)
def test_cred_v2_lps_on_int_aes256_decrypt(self): """Test decryption of a AES256 encrypted credential with LPS on, INT type""" with open(data_filename("cred_v2_lps_on_int_aes256"), "rb") as fd: s = fd.read() cred = SAPCredv2(s).creds[0].cred plain = cred.decrypt() self.assertEqual(plain.pin.val, self.decrypt_pin)
def test_cred_v2_lps_off_dp_3des_decrypt(self): """Test decryption of a 3DES encrypted credential with LPS off using DP (Windows)""" with open(data_filename("cred_v2_lps_off_dp_3des"), "rb") as fd: s = fd.read() cred = SAPCredv2(s).creds[0].cred plain = cred.decrypt(self.decrypt_username) self.assertEqual(plain.option1, SAPCredv2_Cred_Plain.PROVIDER_MSCryptProtect)
def test_cred_v2_lps_on_dp_aes256(self): """Test parsing of a AES256 encrypted credential with LPS on, DP type""" with open(data_filename("cred_v2_lps_on_dp_aes256"), "rb") as fd: s = fd.read() creds = SAPCredv2(s).creds self.assertEqual(len(creds), 1) cred = creds[0].cred self.assertEqual(cred.common_name, self.common_name) self.assertEqual(cred.pse_file_path, self.pse_path_win) self.assertEqual(cred.lps_type, 1) self.assertEqual(cred.cipher_format_version, 2) self.assertEqual(cred.version.val, 2) self.assertEqual(cred.oid.val, "2.5.4.3") self.assertEqual(cred.value.val, self.common_name) self.assertEqual(cred.pse_path, self.pse_path_win)
def test_cred_v2_lps_off_dp_3des(self): """Test parsing of a 3DES encrypted credential with LPS off using DP (Windows)""" with open(data_filename("cred_v2_lps_off_dp_3des"), "rb") as fd: s = fd.read() creds = SAPCredv2(s).creds self.assertEqual(len(creds), 1) cred = creds[0].cred self.assertEqual(cred.common_name, self.cert_name) self.assertEqual(cred.pse_file_path, self.pse_path_win) self.assertEqual(cred.lps_type, None) self.assertEqual(cred.cipher_format_version, 0) self.assertEqual(cred.cipher_algorithm, CIPHER_ALGORITHM_3DES) self.assertEqual(cred.cert_name, self.cert_name) self.assertEqual(cred.unknown1, "") self.assertEqual(cred.pse_path, self.pse_path_win) self.assertEqual(cred.unknown2, "")
def test_cred_v2_lps_off_aes256(self): """Test parsing of a AES256 encrypted credential with LPS off""" with open(data_filename("cred_v2_lps_off_aes256"), "rb") as fd: s = fd.read() creds = SAPCredv2(s).creds self.assertEqual(len(creds), 1) cred = creds[0].cred self.assertEqual(cred.common_name, self.cert_name) self.assertEqual(cred.pse_file_path, self.pse_path) self.assertEqual(cred.lps_type, None) self.assertEqual(cred.cipher_format_version, 1) self.assertEqual(cred.cipher_algorithm, CIPHER_ALGORITHM_AES256) self.assertEqual(cred.cert_name, self.cert_name) self.assertEqual(cred.unknown1, "") self.assertEqual(cred.pse_path, self.pse_path) self.assertEqual(cred.unknown2, "")