|
1 month ago | |
---|---|---|
handlers | 1 month ago | |
src | 1 month ago | |
templates | 1 month ago | |
.gitignore | 1 month ago | |
COPYING | 1 month ago | |
README.md | 1 month ago | |
active.de-DE.toml | 1 month ago | |
active.en-US.toml | 1 month ago | |
active.en.toml | 1 month ago | |
ca.cnf | 1 month ago | |
go.mod | 1 month ago | |
go.sum | 1 month ago | |
gulpfile.js | 1 month ago | |
main.go | 1 month ago | |
package-lock.json | 1 month ago | |
package.json | 1 month ago | |
setup_example_ca.sh | 1 month ago |
This repository contains a small proof of concept implementation of browser based PKCS#10 certificate signing request and PKCS#12 key store generation using node-forge.
The backend is implemented in Go and utilizes openssl for the signing operations.
Clone the repository
git clone https://git.dittberner.info/jan/browser_csr_generation.git
Get dependencies and build assets
cd browser_csr_generation
npm install --global gulp-cli
npm install
gulp
Setup the example CA and a server certificate and key
./setup_example_ca.sh
openssl req -new -x509 -days 365 -subj "/CN=localhost" -addext subjectAltName=DNS:localhost -newkey rsa:3072 \
-nodes -out server.crt.pem -keyout server.key.pem
Run the Go based backend
go run main.go
Open https://localhost:8000/ in your browser.
Run gulp watch
You can run a gulp watch
in a second terminal window to automatically publish changes to the files in the src
directory:
gulp watch
This PoC uses go-i18n for internationalization (i18n) support.
The translation workflow needs the go18n
binary which can be installed via
go get -u github.com/nicksnyder/go-i18n/v2/goi18n
To extract new messages from the code run
goi18n extract
Then use
goi18n merge active.*.toml
to create TOML files for translation as translate.<locale>.toml
. After translating the messages run
goi18n merge active.*.toml translate.*.toml
to merge the messages back into the active translation files. To add a new language you need to add the language code
to main.go
's i18n bundle loading code
for _, lang := range []string{"en-US", "de-DE"} {
if _, err := bundle.LoadMessageFile(fmt.Sprintf("active.%s.toml", lang)); err != nil {
log.Panic(err)
}
}