"Bad version of the provider". when loading public key using RSACryptoServiceProvider

I am generating RSA key pair using AsymmetricKeyAlgorithmProvider

( Windows.Security.Cryptography.Core

) and exporting the keys as shown below:

  AsymmetricKeyAlgorithmProvider rsaGenKeys = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithmNames.RsaPkcs1);

  CryptographicKey keyPair = rsaGenKeys.CreateKeyPair(2048);
  byte[] privateKeyBlob = keyPair.Export(CryptographicPrivateKeyBlobType.Pkcs1RsaPrivateKey).ToArray();

  string privateKeyBlobStr = Convert.ToBase64String(privateKeyBlob);

  byte[] publicKeyBlob = keyPair.ExportPublicKey().ToArray();

  string pubilcKeyBlobStr = Convert.ToBase64String(publicKeyBlob);

      

Now the receiver of this data is a Silverlight application and uses RSACryptoServiceProvider

( System.Security.Cryptography

) to load this public key:

RSACryptoServiceProvider rsaPublic = new RSACryptoServiceProvider();
byte[] keyBlobBytes = Convert.FromBase64String(keyBlob);
rsaPublic.ImportCspBlob(keyBlobBytes);

      

Where keyBlob is a byte array holding a public key. The problem is that when ImportCspBlob is called, it throws an exception saying "Bad provider version".

+3
c # rsa encryption-asymmetric rsacryptoserviceprovider


source to share


No one has answered this question yet

Check out similar questions:

five
Importing RSA public key from XML using RSACryptoServiceProvider sets PublicOnly property to false
five
JSch gets "invalid privatekey:" when trying to load RSA private key with KeyPairGenerator
4
Convert RSA Public Keys Using Module Only
3
C # RSA Encrypt text using PKCS # 1 public public key
1
RSA - How to validate public key information?
1
Create RSACryptoServiceProvider from public key only
0
C # RsaProtectedConfigurationProvider and RSACryptoServiceProvider implementation
0
X509Certificate Public Key Encryption
0
how to recover the rsa public key? or change byte to rsa public key in python?
0
RSA public key metrics 16 bytes



All Articles
Loading...
X
Show
Funny
Dev
Pics