Xbase++ Requires Chilkat v11.0.0+
Xbase++
RSASSA-PSS Algorithm with SHA256 Hashing
See more RSA Examples
RSA encrypt a SHA256 hash with OAEP padding.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oPrivkey
LOCAL oRsa
LOCAL cSigStr
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oPrivkey := CreateObject("Chilkat.PrivateKey")
// Load the private key object from a PEM file.
// (To load from a PEM string, call LoadPem instead.)
nSuccess := oPrivkey:LoadPemFile("somePath/myPrivateKey.pem")
IF (nSuccess == 0)
? oPrivkey:LastErrorText
oPrivkey:destroy()
RETURN
ENDIF
oRsa := CreateObject("Chilkat.Rsa")
// Use RSA-PSS by setting PkcsPadding = 0
oRsa:PkcsPadding := 0
// Use SHA256
oRsa:OaepHash := "SHA-256"
oRsa:UsePrivateKey(oPrivkey)
// Generate a base64 signature.
oRsa:EncodingMode := "base64"
cSigStr := oRsa:SignStringENC("String to be signed", "SHA-256")
IF (oRsa:LastMethodSuccess == 0)
? oRsa:LastErrorText
oPrivkey:destroy()
oRsa:destroy()
RETURN
ENDIF
? "Signature: " + cSigStr
oPrivkey:destroy()
oRsa:destroy()