Commit 862a639c authored by tavit ohanian's avatar tavit ohanian

initial port

parent ba620770
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
crypto_pb "gitlab.dms3.io/p2p/go-p2p-core/crypto/pb" crypto_pb "gitlab.dms3.io/p2p/go-p2p-core/crypto/pb"
) )
var message = []byte("Libp2p is the _best_!") var message = []byte("P2p is the _best_!")
type testCase struct { type testCase struct {
keyType crypto_pb.KeyType keyType crypto_pb.KeyType
......
// Package crypto implements various cryptographic utilities used by libp2p. // Package crypto implements various cryptographic utilities used by p2p.
// This includes a Public and Private key interface and key implementations // This includes a Public and Private key interface and key implementations
// for supported key algorithms. // for supported key algorithms.
package crypto package crypto
...@@ -77,7 +77,7 @@ type Key interface { ...@@ -77,7 +77,7 @@ type Key interface {
Equals(Key) bool Equals(Key) bool
// Raw returns the raw bytes of the key (not wrapped in the // Raw returns the raw bytes of the key (not wrapped in the
// libp2p-crypto protobuf). // p2p-crypto protobuf).
// //
// This function is the inverse of {Priv,Pub}KeyUnmarshaler. // This function is the inverse of {Priv,Pub}KeyUnmarshaler.
Raw() ([]byte, error) Raw() ([]byte, error)
......
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
btcec "github.com/btcsuite/btcd/btcec" btcec "github.com/btcsuite/btcd/btcec"
) )
// KeyPairFromStdKey wraps standard library (and secp256k1) private keys in libp2p/go-libp2p-core/crypto keys // KeyPairFromStdKey wraps standard library (and secp256k1) private keys in p2p/go-p2p-core/crypto keys
func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) { func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
if priv == nil { if priv == nil {
return nil, nil, ErrNilPrivateKey return nil, nil, ErrNilPrivateKey
...@@ -39,7 +39,7 @@ func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) { ...@@ -39,7 +39,7 @@ func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
} }
} }
// PrivKeyToStdKey converts libp2p/go-libp2p-core/crypto private keys to standard library (and secp256k1) private keys // PrivKeyToStdKey converts p2p/go-p2p-core/crypto private keys to standard library (and secp256k1) private keys
func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) { func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) {
if priv == nil { if priv == nil {
return nil, ErrNilPrivateKey return nil, ErrNilPrivateKey
...@@ -59,7 +59,7 @@ func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) { ...@@ -59,7 +59,7 @@ func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) {
} }
} }
// PubKeyToStdKey converts libp2p/go-libp2p-core/crypto private keys to standard library (and secp256k1) public keys // PubKeyToStdKey converts p2p/go-p2p-core/crypto private keys to standard library (and secp256k1) public keys
func PubKeyToStdKey(pub PubKey) (crypto.PublicKey, error) { func PubKeyToStdKey(pub PubKey) (crypto.PublicKey, error) {
if pub == nil { if pub == nil {
return nil, ErrNilPublicKey return nil, ErrNilPublicKey
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
openssl "gitlab.dms3.io/p2p/go-openssl" openssl "gitlab.dms3.io/p2p/go-openssl"
) )
// KeyPairFromStdKey wraps standard library (and secp256k1) private keys in libp2p/go-libp2p-core/crypto keys // KeyPairFromStdKey wraps standard library (and secp256k1) private keys in p2p/go-p2p-core/crypto keys
func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) { func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
if priv == nil { if priv == nil {
return nil, nil, ErrNilPrivateKey return nil, nil, ErrNilPrivateKey
...@@ -46,7 +46,7 @@ func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) { ...@@ -46,7 +46,7 @@ func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
} }
} }
// PrivKeyToStdKey converts libp2p/go-libp2p-core/crypto private keys to standard library (and secp256k1) private keys // PrivKeyToStdKey converts p2p/go-p2p-core/crypto private keys to standard library (and secp256k1) private keys
func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) { func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) {
if priv == nil { if priv == nil {
return nil, ErrNilPrivateKey return nil, ErrNilPrivateKey
...@@ -69,7 +69,7 @@ func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) { ...@@ -69,7 +69,7 @@ func PrivKeyToStdKey(priv PrivKey) (crypto.PrivateKey, error) {
} }
} }
// PubKeyToStdKey converts libp2p/go-libp2p-core/crypto private keys to standard library (and secp256k1) public keys // PubKeyToStdKey converts p2p/go-p2p-core/crypto private keys to standard library (and secp256k1) public keys
func PubKeyToStdKey(pub PubKey) (crypto.PublicKey, error) { func PubKeyToStdKey(pub PubKey) (crypto.PublicKey, error) {
if pub == nil { if pub == nil {
return nil, ErrNilPublicKey return nil, ErrNilPublicKey
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
// WeakRsaKeyEnv is an environment variable which, when set, lowers the // WeakRsaKeyEnv is an environment variable which, when set, lowers the
// minimum required bits of RSA keys to 512. This should be used exclusively in // minimum required bits of RSA keys to 512. This should be used exclusively in
// test situations. // test situations.
const WeakRsaKeyEnv = "LIBP2P_ALLOW_WEAK_RSA_KEYS" const WeakRsaKeyEnv = "P2P_ALLOW_WEAK_RSA_KEYS"
var MinRsaKeyBits = 2048 var MinRsaKeyBits = 2048
......
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