C# &引用;提供程序的错误版本。”;使用RSACryptoServiceProvider加载公钥时

C# &引用;提供程序的错误版本。”;使用RSACryptoServiceProvider加载公钥时,c#,rsa,encryption-asymmetric,rsacryptoserviceprovider,C#,Rsa,Encryption Asymmetric,Rsacryptoserviceprovider,我正在使用AsymmetricKeyAlgorithmProvider(Windows.Security.Cryptography.Core)创建RSA密钥对,并导出密钥,如下所示: AsymmetricKeyAlgorithmProvider rsaGenKeys = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithmNames.RsaPkcs1); CryptographicKey keyPair = r

我正在使用
AsymmetricKeyAlgorithmProvider
Windows.Security.Cryptography.Core
)创建RSA密钥对,并导出密钥,如下所示:

  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);
现在,此数据的接收者恰好是Silverlight应用程序,正在使用
RSACryptoServiceProvider
System.Security.Cryptography
)加载此公钥:

RSACryptoServiceProvider rsaPublic = new RSACryptoServiceProvider();
byte[] keyBlobBytes = Convert.FromBase64String(keyBlob);
rsaPublic.ImportCspBlob(keyBlobBytes);
其中keyBlob是具有公钥的字节数组。
问题是当调用ImportSCPBlob时,它抛出异常,表示“提供程序的错误版本”。

我也有同样的错误。出于某种原因,FxSSH不喜欢我生成的公钥RSA。我不得不在自述文件中使用RSA密钥。

您找到解决方案了吗?