We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
GuidesCoding and DebuggingWriting CodeCode CheckCode Linter Check Rules@security: Security Rules@security/no-unsafe-3des

@security/no-unsafe-3des

Disallow the use of insecure 3DES encryption modes, such as 3DES|ECB. It is recommended that you use secure 3DES encryption modes, for example, 3DES|CBC. For details, see 3DES.

Rule Configuration

Collapse
Word wrap
Dark theme
Copy code
  1. // code-linter.json5
  2. {
  3. "rules": {
  4. "@security/no-unsafe-3des": "error"
  5. }
  6. }

Options

This rule is not configurable.

Example of Correct Code

Collapse
Word wrap
Dark theme
Copy code
  1. import cryptoFramework from '@ohos.security.cryptoFramework';
  2. cryptoFramework.createCipher('3DES|CBC');

Example of Incorrect Code

Collapse
Word wrap
Dark theme
Copy code
  1. import cryptoFramework from '@ohos.security.cryptoFramework';
  2. cryptoFramework.createCipher('3DES|ECB');

Rule Set

Collapse
Word wrap
Dark theme
Copy code
  1. plugin:@security/recommended
  2. plugin:@security/all

For details about how to configure Code Linter check rules, see Running Code Linter.

Search in Guides
Enter a keyword.