missed some files

This commit is contained in:
Matt Drollette
2014-12-11 00:05:41 -06:00
parent a457029b8c
commit 9b88ec00f5
3 changed files with 205 additions and 0 deletions

22
cmd/utils.go Normal file
View File

@@ -0,0 +1,22 @@
package cmd
import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"io/ioutil"
)
func loadPrivateKey(path string) (*rsa.PrivateKey, error) {
privPem, err := ioutil.ReadFile(path)
if nil != err {
return nil, err
}
privDer, _ := pem.Decode(privPem)
privKey, err := x509.ParsePKCS1PrivateKey(privDer.Bytes)
if nil != err {
return nil, err
}
return privKey, nil
}