Hi,

I am getting a compile error message when I am trying to compile someone else code using Eclipse.  The partial code description is below as follows:

 

public String decrypt(String password) {

    try {

      // create the key and parameter spec

      KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, interactions);

      SecretKey key = SecretKeyFactory.getInstance(keyFormat).generateSecret(keySpec);

      AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, interactions);

      // create the cipher

      Cipher dcipher = Cipher.getInstance(key.getAlgorithm());

      dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);

      byte[] dec = null;

      try {

        dec = Base64Coder.decode(cryptic);

      } catch(IllegalArgumentException ex) {

        // decode legacy files encoded with sun encoder

      dec = new sun.misc.BASE64Decoder().decodeBuffer(cryptic);              <-------this line is indicated as source of error.

      }

      byte[] bytes = dcipher.doFinal(dec);

      return new String(bytes, encoding);

    } catch(Exception ex) {

      ex.printStackTrace();

    }

    return null;

  }

Below is the following error message:

Access restriction: The type 'BASE64Decoder" is not API (restriction on required library '/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/rd.jar')

How do I troubleshoot it? Thanks.

FacebookTwitterLinkedin
Pin It
Joomla Tutorials for Beginners