Commit b9f8c183 authored by Matthew Holt's avatar Matthew Holt

gofmt!

parent 37d05092
...@@ -18,7 +18,7 @@ func loadPrivateKey(file string) (crypto.PrivateKey, error) { ...@@ -18,7 +18,7 @@ func loadPrivateKey(file string) (crypto.PrivateKey, error) {
return nil, err return nil, err
} }
keyBlock, _ := pem.Decode(keyBytes) keyBlock, _ := pem.Decode(keyBytes)
switch keyBlock.Type { switch keyBlock.Type {
case "RSA PRIVATE KEY": case "RSA PRIVATE KEY":
return x509.ParsePKCS1PrivateKey(keyBlock.Bytes) return x509.ParsePKCS1PrivateKey(keyBlock.Bytes)
...@@ -45,7 +45,7 @@ func savePrivateKey(key crypto.PrivateKey, file string) error { ...@@ -45,7 +45,7 @@ func savePrivateKey(key crypto.PrivateKey, file string) error {
pemType = "RSA" pemType = "RSA"
keyBytes = x509.MarshalPKCS1PrivateKey(key) keyBytes = x509.MarshalPKCS1PrivateKey(key)
} }
pemKey := pem.Block{Type: pemType + " PRIVATE KEY", Bytes: keyBytes} pemKey := pem.Block{Type: pemType + " PRIVATE KEY", Bytes: keyBytes}
keyOut, err := os.Create(file) keyOut, err := os.Create(file)
if err != nil { if err != nil {
......
...@@ -88,9 +88,9 @@ func TestSaveAndLoadECCPrivateKey(t *testing.T) { ...@@ -88,9 +88,9 @@ func TestSaveAndLoadECCPrivateKey(t *testing.T) {
} }
// verify loaded key is correct // verify loaded key is correct
if !PrivateKeysSame(privateKey, loadedKey) { if !PrivateKeysSame(privateKey, loadedKey) {
t.Error("Expected key bytes to be the same, but they weren't") t.Error("Expected key bytes to be the same, but they weren't")
} }
} }
// PrivateKeysSame compares the bytes of a and b and returns true if they are the same. // PrivateKeysSame compares the bytes of a and b and returns true if they are the same.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment