[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iaik-ssl] PEM fcertificate?



Title: SV: [iaik-ssl] PEM fcertificate?
Hello.
 
Thanks for the answers!
 
As I understand it I can read the pem file, and make a new X509 certificate of it. Is this right? I have more questions: Where do I put my password? Must I do anything more to open a SSL connection?
 
Regards
Pierre Andersson
----- Original Message -----
From: Jonas Olsson
To: 'Pierre Andersson' ; iaik-ssl@iaik.at ; iaik-jce@iaik.at
Sent: Monday, August 28, 2000 12:52 PM
Subject: SV: [iaik-ssl] PEM fcertificate?

  public RSVIAIKSocket(String host,int port,String clientCert,String key,String serverCert) throws Exception
  {
    IAIK.addAsProvider();
   
    SSLClientContext context = new SSLClientContext();
    context.setChainVerifier(null);
   
    X509Certificate chain[] = new X509Certificate[2];
   
    InputStream inStream = new FileInputStream(clientCert);
    chain[0] = new X509Certificate(inStream);
    inStream.close();

    inStream = new FileInputStream(serverCert);
    chain[1] = new X509Certificate(inStream);
    inStream.close();
   
    inStream = new FileInputStream(key);
    PrivateKey privateKey = new SSLeayPrivateKey(inStream).getPrivateKey();
    inStream.close();
   
    context.addClientCredentials(chain, privateKey);
   
    socket = new SSLSocket(host, port, context);
  }

where clientCert and serverCert are PEM-files.

/jonas