rsaKeyGen returns an RSA-based SSH private key of size 4096. Administrators may configure this for SSH key compatibility with Azure DevOps.
()
| 118 | // |
| 119 | // Administrators may configure this for SSH key compatibility with Azure DevOps. |
| 120 | func 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 | |
| 132 | func generateKeys(block pem.Block, cp crypto.Signer) (privateKey string, publicKey string, err error) { |
| 133 | pkBytes := pem.EncodeToMemory(&block) |
no test coverage detected