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)
Parameter | Description |
---|---|
stringtobesigned | The string that needs to be signed |
keystore | A keystore reference to the set of defined keystores in the configuration, throws an error if the keystore does not exist |
privatekeylabel | A private key label reference within the defined keystore in the configuration throws an error if the reference does not exist |
algorithm | Signature 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)
Parameter | Description |
---|---|
stringtobesigned | The string to be verified |
signature | Signature |
keystore | A keystore reference to the set of defined keystores in the configuration, throws an error if the keystore does not exist |
certificatelabel | A certificate label reference within the defined keystore in the configuration throws an error if the reference does not exist |
algorithm | Signature algorithm |
The verify method returns a Boolean if verification succeeds. It returns a JSON object with the error in case of failure.
Updated 2 months ago