Forum Discussion

HRunyon's avatar
HRunyon
New Contributor III
2 years ago

Need physical path to file

I am implementing a BR that pulls a file from FTP. The file is encrypted so I need to decrypt it using a third party library. In order to decrypt it, I need to pass in a physical path to the PGP key provided. I uploaded the key to the Public folder share for now but cannot seem to find a way to get the actual physical file. Does anyone know if uploading a file to the share folder results in an actual file being created on the server or is it just stored as a BLOB in the database?

 

  • Actually I got it. I was uploading the file to the application DB folder vs. the File Share folder. I was able to get everything to work.

  • Unfortunately, I cannot send you the BR but can provide some sample code for you. Please note that the following two DLL files (provided by purchasing the DidiSoft software) need to be placed into the client integration folder:

    • DidiSoft.BouncyCastle.dll
    • DidiSoft.Pgp.dll

    This can be done by submitting a ticket to OneStream. Once completed, then your BR must reference the DidiSOFT.pgp.dll file.

     

    You will also need the path to the PGP key as well as the PGP key password if applicable.

     

    Place this code in the top of your BR:

    Imports DidiSoft.Pgp

    Imports DidiSoft.Pgp.Exceptions

     

    Function for decrypting:

    Public Function DecryptFile(encryptedFilename As String,si As SessionInfo) As String

                    Dim pgpKey As String = $\\XXX.file.core.windows.net\onestreamshareprd1\FileShare\Applications\OneStreamDevelopment\Contents\XXXDecryptionCertificate_priv.asc

                    Dim pgpKeyPassword as String = "PASSWORD"

                    Dim newName As String =  encryptedFilename.Replace(".pgp", "")

                    Dim clsPGP As PGPLib = New PGPLib()

                    clsPGP.DecryptFile(encryptedFilename,pgpKey,pgpKeyPassword ,newName)

                                                   

                    'Now remove the initial PGP file

                    System.IO.File.Delete(encryptedFilename)

                    Return newName

    End Function

     

    Hope this helps, and good luck.

  • HRunyon's avatar
    HRunyon
    New Contributor III

    Actually I got it. I was uploading the file to the application DB folder vs. the File Share folder. I was able to get everything to work.

  • KKGamer's avatar
    KKGamer
    New Contributor III

    Hi HRunyon - Can you share sample BR rules for PGP decryption/encryption? We have a similar requirement for this.

    Thanks

     

     

    • HRunyon's avatar
      HRunyon
      New Contributor III

      Hi KKGamer,

      OneStream does not include the ability to do the PGP decryption/encryption out of the box, that I know of anyway. We have a third party component called DidiSoft that we use for other apps. We simply leveraged this same component by sending the DLL's to OneStream support and asking that they place them in the integrations folder. DidiSoft requires a license but if you purchase it then I'm happy to send the BR rule that will do the decryption. Their component is very easy to use so my guess is that you would not need a sample, it's literally a few lines of code to do the work. Happy to provide nonetheless.

       

      Thanks

      • KKGamer's avatar
        KKGamer
        New Contributor III

        Hi HRunyon,

        OneStream support recommended us to using DidiSoft for the process, so if you can share more details for the process and provide the BR rules.It will be helpful.

        Thanks

  • KKGamer's avatar
    KKGamer
    New Contributor III

    Hi HRunyon - I have got the information in the private message, thanks very much.