MCPcopy Index your code
hub / github.com/coder/coder / rsa4096KeyGen

Function rsa4096KeyGen

coderd/gitsshkey/gitsshkey.go:120–130  ·  view source on GitHub ↗

rsaKeyGen returns an RSA-based SSH private key of size 4096. Administrators may configure this for SSH key compatibility with Azure DevOps.

()

Source from the content-addressed store, hash-verified

118//
119// Administrators may configure this for SSH key compatibility with Azure DevOps.
120func rsa4096KeyGen() (privateKey string, publicKey string, err error) {
121 privateKeyRaw, err := rsa.GenerateKey(entropy(), 4096)
122 if err != nil {
123 return "", "", xerrors.Errorf("generate RSA4096 private key: %w", err)
124 }
125
126 return generateKeys(pem.Block{
127 Type: "RSA PRIVATE KEY",
128 Bytes: x509.MarshalPKCS1PrivateKey(privateKeyRaw),
129 }, privateKeyRaw)
130}
131
132func generateKeys(block pem.Block, cp crypto.Signer) (privateKey string, publicKey string, err error) {
133 pkBytes := pem.EncodeToMemory(&block)

Callers 1

GenerateFunction · 0.85

Calls 3

entropyFunction · 0.85
generateKeysFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected