How can I decrypt in ODI procedure a file encrypted with Python Fernet Library — oracle-tech

    Forum Stats

  • 3,715,501 Users
  • 2,242,777 Discussions
  • 7,845,371 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How can I decrypt in ODI procedure a file encrypted with Python Fernet Library

User_0BFBN
User_0BFBN Member Posts: 2 Blue Ribbon
edited November 2020 in Oracle Data Integrator

I am facing this scenario in ODI 12c

I am going to receive one file encrypted (by fernet library on python) and the corresponding key for it (*.sha file).

I know ODI can run some python-fashioned commands using a user procedure, but I am not sure all the settings I need to put in place in procedure definition window and if there is additional configuration to run those Python commands. Actually the task command in my procedure is still in python (See below). But I think I should use Jython instead of Python commands. Any advice will be appreciated:


from cryptography.fernet import Fernet

fkey = open("llave.sha", 'rb') 

key = fkey.read()

cipher = Fernet(key)

with open('#SIVALE_INT.NombreArchivoCatKonfioEnc','rb') as df:

  encrypted_data = df.read()

decrypted_file = cipher.decrypt(encrypted_data)

with open('#SIVALE_INT.NombreArchivoCatKonfio','wb') as df:

  df.write(decrypted_file)


Thanks in advance.


Antonio


Answers

  • User_0BFBN
    User_0BFBN Member Posts: 2 Blue Ribbon

    This is the error when running the package:

    ODI-1228: Task Procedure-PR_DESENCRIPTA_ARCHIVO-Desencripta_Archivo fails on the target connection File_SiVale.

    Caused By: java.sql.SQLException: ODI-40400: Invalid format description

    at com.sunopsis.jdbc.driver.file.impl.metadata.MetaDataExtractor.buildTableDescFromRequestSQLExceptionOnly(MetaDataExtractor.java:480)

Sign In or Register to comment.