Hendelser
17. mars, 21 - 21. mars, 10
Bli med i meetup-serien for å bygge skalerbare AI-løsninger basert på virkelige brukstilfeller med andre utviklere og eksperter.
Registrer deg nåDenne nettleseren støttes ikke lenger.
Oppgrader til Microsoft Edge for å dra nytte av de nyeste funksjonene, sikkerhetsoppdateringene og den nyeste tekniske støtten.
Property | Value |
---|---|
Rule ID | CA5358 |
Title | Do Not Use Unsafe Cipher Modes |
Category | Security |
Fix is breaking or non-breaking | Non-breaking |
Enabled by default in .NET 9 | No |
Use of one of the following unsafe encryption modes that is not approved:
These modes are vulnerable to attacks and may cause exposure of sensitive information. For example, using ECB
to encrypt a plaintext block always produces a same cipher text, so it can easily tell if two encrypted messages are identical. Using approved modes can avoid these unnecessary risks.
It's safe to suppress a warning from this rule if:
If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
#pragma warning disable CA5358
// The code that's violating the rule is on this line.
#pragma warning restore CA5358
To disable the rule for a file, folder, or project, set its severity to none
in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.CA5358.severity = none
For more information, see How to suppress code analysis warnings.
using System.Security.Cryptography;
class ExampleClass {
private static void ExampleMethod () {
RijndaelManaged rijn = new RijndaelManaged
{
Mode = CipherMode.ECB
};
}
}
using System;
using System.Security.Cryptography;
class ExampleClass
{
private static void ExampleMethod()
{
Console.WriteLine(CipherMode.ECB);
}
}
using System.Security.Cryptography;
class ExampleClass {
private static void ExampleMethod () {
RijndaelManaged rijn = new RijndaelManaged
{
Mode = CipherMode.CBC
};
}
}
.NET-tilbakemelding
.NET er et åpen kilde-prosjekt. Velg en kobling for å gi tilbakemelding:
Hendelser
17. mars, 21 - 21. mars, 10
Bli med i meetup-serien for å bygge skalerbare AI-løsninger basert på virkelige brukstilfeller med andre utviklere og eksperter.
Registrer deg nå