MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / rsaEncodePrivateKey

Function rsaEncodePrivateKey

server/sftp/hostkey.go:86–94  ·  view source on GitHub ↗
(privateKey *rsa.PrivateKey)

Source from the content-addressed store, hash-verified

84}
85
86func rsaEncodePrivateKey(privateKey *rsa.PrivateKey) []byte {
87 privateKeyBytes := x509.MarshalPKCS1PrivateKey(privateKey)
88 privateBlock := &pem.Block{
89 Type: "RSA PRIVATE KEY",
90 Headers: nil,
91 Bytes: privateKeyBytes,
92 }
93 return pem.EncodeToMemory(privateBlock)
94}
95
96func rsaDecodePrivateKey(bytes []byte) (*rsa.PrivateKey, error) {
97 block, _ := pem.Decode(bytes)

Callers 1

LoadOrGenerateRSAHostKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected