누군가 도움이 필요합니다. 내 안드로이드 전화에서 공개 키 (파일 암호화 용)와 해독 할 개인 키를 만듭니다. 나는 그들을 2 파일에 저장한다. 안드로이드로 해독하면 괜찮습니다. 내가 해결 방법을 모르는개인 키를 사용하여 파일 암호 해독 (RSA)
at sun.security.rsa.RSAPadding.unpadV15(Unknown Source)
at sun.security.rsa.RSAPadding.unpad(Unknown Source)
at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:356)
at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:382)
at javax.crypto.Cipher.doFinal(Cipher.java:2087)
at com.molisy.decryptfile.Main.RSADecrypt(Main.java:193)
at com.molisy.decryptfile.Main$2.actionPerformed(Main.java:309)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
: 나는 개인 키 파일을 복사하고 내 PC (자바)에서 해독하는 데 사용할 때, 나는 예외를 얻을. 하지만 개인 키 파일의 값은 내 안드로이드와 내 PC에 인쇄 할 때 동일하지 않습니다. 내 안드로이드 애플 리케이션 : OpenSSLRSAPrivateKey{modulus=a9a141d6ef0050e27f00ec381f2fcfeb47781dcfb14f9b3eb378bd361b92b6da7feb8f2be7466314794d7543eb99c818d260d48b898c9995db3a3af76b23013ff935f77b8a89edcbd9d16a583b60591e55f7cb8271fa4cfae53fd759f3d8e1b522485e2cf29e89034223329322b4357c84fc848348b004136d6d360f8c9a70cb,privateExponent=7eaff2ee455da50b23f35a78a7c21bb50a9189223eb8c7a7527ed04182e2563265eb55e862384d73530d28916b7a54d944f610878e5935b39821ab3c720598be28d747de099ff8fac6558f235b983815efc61cbc574be39d97dc7ac57e6cf82161f4301dfe777c3c33c58d7c75f581de5cc0db83b079de7d79864a6189667171,
내 자바 애플 리케이션 : [email protected]
왜 그렇게 다릅니다. 및
공개 키 모듈을 공공 장소에 게시하지 마십시오. – hexafraction
@hexafraction보다 정확하게 말해, 공공 장소에 개인 지수를 게시하지 마십시오. 출력이 다른 이유는'OpenSSLRSAPrivateKey'가'Object.toString()'과'RSAPrivateKeyImpl'를 오버라이드 (override)하기 때문입니다. –
키가 PC 및 Android에서 동일하지 않으면 이유를 알 수 있습니다. 왜 동일하지 않은지 알아보십시오. –