|
17 | 17 | package streamer.bco; |
18 | 18 |
|
19 | 19 | import org.apache.log4j.Logger; |
20 | | -import org.bouncycastle.crypto.tls.Certificate; |
21 | | -import org.bouncycastle.crypto.tls.DefaultTlsClient; |
22 | | -import org.bouncycastle.crypto.tls.ServerOnlyTlsAuthentication; |
23 | | -import org.bouncycastle.crypto.tls.TlsAuthentication; |
24 | | -import org.bouncycastle.crypto.tls.TlsClientProtocol; |
25 | 20 | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| 21 | +import org.bouncycastle.tls.DefaultTlsClient; |
| 22 | +import org.bouncycastle.tls.ServerOnlyTlsAuthentication; |
| 23 | +import org.bouncycastle.tls.TlsAuthentication; |
| 24 | +import org.bouncycastle.tls.TlsClientProtocol; |
| 25 | +import org.bouncycastle.tls.TlsServerCertificate; |
| 26 | +import org.bouncycastle.tls.crypto.impl.bc.BcTlsCrypto; |
26 | 27 | import streamer.Direction; |
27 | 28 | import streamer.Event; |
28 | 29 | import streamer.SocketWrapperImpl; |
@@ -60,18 +61,18 @@ public void upgradeToSsl() { |
60 | 61 |
|
61 | 62 | try { |
62 | 63 |
|
63 | | - SecureRandom secureRandom = new SecureRandom(); |
64 | | - bcoSslSocket = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(), secureRandom); |
| 64 | + bcoSslSocket = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream()); |
65 | 65 |
|
66 | | - bcoSslSocket.connect(new DefaultTlsClient() { |
| 66 | + bcoSslSocket.connect(new DefaultTlsClient(new BcTlsCrypto(new SecureRandom())) { |
67 | 67 | @Override |
68 | 68 | public TlsAuthentication getAuthentication() throws IOException { |
69 | 69 | return new ServerOnlyTlsAuthentication() { |
70 | 70 | @Override |
71 | | - public void notifyServerCertificate(final Certificate certificate) throws IOException { |
| 71 | + public void notifyServerCertificate(final TlsServerCertificate certificate) throws IOException { |
72 | 72 | try { |
73 | 73 | if (sslState != null) { |
74 | | - sslState.serverCertificateSubjectPublicKeyInfo = certificate.getCertificateAt(0).getSubjectPublicKeyInfo().getEncoded(); |
| 74 | + sslState.serverCertificateSubjectPublicKeyInfo = |
| 75 | + certificate.getCertificate().getCertificateAt(0).getEncoded(); |
75 | 76 | } |
76 | 77 | } catch (IOException e) { |
77 | 78 | throw new RuntimeException("Cannot get server public key.", e); |
|
0 commit comments