You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and retrieved by: keyPair.publicKey and keyPair.secretKey
at postgresql, i used the publickey string to encrypt a text and encode the encrypted result as base64. use this command: select encode(postgis.pgp_pub_encrypt('string to be encrypted and encoded', postgis.dearmor('public key string')), 'base64')
the result is: wcDMA/nLwh3roOyyAQv+IlIO+6cmGWQ4NoPYafgrxhfT2mhJfXX5cNAqFwPqE2LlIduqVf6wci+fJosLpcgEP2W38XCw0Q+NtsrUCINUph+5QDlFXK48sd6drSAGdRlrvxp9Mq2iOlALzX6ZaK3vRLpVcEMHZBC8eQRmXxX8l4t8qVlxGNHv04fmhFcYL5pi5L39ei7DPcxiW3O/kat8Wrm1RhjmXTcSXq43PjcwgOsw2nh6BIt/ZVdXuYm9RCdaNTkSNFVd8MgwokF1lMnL6DhZTMw7itdaepCE3LQ/z7nxgsqf64d69GWb4DFRtPpzbRRxqIkjZxxF+tpCNIB8zjz/9v35+SPnc9rg5tioTVTmYlLTKZpBjGei91RGLZt5ZbsrP1doGYM8QD4Hd5U9oH8lkrS/ArpxqWOuR9Be2Nw2bIUQ5+NmmPPrD0O6EiumabwWo1il95EkMc74uQpM0nvsVdiNrzFSSVQnZxfHZiQIAipj5C1YFEsx4DzbbHR7Sjp4Cd5G0G2zJlF59QTS0kcBSkV0bG894+6A2CEpJniA5i/+YdFdUFz3LOq+5In5Ob4DamRJl+TNNylqUFZQhBWfzuvwgjbs+BConxGayYfuteHK64R+gQ==
when i try to decrypt this use my secret key i receive an error, see below the code used:
val decodedBytes = Base64.decode("wcDMA/nLwh3roOyyAQv+IlIO+6cmGWQ4NoPYafgrxhfT2mhJfXX5cNAqFwPqE2LlIduqVf6wci+fJosLpcgEP2W38XCw0Q+NtsrUCINUph+5QDlFXK48sd6drSAGdRlrvxp9Mq2iOlALzX6ZaK3vRLpVcEMHZBC8eQRmXxX8l4t8qVlxGNHv04fmhFcYL5pi5L39ei7DPcxiW3O/kat8Wrm1RhjmXTcSXq43PjcwgOsw2nh6BIt/ZVdXuYm9RCdaNTkSNFVd8MgwokF1lMnL6DhZTMw7itdaepCE3LQ/z7nxgsqf64d69GWb4DFRtPpzbRRxqIkjZxxF+tpCNIB8zjz/9v35+SPnc9rg5tioTVTmYlLTKZpBjGei91RGLZt5ZbsrP1doGYM8QD4Hd5U9oH8lkrS/ArpxqWOuR9Be2Nw2bIUQ5+NmmPPrD0O6EiumabwWo1il95EkMc74uQpM0nvsVdiNrzFSSVQnZxfHZiQIAipj5C1YFEsx4DzbbHR7Sjp4Cd5G0G2zJlF59QTS0kcBSkV0bG894+6A2CEpJniA5i/+YdFdUFz3LOq+5In5Ob4DamRJl+TNNylqUFZQhBWfzuvwgjbs+BConxGayYfuteHK64R+gQ==", Base64.DEFAULT)
val decodedString = String(decodedBytes)
val decryptResult = KotlinPGP.decrypt(
secretKey,
"123456",
decodedString
)
decoded string from base64 converted to string (decodedString):
2021-05-25 10:54:16.692 13576-13576/com.example.pocpgpandroid E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.pocpgpandroid, PID: 13576
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.io.IOException: unknown object in stream: 47
at org.bouncycastle.openpgp.PGPObjectFactory.nextObject(Unknown Source:36)
at moe.tlaster.kotlinpgp.KotlinPGP.encryptedDecryptResult(KotlinPGP.kt:256)
at moe.tlaster.kotlinpgp.KotlinPGP.decrypt(KotlinPGP.kt:246)
at com.example.pocpgpandroid.FirstFragment.onViewCreated$lambda-2(FirstFragment.kt:142)
at com.example.pocpgpandroid.FirstFragment.lambda$b3jqjhg7e5sn5psKJ4hBYyBV4pU(Unknown Source:0)
at com.example.pocpgpandroid.-$$Lambda$FirstFragment$b3jqjhg7e5sn5psKJ4hBYyBV4pU.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7448)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
at android.view.View.performClickInternal(View.java:7425)
at android.view.View.access$3600(View.java:810)
at android.view.View$PerformClick.run(View.java:28305)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2021-05-25 10:54:16.746 13576-13576/com.example.pocpgpandroid I/Process: Sending signal. PID: 13576 SIG: 9
The text was updated successfully, but these errors were encountered:
can help me with the error below:
public key
secret key
those keys are generated with this command:
and retrieved by: keyPair.publicKey and keyPair.secretKey
at postgresql, i used the publickey string to encrypt a text and encode the encrypted result as base64. use this command:
select encode(postgis.pgp_pub_encrypt('string to be encrypted and encoded', postgis.dearmor('public key string')), 'base64')
the result is:
wcDMA/nLwh3roOyyAQv+IlIO+6cmGWQ4NoPYafgrxhfT2mhJfXX5cNAqFwPqE2LlIduqVf6wci+fJosLpcgEP2W38XCw0Q+NtsrUCINUph+5QDlFXK48sd6drSAGdRlrvxp9Mq2iOlALzX6ZaK3vRLpVcEMHZBC8eQRmXxX8l4t8qVlxGNHv04fmhFcYL5pi5L39ei7DPcxiW3O/kat8Wrm1RhjmXTcSXq43PjcwgOsw2nh6BIt/ZVdXuYm9RCdaNTkSNFVd8MgwokF1lMnL6DhZTMw7itdaepCE3LQ/z7nxgsqf64d69GWb4DFRtPpzbRRxqIkjZxxF+tpCNIB8zjz/9v35+SPnc9rg5tioTVTmYlLTKZpBjGei91RGLZt5ZbsrP1doGYM8QD4Hd5U9oH8lkrS/ArpxqWOuR9Be2Nw2bIUQ5+NmmPPrD0O6EiumabwWo1il95EkMc74uQpM0nvsVdiNrzFSSVQnZxfHZiQIAipj5C1YFEsx4DzbbHR7Sjp4Cd5G0G2zJlF59QTS0kcBSkV0bG894+6A2CEpJniA5i/+YdFdUFz3LOq+5In5Ob4DamRJl+TNNylqUFZQhBWfzuvwgjbs+BConxGayYfuteHK64R+gQ==
when i try to decrypt this use my secret key i receive an error, see below the code used:
decoded string from base64 converted to string (decodedString):
below the stacktrace of the error:
The text was updated successfully, but these errors were encountered: