2025-03-08 15:07:27 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/x509"
|
|
|
|
"encoding/pem"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2025-03-09 15:52:33 -04:00
|
|
|
"koti.casa/numenor-labs/dsfx/pkg/crypto/identity"
|
2025-03-08 15:07:27 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2025-03-09 15:52:33 -04:00
|
|
|
key, err := identity.GenerateSigningKey()
|
2025-03-08 15:07:27 -05:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Encode the private key to der
|
|
|
|
der, err := x509.MarshalECPrivateKey(key)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Encode the private key to PEM
|
|
|
|
pem := pem.EncodeToMemory(&pem.Block{
|
|
|
|
Type: "PRIVATE KEY",
|
|
|
|
Bytes: der,
|
|
|
|
})
|
|
|
|
|
|
|
|
fmt.Fprint(os.Stdout, string(pem))
|
|
|
|
}
|