SigningHelper Utility

SigningHelper utility

The SigningHelper utility is used to sign and verify strings within the mapping rule. This utility supports the following algorithms:

  • RSA256
  • RSA384
  • RSA512
  • PS256
  • PS384
  • PS512

Example of usage:

importClass(Packages.com.tivoli.am.fim.trustserver.sts.utilities.SignHelper);

var signingString = "The SigningHelper utility is used to sign and verify strings within the mapping rule. This utility supports the following algorithms."
var signedString = StringSigningHelper.sign(signingString, "keystore", "privatekey", "PS512")
var result = StringSigningHelper.verify(signingString, signedString, "keystore", "certificate", "PS512");
if(result == true){
     IDMappingExtUtils.traceString("Verification successful");
}
else{
    IDMappingExtUtils.traceString("Verification failed");
}

1. SigningHelper sign

sign(stringtobesigned, keystore, privatekeylabel, algorithm)

ParameterDescription
stringtobesignedThe string that needs to be signed
keystoreA keystore reference to the set of defined keystores in the configuration, throws an error if the keystore does not exist
privatekeylabelA private key label reference within the defined keystore in the configuration throws an error if the reference does not exist
algorithmSignature algorithm

The sign method returns the signed string as a result. It returns a JSON object with the error if it fails.

2. SigningHelper verify

verify(stringtobesigned, signature, keystore, certificatelabel, algorithm)

ParameterDescription
stringtobesignedThe string to be verified
signatureSignature
keystoreA keystore reference to the set of defined keystores in the configuration, throws an error if the keystore does not exist
certificatelabelA certificate label reference within the defined keystore in the configuration throws an error if the reference does not exist
algorithmSignature algorithm

The verify method returns a Boolean if verification succeeds. It returns a JSON object with the error in case of failure.