Java Cryptography Architecture (JCA) Tools

Overview

Contains Functions that expose functionality provided by the Java Cryptography Architecture (JCA):

  • cryptoprovideravailable(): Returns true if the given cryptographic service provider is available for use in the system, otherwise returns false
  • listprovidersandalgorithms(): Returns a list of all available cryptographic service providers and algorithm details
  • randombytes(): Returns a random set of bytes as a hex-encoded string
  • passwordkey(): Generates a key value (as a hex-encoded byte string) from the provided password
  • passwordencrypt(): Encrypts the provided cleartext string using Password-Based Encryption (PBE) as defined in the PKCS #5 standard. Returns an encrypted ciphertext value (as a hex-encoded byte string) which can be decoded using passworddecrypt()
  • passworddecrypt(): Decrypts the provided hex-encoded ciphertext byte string using Password-Based Encryption (PBE) as defined in the PKCS #5 standard. Returns the originally encrypted cleartext value
  • keyencrypt(): Encrypts the provided cleartext string using the specified key and cipher transformation. Returns an encrypted ciphertext value (as a hex-encoded byte string) which can be decoded using keydecrypt()
  • keydecrypt(): Decrypts the provided hex-encoded ciphertext byte string using the specified key and cipher transformation. Returns the originally encrypted cleartext value
  • macsignature(): Computes a Mac signature

Note: The JCA framework uses different "providers" to implement specific cryptographic algorithms.  Provider implementations need to be installed prior to use.

See https://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html for more details.

Anonymous
Parents
  • Hi,
    I'm trying to encrypt a password using "AES/ECB/PKCS5Padding" but failed so far.

    For example the password is "Test" followed by a timestamp and SALT is "%aaa*+11/r5Testj8"

    I would expect something like this:
    Plain text is: 'Test19.09.2019 10:45:12'
    Encrypted text is 'S/WAvRLGqQ0HO25DpRYAzoO5ML3ZYbo0UT65lS80yr0='


    My approach is:
    passwordencrypt(
    cleartext: "Test19.09.2019 09:01:25",
    password: "Test",
    salt: keyencrypt(cleartext: "%aaa*+00/r5Test9", key: text2hex("%aaa*+00/r5Test9"), transformation: "AES"),
    iterationCount: 1000,
    transformation : "AES/ECB/PKCS5PADDING"
    )


    Error: java.security.NoSuchAlgorithmException: AES/ECB/PKCS5PADDING SecretKeyFactory not available

    Any help?
    Thanks
    Yusuf

  • In a test rule run listprovidersandalgorithms() and see if you have the java library needed. 

  • From your file it appears you have the you have the java library needed.

  • Hi, thank you for your quick answer :) There is a bunch of libaries.. 

Comment Children
No Data