Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Verifying signature against x509 cert

Question
Louis Burger · Apr 13, 2022

Verifying signature against x509 cert

Hi everyone,

We are trying to verify a signature against a certificate without success.

Apologies in advanced if my post lack info.

I've added the cert under the X509 credentials under the management portal (alias Cert).

The code snippet that we are using to verify the cert:

set tX509 = ##class(%SYS.X509Credentials).GetByAlias("Cert")

set tData = "hello"

set tSignature = "CUBMPlVbEKbjFg0nUNz3pwuSwq7tJPg4obsj6LpwbMsEQaDNNw/93V9X0BdgBVzoWN1K7XrG1WX1focFj+EIkeXOJJF7KjQv4p9Xc8JT0wWZ9ivw0+pYvBtMSzP9JEVzapt2Cr+QoBT47yEMeCAxt7Ka7q7xLpxxpAvDQ+QE3Mg="

set isValid = $SYSTEM.Encryption.RSASHAVerify(256, tData, tSignature, tX509.Certificate)

w "isValid: " _ isValid

Based on the above code i keep getting isValid = 0 indicating that the certificate verification failed.

Am I missing something?  

Thank you in advanced.

#Ensemble
Product version: Ensemble 2018.1

Source URL:https://community.intersystems.com/post/verifying-signature-against-x509-cert