@@ -35,9 +35,6 @@ def test_nanotdf_invalid_magic():
3535 nanotdf .read_nanotdf (bad_bytes , config )
3636
3737
38- @pytest .mark .skip (
39- "This test is skipped because NanoTDF encryption/decryption is not implemented yet."
40- )
4138@pytest .mark .integration
4239def test_nanotdf_integration_encrypt_decrypt ():
4340 # Load environment variables for integration
@@ -47,24 +44,16 @@ def test_nanotdf_integration_encrypt_decrypt():
4744 # Create KAS info from configuration
4845 kas_info = KASInfo (url = CONFIG_TDF .KAS_ENDPOINT )
4946
50- # Create KAS client with SSL verification disabled for testing
51- # from otdf_python.kas_client import KASClient
52- # client = KASClient(
53- # kas_url=CONFIG_TDF.KAS_ENDPOINT,
54- # verify_ssl=not CONFIG_TDF.INSECURE_SKIP_VERIFY,
55- # use_plaintext=bool(CONFIG_TDF.OPENTDF_PLATFORM_URL.startswith("http://")),
56- # )
57-
5847 nanotdf = NanoTDF ()
5948 data = b"test data"
60- config = NanoTDFConfig ( kas_info_list = [ kas_info ])
61- # These will raise NotImplementedError until implemented
62- try :
63- nanotdf_bytes = nanotdf . create_nanotdf ( data , config )
64- except NotImplementedError :
65- pytest . skip ( "NanoTDF encryption not implemented yet." )
66- try :
67- decrypted = nanotdf . read_nanotdf ( nanotdf_bytes , config )
68- except NotImplementedError :
69- pytest . skip ( "NanoTDF decryption not implemented yet." )
49+
50+ # Generate a key and include it in config for both encrypt and decrypt
51+ # Note: In a real scenario with KAS integration, the key would be wrapped
52+ # and unwrapped via KAS. For now, we're testing the basic encrypt/decrypt flow.
53+ key = secrets . token_bytes ( 32 )
54+ config = NanoTDFConfig ( kas_info_list = [ kas_info ], cipher = key . hex () )
55+
56+ # Create and read NanoTDF
57+ nanotdf_bytes = nanotdf . create_nanotdf ( data , config )
58+ decrypted = nanotdf . read_nanotdf ( nanotdf_bytes , config )
7059 assert decrypted == data
0 commit comments