def test_encrypt_without_bsn_decrypt_bsn(self): """ test encryption with bsn, but decryption without bsn verification. """ value = "abcdefg" bsn = "12345678" enc = encrypt(value) with self.assertRaises(InvalidToken): self.assertEqual(decrypt(enc, bsn), value)
def get_document_blob(encrypted_doc_id): user = get_tma_user() doc_id = decrypt(encrypted_doc_id, user["id"]) document = get_connection().get_document_blob(doc_id) new_response = make_response(document["file_data"]) new_response.headers["Content-Type"] = document["Content-Type"] return new_response
from sys import argv from decosjoin.api.decosjoin.decosjoin_connection import DecosJoinConnection from decosjoin.config import ( get_decosjoin_username, get_decosjoin_password, get_decosjoin_api_host, get_decosjoin_adres_boeken, ) import decosjoin.api.decosjoin.decosjoin_connection from decosjoin.crypto import decrypt bsn = argv[1] if argv[2] == "-d": zaak_id = decrypt(argv[3]) else: zaak_id = argv[2] decosjoin.api.decosjoin.decosjoin_connection.LOG_RAW = True connection = DecosJoinConnection( get_decosjoin_username(), get_decosjoin_password(), get_decosjoin_api_host(), get_decosjoin_adres_boeken(), ) documents = connection.get_documents(zaak_id, bsn) pprint(documents)
def test_encrypt_bsn_decrypt_without_bsn(self): """ test encryption with bsn, but decryption without bsn verification. """ value = "abcdefg" bsn = "12345678" enc = encrypt(value, bsn) self.assertEqual(decrypt(enc), value)
def test_encrypt_decrypt_bsn_invalid(self): value = "abcdefg" bsn = "12345678" enc = encrypt(value, bsn) with self.assertRaises(InvalidToken): self.assertEqual(decrypt(enc, "2345"), value)
def test_encrypt_decrypt_bsn(self): value = "abcdefg" bsn = "12345678" enc = encrypt(value, bsn) self.assertEqual(decrypt(enc, bsn), value) pass
def test_encrypt_decrypt(self): value = "abcdefg" enc = encrypt(value) self.assertEqual(decrypt(enc), value)
from sys import argv from decosjoin.api.decosjoin.decosjoin_connection import DecosJoinConnection from decosjoin.config import ( get_decosjoin_username, get_decosjoin_password, get_decosjoin_api_host, get_decosjoin_adres_boeken, ) import decosjoin.api.decosjoin.decosjoin_connection from decosjoin.crypto import decrypt if argv[1] == "-d": document_id = decrypt(argv[2]) else: document_id = argv[1] decosjoin.api.decosjoin.decosjoin_connection.LOG_RAW = True connection = DecosJoinConnection( get_decosjoin_username(), get_decosjoin_password(), get_decosjoin_api_host(), get_decosjoin_adres_boeken(), ) document = connection.get_document_blob(document_id) # printing is done by LOG_RAW
def get_documents(encrypted_zaak_id): user = get_tma_user() zaak_id = decrypt(encrypted_zaak_id, user["id"]) documents = get_connection().get_documents(zaak_id, user["id"]) return success_response_json(documents)