File tree Expand file tree Collapse file tree 1 file changed +23
-24
lines changed
dtls/examples/certificates Expand file tree Collapse file tree 1 file changed +23
-24
lines changed Original file line number Diff line number Diff line change @@ -30,27 +30,26 @@ in pion/examples/util/util.go, convert ECPrivateKey to PKCS8PrivateKey
30
30
func LoadKey (path string ) (crypto .PrivateKey , error ) {
31
31
....
32
32
if key , err := x509.ParseECPrivateKey (block.Bytes ); err == nil {
33
- b , err := x509.MarshalPKCS8PrivateKey (key)
34
- if err != nil {
35
- return nil , err
36
- }
37
- var pemPrivateBlock = &pem.Block {
38
- Type: " PRIVATE KEY" ,
39
- Bytes: b,
40
- }
41
- pemPrivateFile , err := os.Create (path+" .private_key.pem" )
42
- if err != nil {
43
- fmt.Println (err)
44
- os.Exit (1 )
45
- }
46
- err = pem.Encode (pemPrivateFile, pemPrivateBlock)
47
- if err != nil {
48
- fmt.Println (err)
49
- os.Exit (1 )
50
- }
51
- pemPrivateFile.Close ()
52
-
53
- return key, nil
54
- }
55
- ...
56
- ` ` `
33
+ ` ` ` b, err := x509.MarshalPKCS8PrivateKey(key)
34
+ if err != nil {
35
+ return nil, err
36
+ }
37
+ var pemPrivateBlock = &pem.Block{
38
+ Type: "PRIVATE KEY",
39
+ Bytes: b,
40
+ }
41
+ pemPrivateFile, err := os.Create(path+".private_key.pem")
42
+ if err != nil {
43
+ fmt.Println(err)
44
+ os.Exit(1)
45
+ }
46
+ err = pem.Encode(pemPrivateFile, pemPrivateBlock)
47
+ if err != nil {
48
+ fmt.Println(err)
49
+ os.Exit(1)
50
+ }
51
+ pemPrivateFile.Close()
52
+
53
+ return key, nil
54
+ }
55
+ ...
You can’t perform that action at this time.
0 commit comments