none
Not reading ProperyBag Using BLogical SFTP adapter with Custom PGP Decryption Pipeline RRS feed

  • Question

  • I installed and started using the BLogical SFTP adapter which works very nicely in Biztalk 2010. I also downloaded the source, compiled and deployed this custom pipeline comnponent baced on the BouncyCastle C# API which decrypts/encrypts PGP files. Again this works great when using it with a standard FILE Biztalk Adapter, you can define all the options by clicking against the pipeline from the Biztalk administrator.

    However, when I set up the SFTP adapter and set it to use the custom pipeline which uses the PGP decryption component at the same time, things start to go wrong and I was getting weird errors from the encrypt sections of code within of the PGP component when I clearly had selected decrypt. I put some tracing in which identified that the properties entered in the compoent (i.e. private key, public key, encrypt/decrypt etc) where not being loaded from the PropertyBag and were being set to default values or null. The logging has confirmed that the implemented method which sets the parameters "void IPersistPropertyBag.Load(IPropertyBag propertyBag, int errorLog)" is being invoked, suggesting that the IPropertyBag object itself has not picked up the values that have been set from within the component/administrator.

    Has anyone come across this before? Is there some bit of code missing within the custom SFTP adapter that needs to supply the correct ProperyBag object to the pipeline? Seems odd that both work well in isolation or with the out of the box adapters / pipelines, but not when run together.

    Wednesday, March 23, 2011 2:43 PM

Answers

  • I think I've managed to answer my own question here. I noticed that the Load method was being invoked twice which led me to this article. It suggested that the first Load loaded the parameters set in the component itself, and the second loaded them from whatever you set them via the Biztalk Administrator. Now if you haven't set them to anything other than the defaults (which is often the case), then the values are read as null in the 2nd pass and the PGP custom pipeline code was overwriting them as such. The solution was to add in a check to see if the parameter value is null before setting them:

    propertyBag.Read("PrivateKeyFile", out valPrivateKeyFile, 0);
    
    if (valPrivateKeyFile != null)
            PrivateKeyFile = (string)valPrivateKeyFile;
          else
            if (PrivateKeyFile == null)
            PrivateKeyFile = "";
    
    • Marked as answer by Stuart Charles Wednesday, March 23, 2011 5:11 PM
    Wednesday, March 23, 2011 5:11 PM