https://github.com/projectdiscovery/sslcert
Reworked version of https://golang.org/src/crypto/tls/generate_cert.go
https://github.com/projectdiscovery/sslcert
cli
Last synced: about 1 year ago
JSON representation
Reworked version of https://golang.org/src/crypto/tls/generate_cert.go
- Host: GitHub
- URL: https://github.com/projectdiscovery/sslcert
- Owner: projectdiscovery
- License: mit
- Created: 2021-04-16T14:01:46.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-08-21T04:14:04.000Z (almost 3 years ago)
- Last Synced: 2025-04-02T21:39:01.542Z (about 1 year ago)
- Topics: cli
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 12
- Watchers: 12
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# sslcert
[](LICENSE.md)

[](https://github.com/projectdiscovery/sslcert/releases/)
[](https://github.com/projectdiscovery/sslcert/actions/workflows/build-test.yml)
[](https://pkg.go.dev/github.com/projectdiscovery/sslcert)
sslcert library generates a new tlsconfig usable within go standard library configured with a self-signed certificate generated on the fly.
# Example
```go
package main
import (
"fmt"
"log"
"net/http"
"github.com/projectdiscovery/sslcert"
)
func main() {
tlsOptions := sslcert.DefaultOptions
tlsOptions.Host = "example.com"
// Create TLSConfig using options
tlsConfig, err := sslcert.NewTLSConfig(tlsOptions)
if err != nil {
log.Fatal(err)
}
// using tlsconfig to host http server
server := &http.Server{
Addr: ":8000",
TLSConfig: tlsConfig,s
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello World"))
})
fmt.Println("Started HTTPS server on " + server.Addr)
fmt.Println("Check it out at https://localhost:8000/")
if err := server.ListenAndServeTLS("", ""); err != nil {
log.Fatal(err)
}
}
```