mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-22 08:24:25 +01:00
V2 certificate format (#1216)
Co-authored-by: Nate Brown <nbrown.us@gmail.com> Co-authored-by: Jack Doan <jackdoan@rivian.com> Co-authored-by: brad-defined <77982333+brad-defined@users.noreply.github.com> Co-authored-by: Jack Doan <me@jackdoan.com>
This commit is contained in:
@@ -49,6 +49,8 @@ func printCert(args []string, out io.Writer, errOut io.Writer) error {
|
||||
var qrBytes []byte
|
||||
part := 0
|
||||
|
||||
var jsonCerts []cert.Certificate
|
||||
|
||||
for {
|
||||
c, rawCert, err = cert.UnmarshalCertificateFromPEM(rawCert)
|
||||
if err != nil {
|
||||
@@ -56,13 +58,10 @@ func printCert(args []string, out io.Writer, errOut io.Writer) error {
|
||||
}
|
||||
|
||||
if *pf.json {
|
||||
b, _ := json.Marshal(c)
|
||||
out.Write(b)
|
||||
out.Write([]byte("\n"))
|
||||
|
||||
jsonCerts = append(jsonCerts, c)
|
||||
} else {
|
||||
out.Write([]byte(c.String()))
|
||||
out.Write([]byte("\n"))
|
||||
_, _ = out.Write([]byte(c.String()))
|
||||
_, _ = out.Write([]byte("\n"))
|
||||
}
|
||||
|
||||
if *pf.outQRPath != "" {
|
||||
@@ -80,6 +79,12 @@ func printCert(args []string, out io.Writer, errOut io.Writer) error {
|
||||
part++
|
||||
}
|
||||
|
||||
if *pf.json {
|
||||
b, _ := json.Marshal(jsonCerts)
|
||||
_, _ = out.Write(b)
|
||||
_, _ = out.Write([]byte("\n"))
|
||||
}
|
||||
|
||||
if *pf.outQRPath != "" {
|
||||
b, err := qrcode.Encode(string(qrBytes), qrcode.Medium, -5)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user