I have to encode a string on my .Net Core 2.2 lib using the following certificate provided:
-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVMkaF50qEKdSFIiY+nzj4Nh6c aQDrrFVxDLNoMdM1O2BfxvqfJNE+4FNHYUKShQgKVrpx6BO1dPEgDrFK3NQPLOC+ Im/gA2skUMIDZtQt8kX5YXGRT5JkV3hM2lJQFiagf/06oqcI8WyGnHUQwfJueg7t ItUZAx3sQTJfuvlocQIDAQAB
-----END PUBLIC KEY-----
Regular X509Certificate2 can't load/use it but I was able to do it using this post here
The problem is that the other end, Java (no further info at the time), can't seem to decrypt it!
Looking around the web i noticed that its common for java to use PKCS #8, while .net uses PKCS #1.
The error im getting back from the server is: "Illegal Base64 Caracter 7d"...
I tried to base64 encode my payload before encryption but that didn't work also.
Can anyone tell me:
- Will a PCKS8 be able to decrypt a string encrypted by PKCS1?
- Is there a PKCS8 implementation for .Net Core 2.x?
EDIT 1:
I went to this site here, encrypted the message using the certificate i provided above and submitted the result to my endpoint and it work...