Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After RSA public key encryption, I am unable to decrypt it. It shows an error message: 'Error: Expected a value of type 'ASN1Integer', but got one of type 'ASN1Sequence'. #320

Open
hardgit opened this issue Dec 7, 2023 · 0 comments

Comments

@hardgit
Copy link

hardgit commented Dec 7, 2023

Hey! I found that I couldn't parse the encrypted information given to me by the Java backend using your plugin. When I tried to decrypt it, I kept getting an error message that says: Error: Expected a value of type 'ASN1Integer', but got one of type 'ASN1Sequence'.

publicKey
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCEwyQppT7udd86Oa7nKll+sKziM6CIXBbxPMgp+2Pg9de+ZZ1c0BFlAZ8C6kcr9Lfhjw/+Hyg88VeZBS1J1rtO6LOeBmvNQIBmt37xpFJMORSpJiIP3wh+beSxjVVqJ+DPM9kot7qtj7aT6klNR+LHiMbx5iYwu4xF/XEK3CM4hwIDAQAB

privateKey
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAITDJCmlPu513zo5rucqWX6wrOIzoIhcFvE8yCn7Y+D1175lnVzQEWUBnwLqRyv0t+GPD/4fKDzxV5kFLUnWu07os54Ga81AgGa3fvGkUkw5FKkmIg/fCH5t5LGNVWon4M8z2Si3uq2PtpPqSU1H4seIxvHmJjC7jEX9cQrcIziHAgMBAAECgYAvRvaXxfq1HFCUAXqhY1lfXjcSjmP6ayDYY1a8bINS1vkvGiyBoq6vE3a2qQsTQiBBOJrvWdUQbrlNCqToCInGupPvIU4ziyoUDXRUXLV6DKVVRx+7Q/00bqFlkXz6M2N7+3GX69BwD+sxeBUXxzIXGrwNAjhQuOypI3EeLdDv8QJBALpql2VFfMSVBvz0nX6mqEQat0WUO2YJ24DkA9hnhxpwJgLOJL0o96ImgX9U/dFnswu1cnVbAxWxe6bSRIl5VE0CQQC2UYTwBpqfANEAirQjdNoOTNRG86Ri9poyMs5GkqBVZtbhFPuJ+h4ACws1PiglWpBdtKKVQ0f13vrdeSHn4HojAkEApPU3vTTNIIOjaGnpiC5fjcx6SwbNvRCR/a9Hu9J42itNZ4QVPJIo94LNaujBpfD2njDU9QYxZ5vjiI5eeaw0rQJAV1lxLqqLVBjJCdBqg/5NJsLKhX/fx4ZM1DYhPBCt/py54Lbz2ORbkTu5T/YKt/LO7gZISukkRfliCdAqXXTgLwJBAI+b6iDr5VL0NWKfhXJSRPwr9Rg9sljq6r/iaDpUUOpZiKjvutjJSbz0Xit+rMGJ3M4nlnp8iqKqhYor2TUhrxw=

The encrypted string:
Gu9pld1y6XdkebQ+LWDheABBwpCnWalT1hoiYeltPD5Bkxp0aN908WBtRzsf3Z5Uo9FwoPAdcOsU7dHY6zbV8SG5+Rm6PUrkXd/3lWfERBxQNtcz+b1Z9GPcrqulSvdrfJhS6MeBUDvZwpaMRewuru5Co/otytkJmZyBnDgI888=

error:
Unhandled exception: type 'ASN1Sequence' is not a subtype of type 'ASN1Integer' in type cast #0 RSAKeyParser._parsePrivate (package:encrypt/src/algorithms/rsa.dart:240:43) #1 RSAKeyParser.parse (package:encrypt/src/algorithms/rsa.dart:222:14) #2 parseKeyFromFile (package:encrypt/encrypt_io.dart:10:17) <asynchronous suspension> #3 main (package:slvers/rsa.dart:11:19) <asynchronous suspension>

Can you tell me how to successfully decrypt it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant