gov.lanl.KeyTools
Interface KeyAndCertInterface

All Known Implementing Classes:
KeyAndCertByIAIK

public interface KeyAndCertInterface

Defines the facilities needed for keystore operations used by OpenEMed.

 

Method Summary
 java.security.cert.Certificate createCertificate(java.security.Principal subject, java.security.KeyPair sKP, java.security.Principal issuer, java.security.KeyPair iKP)
          Create a certificate for the subject and issued by the issuer.
 java.security.KeyPair createKeypair()
          Generate a new keypair
 java.security.KeyStore createKeystore()
          Create an empty keystore using the provider and type
 java.security.Principal createPrincipal(java.lang.String derString)
          Create a principal/name/distinguished name for the data.
 java.security.Principal createPrincipal(java.lang.String[] ids, java.lang.String[] values)
          Create a principal/name/distinguished name for the data.
 java.lang.String getExpireDate(java.security.cert.Certificate cert)
          Get the expirattion date for the certificate
 java.lang.String getIssuerAlias(java.security.cert.Certificate cert)
          Get the alias for the issuer of the certificate
 java.security.Principal getIssuerPrincipal(java.security.cert.Certificate cert)
          Get the principal of the issuer of the certificate
 java.lang.String getKeyAlgorithm()
          Get the current algorithm for generating key pairs
 java.lang.String getSigningAlgorithm(java.security.cert.Certificate cert)
          Get the current algorithm used for signing this certificate
 java.lang.String getSubjAlias(java.security.cert.Certificate cert)
          Get the alias for the certificate
 java.security.Principal getSubjPrincipal(java.security.cert.Certificate cert)
          Get the principal of the certificate
 boolean isValid(java.security.cert.Certificate cert)
          Test the date or other validity of the certificate
 void setKeyAlgorithm(java.lang.String inKeyAlgoritm)
          Get the current algorithm for generating key pairs
 void setKeystoreProvider(java.lang.String inKeystoreProvider)
          Set the provider for creating keystores
 void setKeystoreType(java.lang.String inKeystoreType)
          Set the keystore type to use when creating keystores
 void setMinimumKeyLength(int keyLength)
          Set the minimum key length which newly created certificates use
 void setMinimumKeyLength(java.lang.String keyLength)
          Set the minimum key length which newly created certificates use
 void setMonthsOfCertificate(int numOfMonths)
          Set the months for which newly created certificates are valid
 void setMonthsOfCertificate(java.lang.String numOfMonths)
          Set the months for which newly created certificates are valid
 void setMsgArea(javax.swing.JTextArea inMsgArea)
          Set the text area for message output
 void setVerbose(boolean verbose)
          Set the verbose flag which controls output to Sysout, default is false.
 void setVerbose(java.lang.String verbose)
          Set the verbose flag which controls output to Sysout, default is false.
 

Method Detail

createKeypair

public java.security.KeyPair createKeypair()
Generate a new keypair

Returns:
a newly created private/public key pair

setMonthsOfCertificate

public void setMonthsOfCertificate(int numOfMonths)
Set the months for which newly created certificates are valid

Parameters:
numOfMonths - is the number of months to be valid

setMonthsOfCertificate

public void setMonthsOfCertificate(java.lang.String numOfMonths)
Set the months for which newly created certificates are valid

Parameters:
numOfMonths - is the number of months to be valid

setMinimumKeyLength

public void setMinimumKeyLength(int keyLength)
Set the minimum key length which newly created certificates use

Parameters:
keyLength - is the key length, usually in bits

setMinimumKeyLength

public void setMinimumKeyLength(java.lang.String keyLength)
Set the minimum key length which newly created certificates use

Parameters:
keyLength - is the key length, usually in bits

setVerbose

public void setVerbose(boolean verbose)
Set the verbose flag which controls output to Sysout, default is false.


setVerbose

public void setVerbose(java.lang.String verbose)
Set the verbose flag which controls output to Sysout, default is false.

Parameters:
verbose - is string representation for true...

setMsgArea

public void setMsgArea(javax.swing.JTextArea inMsgArea)
Set the text area for message output


createPrincipal

public java.security.Principal createPrincipal(java.lang.String[] ids,
                                               java.lang.String[] values)
Create a principal/name/distinguished name for the data.

Parameters:
ids - is an array of known names; fullname_state
values - are the corresponding values for the ids
Returns:
a Principal containing selected data

createPrincipal

public java.security.Principal createPrincipal(java.lang.String derString)
Create a principal/name/distinguished name for the data.

Parameters:
derString - is a string containing a der encoded distinguised name
Returns:
a Principal containing selected data

createCertificate

public java.security.cert.Certificate createCertificate(java.security.Principal subject,
                                                        java.security.KeyPair sKP,
                                                        java.security.Principal issuer,
                                                        java.security.KeyPair iKP)
Create a certificate for the subject and issued by the issuer.

Parameters:
subject - is the principal data wanting a certificate
issuer - is the principal data for the issuer
iKP - is the keypair of the issuer
Returns:
a newly constructed certificate

getSubjPrincipal

public java.security.Principal getSubjPrincipal(java.security.cert.Certificate cert)
Get the principal of the certificate

Parameters:
cert - is the certificate from which to extract the principal
Returns:
the principal from the certificate

getIssuerPrincipal

public java.security.Principal getIssuerPrincipal(java.security.cert.Certificate cert)
Get the principal of the issuer of the certificate

Parameters:
cert - is the certificate from which to extract the principal
Returns:
the principal from the certificate

getSigningAlgorithm

public java.lang.String getSigningAlgorithm(java.security.cert.Certificate cert)
Get the current algorithm used for signing this certificate

Returns:
a string name of the algorithm

getSubjAlias

public java.lang.String getSubjAlias(java.security.cert.Certificate cert)
Get the alias for the certificate

Parameters:
cert - is the certificate from which to extract the alias
Returns:
a string representing the alias of the certificate

getIssuerAlias

public java.lang.String getIssuerAlias(java.security.cert.Certificate cert)
Get the alias for the issuer of the certificate

Parameters:
cert - is the certificate from which to extract the alias
Returns:
a string representing the alias of the issuer

getExpireDate

public java.lang.String getExpireDate(java.security.cert.Certificate cert)
Get the expirattion date for the certificate

Parameters:
cert - is the certificate whose date is requested
Returns:
a string representation of the expiration data

setKeyAlgorithm

public void setKeyAlgorithm(java.lang.String inKeyAlgoritm)
Get the current algorithm for generating key pairs

Returns:
a string name of the algorithm

getKeyAlgorithm

public java.lang.String getKeyAlgorithm()
Get the current algorithm for generating key pairs

Returns:
a string name of the algorithm

setKeystoreType

public void setKeystoreType(java.lang.String inKeystoreType)
Set the keystore type to use when creating keystores

Parameters:
inKeystoreType - is the keystore type

setKeystoreProvider

public void setKeystoreProvider(java.lang.String inKeystoreProvider)
Set the provider for creating keystores

Parameters:
inKeystoreProvider - is the provider

createKeystore

public java.security.KeyStore createKeystore()
Create an empty keystore using the provider and type


isValid

public boolean isValid(java.security.cert.Certificate cert)
Test the date or other validity of the certificate

Parameters:
cert - is the certificate to test for validity
Returns:
true if the certificate is valid, else false