MCPcopy Index your code
hub / github.com/bettercap/bettercap / CertConfigFromModule

Function CertConfigFromModule

tls/cert.go:68–83  ·  view source on GitHub ↗
(prefix string, m session.SessionModule)

Source from the content-addressed store, hash-verified

66}
67
68func CertConfigFromModule(prefix string, m session.SessionModule) (cfg CertConfig, err error) {
69 if err, cfg.Bits = m.IntParam(prefix + ".certificate.bits"); err != nil {
70 return cfg, err
71 } else if err, cfg.Country = m.StringParam(prefix + ".certificate.country"); err != nil {
72 return cfg, err
73 } else if err, cfg.Locality = m.StringParam(prefix + ".certificate.locality"); err != nil {
74 return cfg, err
75 } else if err, cfg.Organization = m.StringParam(prefix + ".certificate.organization"); err != nil {
76 return cfg, err
77 } else if err, cfg.OrganizationalUnit = m.StringParam(prefix + ".certificate.organizationalunit"); err != nil {
78 return cfg, err
79 } else if err, cfg.CommonName = m.StringParam(prefix + ".certificate.commonname"); err != nil {
80 return cfg, err
81 }
82 return cfg, err
83}
84
85func CreateCertificate(cfg CertConfig, ca bool) (*rsa.PrivateKey, []byte, error) {
86 priv, err := rsa.GenerateKey(rand.Reader, cfg.Bits)

Callers 5

ConfigureMethod · 0.92
ConfigureMethod · 0.92
ConfigureMethod · 0.92
ConfigureMethod · 0.92
TestCertConfigFromModuleFunction · 0.85

Calls 2

IntParamMethod · 0.80
StringParamMethod · 0.80

Tested by 1

TestCertConfigFromModuleFunction · 0.68