이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

ID: go-security/minimum-rsa-key-length

Language: Go

Severity: Warning

Category: Security

CWE: 326

Description

RSA keys should have a minimum length to ensure the security and strength of cryptographic operations. A key length is measured in bits and determines the complexity of the key, making it harder for attackers to break or decrypt the encryption.

Arguments

  • min-length: Minimum length of the RSA key. Default: 2048.

Non-Compliant Code Examples

package main

import (
	"crypto/rand"
	"crypto/rsa"
	"fmt"
)

func main() {
	privateKey, err := rsa.GenerateKey(rand.Reader, 1024)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(privateKey)
}

Compliant Code Examples

package main

import (
	"crypto/rand"
	"crypto/rsa"
	"fmt"
)

func main() {
	privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(privateKey)
}
PREVIEWING: dgreen15/github-error-fix