Refactoring-1811

This commit is contained in:
Naoki Kosaka
2018-11-25 23:40:21 +09:00
parent 4c84636b29
commit 2e883d9aed
16 changed files with 406 additions and 200 deletions

View File

@ -6,7 +6,6 @@ import (
"encoding/pem"
"fmt"
"io/ioutil"
"unsafe"
)
func ReadPrivateKeyRSAfromPath(path string) (*rsa.PrivateKey, error) {
@ -23,7 +22,7 @@ func ReadPrivateKeyRSAfromPath(path string) (*rsa.PrivateKey, error) {
}
func ReadPublicKeyRSAfromString(pemString string) (*rsa.PublicKey, error) {
pemByte := *(*[]byte)(unsafe.Pointer(&pemString))
pemByte := []byte(pemString)
decoded, _ := pem.Decode(pemByte)
keyInterface, err := x509.ParsePKIXPublicKey(decoded.Bytes)
if err != nil {