dotnet / dotnet/dotnet-api-docs
RSACryptoServiceProvider in sample code instead of RSA
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
The documentation says Key property contains instance of RSA or DSA object. However, the sample code still uses RSACryptoServiceProvider type cast as was used in "old" .NET. This is very confusing for the users.
```
EncryptFile(originalFile, (RSACryptoServiceProvider)cert.PublicKey.Key);
```
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 16afc3e9-947b-e39d-fe6a-12be630c986f
* Version Independent ID: 2d6b18ba-53ee-0f08-e981-bfaa66854293
* Content: [PublicKey Class (System.Security.Cryptography.X509Certificates)](https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.publickey?view=netframework-4.7.2)
* Content Source: [xml/System.Security.Cryptography.X509Certificates/PublicKey.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Security.Cryptography.X509Certificates/PublicKey.xml)
* Product: **dotnet-api**
* GitHub Login: @mairaw
* Microsoft Alias: **mairaw**
Contributor guide
Assessment
This issue has not been assessed yet.