Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable encryption #264

Closed
wenchaopeng opened this issue Mar 4, 2020 · 4 comments · Fixed by #423
Closed

disable encryption #264

wenchaopeng opened this issue Mar 4, 2020 · 4 comments · Fixed by #423

Comments

@wenchaopeng
Copy link

what do I need to do to unencrypt the message,I look at the source code, there should be no place to set,or I missed it
the source code is as follows:

message TopicDescriptor {
	optional string name = 1;
	optional AuthOpts auth = 2;
	optional EncOpts enc = 3;

	message AuthOpts {
		optional AuthMode mode = 1;
		repeated bytes keys = 2; // root keys to trust

		enum AuthMode {
			NONE = 0; // no authentication, anyone can publish
			KEY = 1; // only messages signed by keys in the topic descriptor are accepted
			WOT = 2; // web of trust, certificates can allow publisher set to grow
		}
	}

	message EncOpts {
		optional EncMode mode = 1;
		repeated bytes keyHashes = 2; // the hashes of the shared keys used (salted)

		enum EncMode {
			NONE = 0; // no encryption, anyone can read
			SHAREDKEY = 1; // messages are encrypted with shared key
			WOT = 2; // web of trust, certificates can allow publisher set to grow
		}
	}
}


func (p *PubSub) Subscribe(topic string, opts ...SubOpt) (*Subscription, error) {
	td := pb.TopicDescriptor{Name: &topic}

	return p.SubscribeByTopicDescriptor(&td, opts...)
}

func (p *PubSub) SubscribeByTopicDescriptor(td *pb.TopicDescriptor, opts ...SubOpt) (*Subscription, error) {
	if td.GetAuth().GetMode() != pb.TopicDescriptor_AuthOpts_NONE {
		return nil, fmt.Errorf("auth mode not yet supported")
	}
	if td.GetEnc().GetMode() != pb.TopicDescriptor_EncOpts_NONE {
		return nil, fmt.Errorf("encryption mode not yet supported")
	}
	topic, _, err := p.tryJoin(td.GetName())
	if err != nil {
		return nil, err
	}

	return topic.Subscribe(opts...)
}
@Stebalien
Copy link
Member

That code is out of date and should probably be removed at this point. Messages are encrypted at the transport layer, not within pubsub itself.

Stebalien added a commit that referenced this issue Mar 4, 2020
These have never actually been used and it doesn't look like anyone is actually
calling these functions in practice.

fixes #264
Stebalien added a commit that referenced this issue Mar 4, 2020
These have never actually been used and it doesn't look like anyone is actually
calling these functions in practice.

fixes #264
@wenchaopeng
Copy link
Author

OK,Let me see exactly where,during the process of using libp2p, I found that the CPU usage is very high, most of which is rsa encryption and decryption.

image

@wenchaopeng
Copy link
Author

sorry,I didn't find where to set the encrypted transmission. Could you give me some tips

@wenchaopeng
Copy link
Author

has been resolved, thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants