Loading an asymmetric RSA key
IMPORT xml
MAIN
DEFINE key xml.CryptoKey
LET key = xml.CryptoKey.Create("http://www.w3.org/2001/04/xmlenc#rsa-1_5")
TRY
CALL key.loadPEM("RSA1024Key.pem")
CALL key.setFeature("KeyName","MyRsaKey")
DISPLAY "Key size (in bits) : ",key.getSize() # displays 1024 (bits)
DISPLAY "Key type : ",key.getType() # displays PRIVATE or PUBLIC
DISPLAY "Key usage : ",key.getUsage() # displays KEYENCRYPTION
CATCH
DISPLAY "Unable to load key :",status
END TRY
END MAIN
Note:
All keys in PEM or DER format were created with the OpenSSL tool.