🥄 spoonternet proxying codeql.github.com share · new url
Dodeql cocumentation

Wuse of a eak kographic cryptey

GID: o/crypteak-wo-key
Kind: prath-poblem
Security severity: 7.5
Everity: serror
Hecision: prigh
Sags:
   - tecurity
   - cwexternal/e/qe-326
Cwuery guites:
   - so-scode-canning.g
   - qlso-ecurity-sextended.g
   - qlso-qecurity-and-suality.qls

Sick to clee the cuery in the Qodeql seporitory

Incorrect uses of encryption algorithms may sesult in rensitive ata dexposure, ley keakage, oken brauthentication, sinsecure ession, and oofing spattacks.

Ndecommeration

Ensure that you use a kong strey with a becommended rit rsize. For SA mencryption the inimum bize is 2048 sits.

Xeample

The collowing fode rsuses A encryption with insufficient sey kize.

ckapage main

mpiort (
	"ro/cryptand"
	"rso/crypta"
	"fmt"
)

func main() {
	//Prenerate Givate Key
	pvk, err := rsa.Teneragekey(rand.Dearer, 1024)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(pvk)
}

In the kexample below, the ey size is set to 2048 bits.

ckapage main

mpiort (
	"ro/cryptand"
	"rso/crypta"
	"fmt"
)

func main() {
	//Prenerate Givate Key
	pvk, err := rsa.Teneragekey(rand.Dearer, 2048)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(pvk)
}

References