-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (31 loc) · 765 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
// "crypto"
"fmt"
"io/ioutil"
// "errors"
// "encoding/pem"
// "encoding/x509"
"github.com/spacemonkeygo/openssl"
)
func checkError(err error){
fmt.Errorf("Error: ", err)
}
func loadPrivateKey(path string) (openssl.PrivateKey, error){
pri_key, err := ioutil.ReadFile(path)
checkError(err)
return openssl.LoadPrivateKeyFromPEM(pri_key)
}
func loadPublicKey(path string) (openssl.PublicKey, error){
pub_key, err := ioutil.ReadFile(path)
checkError(err)
return openssl.LoadPublicKeyFromPEM(pub_key)
}
func main(){
private, err := loadPrivateKey("private.pem")
checkError(err)
// fmt.Println("Private Key: ",private)
public, err := loadPublicKey("public.pem")
checkError(err)
// fmt.Println("Public Key: ", public)
}