OtherClass myObject = new OtherClass("pYQ4/pRt1g0EEdMuf8j2hg==", "nFgAIwY", "bkZnQUl3WVF1bXl2ZUpUYg==");
Вы вызвали конструктор. Сначала вам нужно знать конструктор и метод.
Редактировать
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Base64;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class SampleCode {
public static void main(String[] args) throws Exception, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, BadPaddingException, Exception
{
SampleCode sampleCode =new SampleCode();
OtherClass myObject = sampleCode.new OtherClass();
System.out.print(myObject.OtherClassMethod("pYQ4/pRt1g0EEdMuf8j2hg==", "nFgAIwY", "bkZnQUl3WVF1bXl2ZUpUYg=="));
}
public class OtherClass {
private String message;
private boolean answer = false;
public String OtherClassMethod(String str, String str2, String str3) throws NoSuchAlgorithmException,
NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, Exception,
BadPaddingException {
AlgorithmParameterSpec ivParameterSpec = new IvParameterSpec(Base64.getDecoder().decode(str3.getBytes()));
Key secretKeySpec = new SecretKeySpec(str2.getBytes("UTF-16"), "AES");
Cipher instance = Cipher.getInstance("AES/CFB/NoPadding");
instance.init(2, secretKeySpec, ivParameterSpec);
return new String(instance.doFinal(Base64.getDecoder().decode(str.getBytes())));
}
@Override
public String toString() {
return message;
}
}
}
Попробуйте это