

Private static bool CompareBytearrays(byte a, byte b)

RSAParameters RSAKeyInfo = new RSAParameters() īyte pubkey = ReadFileKey(publicKeyFilePath, "PUBLIC KEY", isFile) īyte SeqOID = Ĭount = bt // we already have the data sizeī(-1, SeekOrigin.Current) //last ReadByte wasn't a removed zero, so back up a byte Private static RSAParameters LoadRsaPublicKey(String publicKeyFilePath, Boolean isFile) RSACryptoServiceProvider rsa = InitRSAProvider(_publicKey) īyte bytes = Convert.FromBase64String(dataEncrypted) īyte decryptedBytes = rsa.Decrypt(bytes, true) RSAParameters _publicKey = LoadRsaPublicKey(publicKey, false) If (publicKey = null) throw new ArgumentNullException("publicKey") If (dataEncrypted = null) throw new ArgumentNullException("dataEncrypted")

public static string DecryptUsingPublic(string dataEncrypted, string publicKey) If I use rsa.Decrypt(bytes, false) I get a bad key exception. "Error occurred while decoding OAEP padding." This is my method (updated from my previous bad one as pointed out by Iridium) but when I try to decrypt the value I get an exception It would be great if there is some kind of reasonable solution besides begging them to change what they are doing. I am hoping someone might be able help me.

I can't find a library to do it in any of the main languages I know i.e. I am told by the person sending me the value that this is no problem in PHP. Am I being an idiot? Is this a normal thing to do? I can't seem to figure out how to do this. I am now being sent a value that is RSA encrypted using a private key which I am supposed to derive a usable value by decrypting using the public key. I also RSA sign and verify and have a reasonable understanding of how this all work I think. Net to decrypt using a private key, encrypt using a public key. Unfortunately despite my protests I have to do it, even though I know it makes little sense. I know the main answer I am likely to get is why the hell would you want to do that?!
