简体   繁体   中英

Generate Certificate stuck Java

I'm trying to generate a certificate from a socket input stream but it seems to get stuck when I use the method form CertificateFactory. The program keeps running in the console when it should end.

Here is the code:

public PublicKey getCertificate() throws IOException, CertificateException
{
    String resp= br.readLine();
    System.out.println(resp);
    CertificateFactory  cf = CertificateFactory.getInstance("X.509");
    System.out.println("GOING TO CREATE CERTIFICATE");
    Certificate certificate =  cf.generateCertificate(socket.getInputStream()); //GETS STUCK

    System.out.println("SUCCESS");
    pw.println(RTA+":"+OK);

    return certificate.getPublicKey();
}

The console shows no error whatsoever so I don't know what could be wrong, also I know the socket is getting the information since this is part of a larger communication protocol and the previous communications worked

无论您连接的是不是发送完整的二进制证书或没有关闭套接字。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM