OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.signature
Class MFCKeyInfo

java.lang.Object
  |
  +--com.ibm.opencard.service.MFCCardObjectInfo
        |
        +--com.ibm.opencard.signature.MFCKeyInfo

public class MFCKeyInfo
extends MFCCardObjectInfo

Information about a smartcard PKA file

Version:
$Id: MFCKeyInfo.java,v 1.1 1999/12/02 16:06:10 damke Exp $

Constructor Summary
MFCKeyInfo()
          constructor
 
Method Summary
protected  void assertIsCertificationKey()
          check if a key can be used for key validation or certification
protected  void assertSignatureLength(int length)
          Check a given signature length is compatible with the key's input length.
 void assertSupportsInputLength(int length)
          Check a given data input length is compatible with the key's input length and padding algorithm
protected  void assertSupportsPadAlgorithm(java.lang.String padAlgorithm)
          Check if the key supports the specified padding algorithm
protected  void assertSupportsSignAlgorithm(java.lang.String signAlgorithm, boolean hashKey)
          Check if the key supports the specified algorithm
 java.lang.String getCryptoAlgorithm()
          * JCA Standard name,for example "RSA"
 int getFileSize()
          file size in bytes
 java.lang.String getHashAlgorithm()
          JCA standard names, for example "SHA-1"
 byte getHashAlgorithmNr()
          MFC specific encoding of hash algorithms
 int getInputBlockLength()
          length of input block
 byte[] getKeyInfo()
          customer provided key info stored in the key file
 int getKeyLength()
          nominal key length in bits
 int getKeyNr()
          Key number of the key.
 int getOutputBlockLength()
          output block length
 java.lang.String getPadAlgorithm()
          padding algorithm name, one of ZEROPADDING PKCS#1 ISO9796
 CardFilePath getPath()
          path to the key file
 boolean isCertificationKey()
           
 boolean isCompleted()
          Is the key usable, or has the import step been interrupted?
 boolean isGenerated()
          was the key generated on card?
 boolean isHashKey()
          is the key a hash key (requires hashing on card)?
 boolean isKeyEncryptionKey()
           
 boolean isPrivate()
          Is the key a private key
 boolean isSignatureKey()
           
 boolean isVerified()
          Has the key been authenticated by a "micro certificate"?
protected  void setCertificationKey(boolean newValue)
          Is the key usable as a certification key
protected  void setCompleted(boolean newValue)
          Is the key usable, or has the import step been interrupted?
protected  void setCryptoAlgorithm(java.lang.String newValue)
          JCA Standard name,for example "RSA"
protected  void setEncryptionKey(boolean newValue)
          Is the key usable as an encryption key
protected  void setFileID(short id)
          set the file ID, ID of EF_PKA is 0xFExx
protected  void setFileSize(int size)
          set the file size in bytes
protected  void setGenerated(boolean newValue)
          was the key generated on card?
protected  void setHashAlgorithm(java.lang.String newValue)
          JCA standard names, for example "SHA-1"
protected  void setHashAlgorithmNr(byte alg)
          is the key a hash key (requires hashing on card)?
protected  void setInputBlockLength(int newValue)
          length of input block
protected  void setKeyInfo(byte[] newValue)
          customer provided key info stored in the key file
protected  void setKeyLength(int newValue)
          nominal key length in bits
protected  void setOutputBlockLength(int newValue)
          output block length
protected  void setPadAlgorithm(java.lang.String newValue)
          padding algorithm name, one of ZEROPADDING PKCS#1 ISO9796
 void setPath(CardFilePath newPath)
          path to the key file
protected  void setSignatureKey(boolean newValue)
          Is the key usable as a signature key
protected  void setVerified(boolean newValue)
          Has the key been authenticated by a "micro certificate"?
protected  void toStringHook(java.lang.StringBuffer sb)
          Add information to the base class toString() method.
 
Methods inherited from class com.ibm.opencard.service.MFCCardObjectInfo
getAccessConditions, getAccessInfo, isContainer, setAccessInfo, setContainer, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MFCKeyInfo

public MFCKeyInfo()
constructor
Method Detail

assertIsCertificationKey

protected void assertIsCertificationKey()
                                 throws CardServiceInvalidParameterException
check if a key can be used for key validation or certification
Throws:
CardServiceInvalidParameterException - the key is not a certification key

assertSignatureLength

protected void assertSignatureLength(int length)
                              throws CardServiceInvalidParameterException
Check a given signature length is compatible with the key's input length. The signature is 'encrypted' with the public key and then compared to the provided hash.
Parameters:
length - data input length
Throws:
CardServiceInvalidParameterException - Padding Algorithm and data length are incompatible

assertSupportsInputLength

public void assertSupportsInputLength(int length)
                               throws CardServiceInvalidParameterException
