Written by

Question Tom McDevitt · Aug 3, 2017

PGP encryption and decryption

 I like to know if COS has a PGP library for encryption and decryption messages received from an SFTP connection. We have  interfaces that we used BouncyCastle in C# but would like a native library for COS.

Comments

Robert Cemper · Aug 3, 2017

For an engineer this sounds like a quite challenging exercise to rewrite a PGP lib in COS.
 

But it seems more promising to wrap the existing (and hopefully well tested) code and consume it from Caché using one of the existing Gateways:

- Callout Gateway http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…

- ActiveX Gateway  http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…

- or just  connect
over TCP/IP http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
or UDP http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
or a Pipe  http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
I bet the community has even more ideas to reuse the existing code

0
Tom McDevitt  Aug 4, 2017 to Robert Cemper

So there is a PGP library is Cache, I was unable to find anything related to PGP.

0
Rubens Silva  Aug 4, 2017 to Tom McDevitt

No, there isn't.
What he meant is that Caché supports binding for other languages. But there isn't a native COS implementation for PGP.
The easiest way of achieving what you want is to use gpg using $zf (CallOut). Where you can emit a comand directly to the host OS.
Remember that by default Windows haven't a gpg command. But there's a version for it as well.

You can also use method ##class(%Net.Remote.Utility).RunCommandViaZF(cmd,,.output,,) for brevity. Where cmd should be your gpg command.

0
Enrico Parisi · Aug 4, 2017

If you are already familiar with BouncyCastle in C# probably the easiest way for you is to use the Java Gateway or the .NET gateway to call out the Java or C# BouncyCastle library.

In either case, I'd suggest to write a little or some little (i.e. limited to your needs) wrapper that you then call from COS.

HTH

Enrico

0
Robert Cemper · Aug 14, 2017

Pls. don't forget to mark your question as "answered" on Developer Community,
please click the checkmark alongside the answer you (as author of the question) accept

0
Tim Miller · Feb 28, 2019

Tom,

Just checking in to see if you were able to get this to work with Ensemble.  I am needing to do PGP decryption\encryption on an Linux instance.  I was trying to pick between Java or another solution.

Thanks,

Tim

0