Skip to content

Commit

Permalink
#39 not work
Browse files Browse the repository at this point in the history
  • Loading branch information
peacess committed Feb 2, 2021
1 parent ea34693 commit 17b2433
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions packages/services/lib/src/rpc_client/channel_credentials.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ class ChannelCredentialsEx extends ChannelCredentials {

@override
SecurityContext get securityContext {
// SecurityContext context = new SecurityContext(withTrustedRoots: true);
//dart不支持使用dot组件生成的证书及key,所以只能单向认证
SecurityContext context = createSecurityContext(true);
// context.setAlpnProtocols(supportedAlpnProtocols, false);
//
// // context.setTrustedCertificatesBytes(certBytes);

// context.setTrustedCertificatesBytes(certBytes);
// context.usePrivateKeyBytes(keyBytes);
// context.useCertificateChainBytes(chainBytes);
// context.setClientAuthoritiesBytes(certBytes);

SecurityContext context = new SecurityContext(withTrustedRoots: true);
context.setTrustedCertificatesBytes(certBytes);
// SecurityContext context = new SecurityContext(withTrustedRoots: true);
// context.setTrustedCertificatesBytes(certBytes);
return context;
}
}
2 changes: 1 addition & 1 deletion packages/services/test/grpc_tls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void main() {
});
test('ClientTransportChannel Mutual tls', () async {
//todo 不能成功连接服务端,所以直接返回
return;
// return;
Process serverTls1;
var channel = createClientChannel(() async {
ConnectParameter re = new ConnectParameter("localhost", 50051);
Expand Down

0 comments on commit 17b2433

Please sign in to comment.