Check a given data input length is compatible with the key's input length and padding algorithm
Parameters:
length - data input length
Throws:
CardServiceInvalidParameterException - Padding Algorithm and data length are incompatible

assertSupportsPadAlgorithm

protected void assertSupportsPadAlgorithm(java.lang.String padAlgorithm)
                                   throws java.security.InvalidKeyException
Check if the key supports the specified padding algorithm
Parameters:
padAlgorithm - standard name of padding algorithm
Throws:
java.security.InvalidKeyException - Algorithm and key are incompatible.

assertSupportsSignAlgorithm

protected void assertSupportsSignAlgorithm(java.lang.String signAlgorithm,
                                           boolean hashKey)
                                    throws java.security.InvalidKeyException
Check if the key supports the specified algorithm
Parameters:
signAlgorithm - JCA standard algorithm name
Throws:
java.security.InvalidKeyException - Algorithm and key are incompatible.

getCryptoAlgorithm

public java.lang.String getCryptoAlgorithm()
* JCA Standard name,for example "RSA"

getFileSize

public int getFileSize()
file size in bytes

getHashAlgorithm

public java.lang.String getHashAlgorithm()
JCA standard names, for example "SHA-1"

getHashAlgorithmNr

public byte getHashAlgorithmNr()
MFC specific encoding of hash algorithms

getInputBlockLength

public int getInputBlockLength()
length of input block

getKeyInfo

public byte[] getKeyInfo()
customer provided key info stored in the key file

getKeyLength

public int getKeyLength()
nominal key length in bits

getKeyNr

public int getKeyNr()
Key number of the key. The key number is the lower byte of the file id.
Returns:
int

getOutputBlockLength

public int getOutputBlockLength()
output block length

getPadAlgorithm

public java.lang.String getPadAlgorithm()
padding algorithm name, one of
  • ZEROPADDING
  • PKCS#1
  • ISO9796

getPath

public CardFilePath getPath()
path to the key file

isCertificationKey

public boolean isCertificationKey()
Returns:
true if the key usage bit for certification is on

isCompleted

public boolean isCompleted()
Is the key usable, or has the import step been interrupted?
Returns:
boolean

isGenerated

public boolean isGenerated()
was the key generated on card?
Returns:
boolean

isHashKey

public boolean isHashKey()
is the key a hash key (requires hashing on card)?

isKeyEncryptionKey

public boolean isKeyEncryptionKey()
Returns:
true if the key usage bit for key encryption is on

isPrivate

public boolean isPrivate()
Is the key a private key
Returns:
boolean

isSignatureKey

public boolean isSignatureKey()
Returns:
true if the key usage bit for generating signatures is on

isVerified

public boolean isVerified()
Has the key been authenticated by a "micro certificate"?
Returns:
boolean

setCertificationKey

protected void setCertificationKey(boolean newValue)
Is the key usable as a certification key
Parameters:
newValue - boolean

setCompleted

protected void setCompleted(boolean newValue)
Is the key usable, or has the import step been interrupted?
Parameters:
newValue - boolean

setCryptoAlgorithm

protected void setCryptoAlgorithm(java.lang.String newValue)
JCA Standard name,for example "RSA"

setEncryptionKey

protected void setEncryptionKey(boolean newValue)
Is the key usable as an encryption key
Parameters:
newValue - boolean

setFileID

protected void setFileID(short id)
set the file ID, ID of EF_PKA is 0xFExx

setFileSize

protected void setFileSize(int size)
set the file size in bytes

setGenerated

protected void setGenerated(boolean newValue)
was the key generated on card?
Parameters:
newValue - boolean

setHashAlgorithm

protected void setHashAlgorithm(java.lang.String newValue)
JCA standard names, for example "SHA-1"

setHashAlgorithmNr

protected void setHashAlgorithmNr(byte alg)
is the key a hash key (requires hashing on card)?

setInputBlockLength

protected void setInputBlockLength(int newValue)
length of input block

setKeyInfo

protected void setKeyInfo(byte[] newValue)
customer provided key info stored in the key file

setKeyLength

protected void setKeyLength(int newValue)
nominal key length in bits

setOutputBlockLength

protected void setOutputBlockLength(int newValue)
output block length

setPadAlgorithm

protected void setPadAlgorithm(java.lang.String newValue)
padding algorithm name, one of
  • ZEROPADDING
  • PKCS#1
  • ISO9796

setPath

public void setPath(CardFilePath newPath)
path to the key file

setSignatureKey

protected void setSignatureKey(boolean newValue)
Is the key usable as a signature key
Parameters:
newValue - boolean

setVerified

protected void setVerified(boolean newValue)
Has the key been authenticated by a "micro certificate"?
Parameters:
newValue - boolean

toStringHook

protected void toStringHook(java.lang.StringBuffer sb)
Add information to the base class toString() method.
Overrides:
toStringHook in class MFCCardObjectInfo