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

startService报错javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake #1

Open
KevinChan168 opened this issue Nov 24, 2021 · 8 comments

Comments

@KevinChan168
Copy link

KevinChan168 commented Nov 24, 2021

环境:win10,装好itunes,能正确识别到iphoneX,ios 14.4.2
运行main.java报错

2021-11-24 16:42:49 [main] [protocol.UsbMux.deviceConnect(UsbMux.java:85)] - [INFO] Connecting Device :14 port:62078
2021-11-24 16:42:49 [main] [protocol.UsbMux.deviceConnect(UsbMux.java:85)] - [INFO] Connecting Device :14 port:62078
2021-11-24 16:42:49 [main] [protocol.LockDown.validatePairing(LockDown.java:191)] - [ERROR] ssl Handshake error
2021-11-24 16:42:49 [main] [protocol.LockDown.pairFull(LockDown.java:103)] - [INFO] DevicePublicKey pair full
2021-11-24 16:42:50 [main] [protocol.UsbMux.deviceConnect(UsbMux.java:85)] - [INFO] Connecting Device :14 port:62078
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:994)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:750)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at java.io.OutputStream.write(OutputStream.java:75)
at protocol.PlistSocket.sendAll(PlistSocket.java:146)
at protocol.PlistSocket.sendPacket(PlistSocket.java:109)
at protocol.PlistSocket.sendRecvPacket(PlistSocket.java:140)
at protocol.LockDown.startService(LockDown.java:58)
at servers.SyslogService.(SyslogService.java:15)
at Main.main(Main.java:8)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
... 10 more
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1533)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:95)
at protocol.PlistSocket.recvAll(PlistSocket.java:155)
at protocol.PlistSocket.recvPacket(PlistSocket.java:126)
at protocol.PlistSocket.sendRecvPacket(PlistSocket.java:141)
at protocol.LockDown.startService(LockDown.java:58)
at servers.SyslogService.(SyslogService.java:15)
at Main.main(Main.java:8)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:994)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:750)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at java.io.OutputStream.write(OutputStream.java:75)
at protocol.PlistSocket.sendAll(PlistSocket.java:146)
at protocol.PlistSocket.sendPacket(PlistSocket.java:109)
at protocol.PlistSocket.sendRecvPacket(PlistSocket.java:140)
... 3 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
... 10 more
Exception in thread "main" exception.lockdown.StartServiceError: Unable to start service={name!r} - not paired
at protocol.LockDown.startService(LockDown.java:60)
at servers.SyslogService.(SyslogService.java:15)
at Main.main(Main.java:8)

Process finished with exit code 1

debug看了下,是NSDictionary resp = svc.sendRecvPacket(root);这里的resp为null,辛苦大佬看看

public PlistSocket startService(String name) throws Exception {
    if (!paired){
        paired=Pair();
    }
    NSData escrow_bag = (NSData) record.get("EscrowBag");
    NSDictionary root = new NSDictionary();
    root.put("Request","StartService");
    root.put("Service",name);
    root.put("EscrowBag",escrow_bag);
    NSDictionary resp = svc.sendRecvPacket(root);
    if (resp==null){
        throw new StartServiceError("Unable to start service={name!r} - not paired");
    }
@YueChen-C
Copy link
Owner

这个我记得是 java ssl 这个库的问题 ,因为苹果下发的证书没有 CN 信息,但是 这个 ssl 库又必须要这个。你先用 java 主动 pull 自签证书试下
new LockDown("xxxx",false).pairFull();

@KevinChan168
Copy link
Author

这个我记得是 java ssl 这个库的问题 ,因为苹果下发的证书没有 CN 信息,但是 这个 ssl 库又必须要这个。你先用 java 主动 pull 自签证书试下 new LockDown("xxxx",false).pairFull();

试过不行,我用python的跑了一次,java的就好了,看了下是lockdown plist文件在python的跑的时候更新了,那就是java的库里面缺失了更新lockdown plist文件的操作

@GaoXing0608
Copy link

这个我记得是 java ssl 这个库的问题 ,因为苹果下发的证书没有 CN 信息,但是 这个 ssl 库又必须要这个。你先用 java 主动 pull 自签证书试下 new LockDown("xxxx",false).pairFull();

试过不行,我用python的跑了一次,java的就好了,看了下是lockdown plist文件在python的跑的时候更新了,那就是java的库里面缺失了更新lockdown plist文件的操作

我用python可以正常监控,可是Java还是报错

@KevinChan168
Copy link
Author

这个我记得是 java ssl 这个库的问题 ,因为苹果下发的证书没有 CN 信息,但是 这个 ssl 库又必须要这个。你先用 java 主动 pull 自签证书试下 new LockDown("xxxx",false).pairFull();

试过不行,我用python的跑了一次,java的就好了,看了下是lockdown plist文件在python的跑的时候更新了,那就是java的库里面缺失了更新lockdown plist文件的操作

我用python可以正常监控,可是Java还是报错

报的什么错

@GaoXing0608
Copy link

Exception in thread "main" exception.lockdown.StartServiceError: Unable to start service={name!r} - not paired
和你上面的一样

@mutexz
Copy link

mutexz commented Mar 30, 2022

Exception in thread "main" exception.lockdown.StartServiceError: Unable to start service={name!r} - not paired 和你上面的一样

你好,这个问题你最后解决了吗?现在也是卡在这个resp是null这里了,没法往下走

@GaoXing0608
Copy link

Exception in thread "main" exception.lockdown.StartServiceError: Unable to start service={name!r} - not paired 和你上面的一样

你好,这个问题你最后解决了吗?现在也是卡在这个resp是null这里了,没法往下走

没有,我在服务器端做了个接口,把python版本的代码copy了一下,然后调用这个接口解决的需求

@HackHarry
Copy link

这个我记得是 java ssl 这个库的问题 ,因为苹果下发的证书没有 CN 信息,但是 这个 ssl 库又必须要这个。你先用 java 主动 pull 自签证书试下 new LockDown("xxxx",false).pairFull();

这样做好像就需要手机重新信任一下设备。。。大佬们有没有找到能够绕过java检测DN的方法呀?

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

No branches or pull requests

5 participants