Skip to content

Nayrode/iris-pkcs7-util

 
 

Repository files navigation

iris-pkcs7-utils

This is a set of utilities for working with PKCS#7 files. It is based on the python libraries asn1crypto and pyopenssl.

This utility is intended to be used with IRIS and IRIS for Heath from an COS environment.

It's distributed on ZPM/IPM.

Installation

zpm "install pkcs7-utils"

with pip :

pip install https://github.com/grongierisc/iris-pkcs7-util/releases/download/v0.0.1/iris_gen_cms-0.0.1-py3-none-any.whl

Usage

	set tUtils = ##class(dc.cms.Encrypt).%New()
	set tCertFileName = "/path/to/cert/file.crt.pem"
	set tKeyFileName = "/path/to/key/file.key.pem"
	set tPassPhrase = "***********"
	set tContent = ##class(%Stream.FileCharacter).%New()
	$$$ThrowOnError(tContent.LinkToFile("/path/to/content/to/be/signed.txt"))
	set tStream = ##class(%Stream.FileBinary).%New()
	do tStream.LinkToFile("/path/to/output/file/for/cms/binary.cms")
	$$$ThrowOnError(tUtils.CreateCMSStream(tContent,tCertFileName, tKeyFileName, tPassPhrase, .tStream))
	set tsc = tStream.%Save()

Command line

gencms -h

result:

usage: gencms [-h] content_filename cert_filename key_filename key_password output_filename

Generate a CMS file

positional arguments:
  content_filename  the file to sign
  cert_filename     the certificate to use
  key_filename      the private key to use
  key_password      the private key password
  output_filename   the output CMS file

optional arguments:
  -h, --help        show this help message and exit

example:

gencms misc\in\test.txt misc\cert\asip-p12-EL-TEST-ORG-SIGN-20240304-094358.crt.pem misc\cert\asip-p12-EL-TEST-ORG-SIGN-20240304-094358.key.pem Intersystems2024! misc/out/toto.cms

About

An util to create CMS/pkcs7 object

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • ObjectScript 58.5%
  • Python 35.1%
  • Dockerfile 6.4%