私が書いたメソッドに到達できないようです。以下にメソッドを貼り付けます。
public void decryt_data(InputStream in, OutputStream out) throws InvalidKeyException, IOException {
// initialize the cipher
cipher.init(Cipher.DECRYPT_MODE, secret_key);
// Bytes read from in will be decrypted
in = new CipherInputStream(in, cipher);
int numRead = 0;
while ((numRead = in.read(buf)) >= 0)
{
out.write(buf, 0, numRead);
}
out.close();
}
次のように、クラスのインスタンスを使用してこのメソッドを呼び出そうとしています。
encryption.decrypt_data(new FileInputStream("C:/Users/Acer/Desktop/encrypted"),new FileOutputStream("C:/Users/Acer/Desktop/decrypted"));
Eclipseは私に教えてくれます:メソッドdecrypt_data(FileInputStream、FileOutputStream)は、タイプAES(つまりクラス名)に対して未定義です
ただし、次のメソッド呼び出しは完全に正常に機能します。
encryption.encrypt_data(new FileInputStream(fc.getSelectedFile().getPath()),new FileOutputStream("C:/Users/Acer/Desktop/encrypted"));
助けを待っています :D ありがとう。