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.

3 0 6 605


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

- ActiveX Gateway

- or just  connect
over TCP/IP
or UDP
or a Pipe

I bet the community has even more ideas to reuse the existing code

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

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.

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.



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


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.