Skip to content

Commit

Permalink
✨ feat: adobe trust certs support
Browse files Browse the repository at this point in the history
  • Loading branch information
shurco committed May 1, 2024
1 parent 61a76a5 commit 8a10f6f
Show file tree
Hide file tree
Showing 34 changed files with 1,185 additions and 618 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ __debug_bin*
cmd/goSign/lc_*

EXPERIMENT_*
web/public/fixtures
web/public/fixtures
gosign.toml
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"program": "${workspaceFolder}/cmd/goSign",
"envFile": "${workspaceFolder}/docker/.env",
"args": ["serve"],
//"args": ["gen", "--config"],
},
{
"name": "pdf",
Expand Down
14 changes: 7 additions & 7 deletions cmd/cert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,43 @@ var (

func main() {
// CA cert
pkey, err := generatePrivateKey(caKeyPath)
pKey, err := generatePrivateKey(caKeyPath)
if err != nil {
log.Fatal(err)
}
fmt.Println("CA private key file generated", caKeyPath)

caCert, err := generateCA(pkey.PrivateKey)
caCert, err := generateCA(pKey.PrivateKey)
if err != nil {
log.Fatal(err)
}
fmt.Println("CA certificate file generated")

if err := generateCRL(pkey.PrivateKey, caCert.Cert); err != nil {
if err := generateCRL(pKey.PrivateKey, caCert.Cert); err != nil {
log.Fatal(err)
}
fmt.Println("CRL file generated", caCRLPath)

// CA Intermed cert
ipkey, err := generatePrivateKey(caInterKeyPath)
ipKey, err := generatePrivateKey(caInterKeyPath)
if err != nil {
log.Fatal(err)
}
fmt.Println("Private key file generated", caInterKeyPath)

if err := generateIntermediateCert(ipkey.PrivateKey); err != nil {
if err := generateIntermediateCert(ipKey.PrivateKey); err != nil {
log.Fatal(err)
}
fmt.Println("CA Intermed certificate file generated")

// user cert
upkey, err := generatePrivateKey(uKeyPath)
upKey, err := generatePrivateKey(uKeyPath)
if err != nil {
log.Fatal(err)
}
fmt.Println("user private key file generated", uKeyPath)

if err := generateCert(upkey.PrivateKey); err != nil {
if err := generateCert(upKey.PrivateKey); err != nil {
log.Fatal(err)
}
fmt.Println("user certificate file generated", uPath)
Expand Down
23 changes: 23 additions & 0 deletions cmd/goSign/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func main() {
})

rootCmd.AddCommand(cmdServe())
rootCmd.AddCommand(cmdGen())

if err := rootCmd.Execute(); err != nil {
os.Exit(1)
Expand All @@ -50,3 +51,25 @@ func cmdServe() *cobra.Command {

return cmd
}

func cmdGen() *cobra.Command {
var configFile, keyJWT, keyLicense bool
cmd := &cobra.Command{
Use: "gen [flags]",
Short: "Generate keys and config files",
Run: func(serveCmd *cobra.Command, args []string) {
if !configFile && !keyJWT && !keyLicense {
serveCmd.Help()
}
if configFile {
if err := app.GenConfigFile(); err != nil {
fmt.Print("Config file generated")
os.Exit(1)
}
}
},
}

cmd.PersistentFlags().BoolVar(&configFile, "config", false, "config file")
return cmd
}
19 changes: 15 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ require (
github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352
github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/gofiber/contrib/fiberzerolog v1.0.0
github.com/gofiber/contrib/fiberzerolog v1.0.1
github.com/gofiber/fiber/v2 v2.52.4
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.5.5
github.com/joho/godotenv v1.5.1
github.com/mattetti/filebuffer v1.0.1
github.com/pressly/goose/v3 v3.19.2
github.com/pdfcpu/pdfcpu v0.8.0
github.com/pelletier/go-toml/v2 v2.2.1
github.com/pressly/goose/v3 v3.20.0
github.com/redis/go-redis/v9 v9.5.1
github.com/robfig/cron/v3 v3.0.0
github.com/rs/zerolog v1.32.0
github.com/signintech/gopdf v0.24.0
github.com/signintech/gopdf v0.25.0
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/cobra v1.8.0
golang.org/x/crypto v0.22.0
Expand All @@ -29,11 +31,14 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/hhrutter/lzw v1.0.0 // indirect
github.com/hhrutter/tiff v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
Expand All @@ -42,13 +47,19 @@ require (
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sethvargo/go-retry v0.2.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tinylib/msgp v1.1.9 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.52.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
modernc.org/libc v1.50.2 // indirect
modernc.org/sqlite v1.29.8 // indirect
)
Loading

0 comments on commit 8a10f6f

Please sign in to comment.