inescID.crypto
Class KeyStoreTool

java.lang.Object
  extended byinescID.crypto.KeyStoreTool

public class KeyStoreTool
extends java.lang.Object

Title: revs

Description: Auxiliar na interaccao com um KeyStore

Copyright: Copyright (c) 2002

Company Inesc-ID


Field Summary
static int DEFAULT_KEY_SIZE
           
(package private)  java.security.KeyStore ks
           
static java.lang.String RSA_ALGORITHM
           
(package private)  java.security.KeyFactory RSAKeyFactory
           
(package private)  java.security.KeyPairGenerator RSAKeyPairGenerator
           
 
Constructor Summary
KeyStoreTool()
           
KeyStoreTool(java.lang.String keyStorePath, char[] passwd)
           
 
Method Summary
 java.security.KeyPair genRSAKeyPair()
           
 java.security.KeyPair genRSAKeyPair(int size)
           
 java.security.PrivateKey getPrivateKey(java.lang.String alias, char[] passwd)
           
 java.security.PublicKey getPublicKey(java.lang.String alias)
           
 java.security.PublicKey getPublicKeyFromCertFile(java.lang.String file)
           
 java.security.interfaces.RSAPrivateKey getRSAPrivateKey(byte[] chave)
           
 java.security.interfaces.RSAPublicKey getRSAPublicKey(byte[] chave)
           
protected  void init()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_KEY_SIZE

public static final int DEFAULT_KEY_SIZE
See Also:
Constant Field Values

RSA_ALGORITHM

public static final java.lang.String RSA_ALGORITHM
See Also:
Constant Field Values

ks

java.security.KeyStore ks

RSAKeyPairGenerator

java.security.KeyPairGenerator RSAKeyPairGenerator

RSAKeyFactory

java.security.KeyFactory RSAKeyFactory
Constructor Detail

KeyStoreTool

public KeyStoreTool()
             throws java.security.NoSuchAlgorithmException

KeyStoreTool

public KeyStoreTool(java.lang.String keyStorePath,
                    char[] passwd)
             throws java.io.FileNotFoundException,
                    java.security.KeyStoreException,
                    java.security.cert.CertificateException,
                    java.security.NoSuchAlgorithmException,
                    java.io.IOException
Method Detail

init

protected void init()
             throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException

genRSAKeyPair

public java.security.KeyPair genRSAKeyPair()

genRSAKeyPair

public java.security.KeyPair genRSAKeyPair(int size)

getPublicKey

public java.security.PublicKey getPublicKey(java.lang.String alias)
                                     throws java.security.UnrecoverableKeyException,
                                            java.security.NoSuchAlgorithmException,
                                            java.security.KeyStoreException
Throws:
java.security.UnrecoverableKeyException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException

getPrivateKey

public java.security.PrivateKey getPrivateKey(java.lang.String alias,
                                              char[] passwd)
                                       throws java.security.UnrecoverableKeyException,
                                              java.security.NoSuchAlgorithmException,
                                              java.security.KeyStoreException
Throws:
java.security.UnrecoverableKeyException
java.security.NoSuchAlgorithmException
java.security.KeyStoreException

getRSAPrivateKey

public java.security.interfaces.RSAPrivateKey getRSAPrivateKey(byte[] chave)
                                                        throws java.security.spec.InvalidKeySpecException
Throws:
java.security.spec.InvalidKeySpecException

getRSAPublicKey

public java.security.interfaces.RSAPublicKey getRSAPublicKey(byte[] chave)
                                                      throws java.security.spec.InvalidKeySpecException
Throws:
java.security.spec.InvalidKeySpecException

getPublicKeyFromCertFile

public java.security.PublicKey getPublicKeyFromCertFile(java.lang.String file)