cryptography-samples
Examples of %SYSTEM.Encryption class methods
Installation
- Clone/git pull the repo into any local directory
$ git clone https://github.com/yurimarx/cryptography-samples.git
- Open a Docker terminal in this directory and run:
$ docker-compose build
- Run the IRIS container:
$ docker-compose up -d
- Open IRIS Terminal:
$ docker-compose exec iris iris session iris -U IRISAPP
IRISAPP>
- To do RSAEncrypt - for asymmetric encrypt:
IRISAPP>Set ciphertext = ##class(dc.cryptosamples.Samples).DoRSAEncrypt("InterSystems")
IRISAPP>Write ciphertext
Ms/eR7pPmE39KBJu75EOYIxpFEd7qqoji61EfahJE1r9mGZX1NYuw5i2cPS5YwE3Aw6vPAeiEKXF
rYW++WtzMeRIRdCMbLG9PrCHD3iQHfZobBnuzx/JMXVc6a4TssbY9gk7qJ5BmlqRTU8zNJiiVmd8
pCFpJgwKzKkNrIgaQn48EgnwblmVkxSFnF2jwXpBt/naNudBguFUBthef2wfULl4uY00aZzHHNxA
bi15mzTdlSJu1vRtCQaEahng9ug7BZ6dyWCHOv74O/L5NEHI+jU+kHQeF2DJneE2yWNESzqhSECa
ZbRjjxNxiRn/HVAKyZdAjkGQVKUkyG8vjnc3Jw==
- To do RSADecrypt - for asymmetric decrypt:
IRISAPP>Set plaintext = ##class(dc.cryptosamples.Samples).DoRSADecrypt(ciphertext)
IRISAPP>Write plaintext
InterSystems
- To do AESCBCEncrypt - for symmetric encrypt:
IRISAPP>Do ##class(dc.cryptosamples.Samples).DoAESCBCEncrypt("InterSystems")
8sGVUikDZaJF+Z9UljFVAA==
- To do AESCBCDecrypt - for symmetric decrypt:
IRISAPP>Do ##class(dc.cryptosamples.Samples).DoAESCBCDecrypt("8sGVUikDZaJF+Z9UljFVAA==")
InterSystems
- To do DoHash - for hash text:
IRISAPP>Do ##class(dc.cryptosamples.Samples).DoHash("InterSystems")
rOs6HXfrnbEY5+JBdUJ8hw==
- To exit the terminal, do any of the following:
Enter HALT or H (not case-sensitive)
Credits
-
https://community.intersystems.com/post/format-public-key-when-using-rsaencrypt-method-systemencryption-or-systemencryptionrsaencrypt
-
https://openexchange.intersystems.com/package/intersystems-iris-dev-template
-
https://stackoverflow.com/questions/26029597/openssl-x509-certificate-with-own-rsa-public-key-information