Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-tls
Commits
d967a5a8
Unverified
Commit
d967a5a8
authored
Feb 17, 2019
by
Marten Seemann
Committed by
GitHub
Feb 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13 from libp2p/better-type-checking
avoid using interface{} when generating certificates
parents
22625285
2e05af61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
crypto.go
crypto.go
+4
-2
No files found.
crypto.go
View file @
d967a5a8
package
libp2ptls
import
(
"crypto"
"crypto/rand"
"crypto/tls"
"crypto/x509"
...
...
@@ -104,7 +105,7 @@ func getRemotePubKey(chain []*x509.Certificate) (ic.PubKey, error) {
}
}
func
keyToCertificate
(
sk
ic
.
PrivKey
)
(
interface
{}
,
*
x509
.
Certificate
,
error
)
{
func
keyToCertificate
(
sk
ic
.
PrivKey
)
(
crypto
.
PrivateKey
,
*
x509
.
Certificate
,
error
)
{
sn
,
err
:=
rand
.
Int
(
rand
.
Reader
,
big
.
NewInt
(
1
<<
62
))
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -115,7 +116,8 @@ func keyToCertificate(sk ic.PrivKey) (interface{}, *x509.Certificate, error) {
NotAfter
:
time
.
Now
()
.
Add
(
certValidityPeriod
),
}
var
publicKey
,
privateKey
interface
{}
var
privateKey
crypto
.
PrivateKey
var
publicKey
crypto
.
PublicKey
keyBytes
,
err
:=
sk
.
Bytes
()
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment