public void writed()
{
try{
FileOutputStream fos = new FileOutputStream("c:\\key01.txt");
fos.write(d.toByteArray());
System.out.println("Done");
}catch(Exception e)
{
System.out.println("\nError in writed: " + e.getMessage());}
}
privateKey = (RSAPrivateCrtKey)keypair.getPrivate();
p = privateKey.getPrimeP();
q = privateKey.getPrimeQ();
phiN = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE));
e = privateKey.getPublicExponent();
d = e.modInverse(phiN);
어떻게 key01.txt에서 d를 읽을 수 있습니까? 또는 txt 파일에서 데이터를 읽고 쓰는 더 좋은 방법은 무엇입니까?FileOutputStream에서 biginteger 값을 얻으십시오.
FileInputStream inputStream = new FileInputStream("foo.txt");
try {
String everything = IOUtils.toString(inputStream);
} finally {
inputStream.close();
}
을 또는이 질문 보면 :
d를 원하십니까? Java IO에 대해 좀 더 읽어야 할 것입니다. http://docs.oracle.com/javase/tutorial/essential/io/ – GGrec
어디에서 오는 것입니까? 미안 어디에도 정의/초기화되지 않습니다. d는 패키지의 이름입니까? – chiliNUT
Google로만 가능 : http://www.google.com/search?q=java+read+and+write+the+data+from+txt+file – anubhava