org.xtreemos.wp35.util
Class Utils

java.lang.Object
  extended by org.xtreemos.wp35.util.Utils

public class Utils
extends java.lang.Object

Chapter 6 Utils


Nested Class Summary
static class Utils.MyPassword
           
 
Field Summary
protected static java.lang.String COMMA
           
 
Constructor Summary
Utils()
           
 
Method Summary
static java.lang.String findSubjectAltName(java.util.Collection subjectAltNames, int nameType)
           
static java.security.KeyPair generateKeyPair(java.lang.String algorithm, int keylen)
           
static char[] getPassphrase(java.io.Console console, int minLength)
           
static java.security.cert.X509Certificate readCertificate(java.io.InputStreamReader isr)
           
static java.security.KeyPair readKeyPair(java.lang.String keyFilename, char[] password)
           
static java.lang.Object readPEM(java.io.InputStreamReader isr)
           
static java.lang.Object readPEM(java.lang.String keyFilename, char[] password, java.lang.String type)
           
static java.security.KeyPair readPrivateKey(java.lang.String keyFilename, char[] keyPassphrase)
           
static java.security.cert.X509Certificate readX509Certificate(java.lang.String keyFilename, char[] password)
           
static void writeCertificate(java.io.OutputStreamWriter osw, java.security.cert.X509Certificate cert)
           
static void writeKey(java.io.OutputStream os, java.security.PrivateKey key)
           
static void writeKey(java.io.OutputStream os, java.security.PrivateKey key, java.lang.String alg, char[] password)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMA

protected static final java.lang.String COMMA
See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

generateKeyPair

public static java.security.KeyPair generateKeyPair(java.lang.String algorithm,
                                                    int keylen)
                                             throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException

getPassphrase

public static char[] getPassphrase(java.io.Console console,
                                   int minLength)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

findSubjectAltName

public static java.lang.String findSubjectAltName(java.util.Collection subjectAltNames,
                                                  int nameType)

readX509Certificate

public static java.security.cert.X509Certificate readX509Certificate(java.lang.String keyFilename,
                                                                     char[] password)
                                                              throws java.io.FileNotFoundException,
                                                                     java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

readKeyPair

public static java.security.KeyPair readKeyPair(java.lang.String keyFilename,
                                                char[] password)
                                         throws java.io.FileNotFoundException,
                                                java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

readPEM

public static java.lang.Object readPEM(java.lang.String keyFilename,
                                       char[] password,
                                       java.lang.String type)
                                throws java.io.FileNotFoundException,
                                       java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

readCertificate

public static java.security.cert.X509Certificate readCertificate(java.io.InputStreamReader isr)
                                                          throws java.io.IOException
Throws:
java.io.IOException

readPEM

public static java.lang.Object readPEM(java.io.InputStreamReader isr)
                                throws java.io.IOException
Throws:
java.io.IOException

writeKey

public static void writeKey(java.io.OutputStream os,
                            java.security.PrivateKey key,
                            java.lang.String alg,
                            char[] password)

writeKey

public static void writeKey(java.io.OutputStream os,
                            java.security.PrivateKey key)

writeCertificate

public static void writeCertificate(java.io.OutputStreamWriter osw,
                                    java.security.cert.X509Certificate cert)
                             throws java.io.IOException
Throws:
java.io.IOException

readPrivateKey

public static java.security.KeyPair readPrivateKey(java.lang.String keyFilename,
                                                   char[] keyPassphrase)
                                            throws java.io.FileNotFoundException,
                                                   java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException