nl.nikhef.slcshttps
Class PKCS12Https.StdioComm

java.lang.Object
  extended by nl.nikhef.slcshttps.PKCS12Https.StdioComm
All Implemented Interfaces:
PKCS12Https.PKCS12Communicator
Enclosing class:
PKCS12Https

static class PKCS12Https.StdioComm
extends Object
implements PKCS12Https.PKCS12Communicator

This Implementation uses only stdio/stderr for I/O.

Version:
0.1
Author:
Mischa Sallé
See Also:
PKCS12Https.PKCS12Communicator

Constructor Summary
PKCS12Https.StdioComm()
           
 
Method Summary
 void error(String filename, Exception e)
          Called when an error occurs, printing an error string about the filename (if non-null) and the Throwable.getMessage() from e (when non-null) on stderr.
 String getFile(String path)
          Method to get the PKCS12 filename from the user, using stdout and ConsoleTools.readLine().
 char[] getPassword(String prompt)
          Method to get the PKCS12 password from the user, using ConsoleTools.getPassword(String).
 void success(String filename, String subject)
          Called when the PKCS12 file is successfully imported and the certificate stored; when PKCS12Https.getShowSuccess() equals true it will print a confirmation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS12Https.StdioComm

PKCS12Https.StdioComm()
Method Detail

getPassword

public char[] getPassword(String prompt)
                   throws IOException
Method to get the PKCS12 password from the user, using ConsoleTools.getPassword(String).

Specified by:
getPassword in interface PKCS12Https.PKCS12Communicator
Parameters:
prompt - String to print before input.
Returns:
char[] representation of the password
Throws:
IOException - upon I/O error

getFile

public String getFile(String path)
               throws IOException
Method to get the PKCS12 filename from the user, using stdout and ConsoleTools.readLine().

Specified by:
getFile in interface PKCS12Https.PKCS12Communicator
Parameters:
path - String path to start in, use as offset.
Returns:
String representation of the absolute filename.
Throws:
IOException - upon I/O error (including unreadability).

error

public void error(String filename,
                  Exception e)
           throws IOException
Called when an error occurs, printing an error string about the filename (if non-null) and the Throwable.getMessage() from e (when non-null) on stderr.

Specified by:
error in interface PKCS12Https.PKCS12Communicator
Parameters:
filename - String describing the PKCS12 filename which was tried.
e - Exception that caused the error (if any).
Throws:
IOException - with a (new) description of the problem

success

public void success(String filename,
                    String subject)
Called when the PKCS12 file is successfully imported and the certificate stored; when PKCS12Https.getShowSuccess() equals true it will print a confirmation.

Specified by:
success in interface PKCS12Https.PKCS12Communicator
Parameters:
filename - String describing the PKCS12 filename which was imported.
subject - String describing the Subject DN of the certificate.


nl.nikhef.slcshttps Mischa Sallé - msalle(AT)nikhef.nl