Example: Using security.PBKDF2 methods

This example generates a key size of 128-bits based on a given password.

The 128-bits key can then be used in xml.CryptoKey, for instance.
IMPORT SECURITY

MAIN 
  DEFINE salt     STRING
  DEFINE result  STRING
  LET salt =   Security.RandomGenerator.CreateRandomString(8)
  TRY
    CALL Security.PBKDF2.GenerateKey(arg_val(1), salt, "sha1", 1000, 16) RETURNING result
    DISPLAY "Generate Key of 128bits value is :",result  # 128/8==16
  CATCH
       IF status == -15700 THEN
         DISPLAY "Generation failed :",SQLCA.SQLERRM
       ELSE
         IF status == -15701 THEN
           DISPLAY "Invalid parameter :",SQLCA.SQLERRM
         ELSE
           DISPLAY "Unkown error :",STATUS
         END IF
       END IF
  END TRY
END MAIN