IAIK PKCS#11 Provider API Documentation
version 1.6

iaik.pkcs.pkcs11.provider.ciphers
Class PKCS11OAEPParameterSpec

java.lang.Object
  extended by iaik.pkcs.pkcs11.provider.spec.PKCS11Spec
      extended by iaik.pkcs.pkcs11.provider.ciphers.PKCS11OAEPParameterSpec
All Implemented Interfaces:
java.security.spec.AlgorithmParameterSpec, java.security.spec.KeySpec

public class PKCS11OAEPParameterSpec
extends PKCS11Spec
implements java.security.spec.AlgorithmParameterSpec

This class has to be used with the RSA-OAEP cipher engine, when a different hash algorithm shall be used by the mask generation function than used to hash the data. By default, this provider's RSA OAEP engine uses the same mgf1 hash algorithm as specified for the cipher. E.g. when using OAEPwithSHA512andMGF1Padding, for hashing the data as well as for the mask generation function SHA512 will be used by default. As mgf1 hash algorithm only SHA1, SHA256, SHA384 and SHA512 can be used.


Field Summary
 
Fields inherited from class iaik.pkcs.pkcs11.provider.spec.PKCS11Spec
USE_PUBLIC_SESSION, USE_READ_ONLY_SESSION, USE_READ_WRITE_SESSION, USE_USER_SESSION
 
Constructor Summary
PKCS11OAEPParameterSpec()
          default constructor using SHA1 for the mgf1 function and to hash the data.
PKCS11OAEPParameterSpec(iaik.pkcs.pkcs11.Mechanism hashAlgorithm, long mgfHashAlgorithm, long oaepSourceType, byte[] oaepSourceData)
          Constructor to set the given hash algorithms and source type.
 
Method Summary
 iaik.pkcs.pkcs11.Mechanism getHashAlgorithm()
          the mechanism for the hash algorithm used for data hashing
 long getMgfHashAlgorithm()
          the hash algorithm used by the mask generation function
 byte[] getOaepSourceData()
          Returns the OAEP source data
 long getOaepSourceType()
          Returns the OAEP source type.
 void setHashAlgorithm(iaik.pkcs.pkcs11.Mechanism hashAlgorithm)
          set the mechanism for the hash algorithm used for data hashing, e.g.
 void setMgfHashAlgorithm(long mgfHashAlgorithm)
          set the hash algorithm to be used by the mask generation function, e.g.
 void setOaepSourceData(byte[] oaepSourceData)
          Set the OAEP source data
 void setOaepSourceType(long oaepSourceType)
          Sets the OAEP source type, typically RSAPkcsOaepParameters.SourceType.DATA_SPECIFIED.
 
Methods inherited from class iaik.pkcs.pkcs11.provider.spec.PKCS11Spec
getPin, getTokenManager, isUseAnonymousRole, isUseROSession, isUseRwSession, isUseSORole, isUseUserRole, isUseUserSession, setPin, setTokenManager, setUseAnonymousRole, setUseSORole, setUseUserRole
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS11OAEPParameterSpec

public PKCS11OAEPParameterSpec()
default constructor using SHA1 for the mgf1 function and to hash the data. As source null data are specified.


PKCS11OAEPParameterSpec

public PKCS11OAEPParameterSpec(iaik.pkcs.pkcs11.Mechanism hashAlgorithm,
                               long mgfHashAlgorithm,
                               long oaepSourceType,
                               byte[] oaepSourceData)
                        throws java.lang.IllegalArgumentException
Constructor to set the given hash algorithms and source type. Using default for null parameters.

Parameters:
hashAlgorithm - hash algorithm for data hashing, e.g. PKCS11Constants.CKM_SHA_1
mgfHashAlgorithm - hash algorithm used by the mask generation function mgf1, e.g. MessageGenerationFunctionType.SHA1
oaepSourceType - OAEP source type, typically RSAPkcsOaepParameters.SourceType.DATA_SPECIFIED
oaepSourceData - OAEP source data, typically null
Throws:
java.lang.IllegalArgumentException
Method Detail

getHashAlgorithm

public iaik.pkcs.pkcs11.Mechanism getHashAlgorithm()
the mechanism for the hash algorithm used for data hashing

Returns:
hash mechanism

setHashAlgorithm

public void setHashAlgorithm(iaik.pkcs.pkcs11.Mechanism hashAlgorithm)
set the mechanism for the hash algorithm used for data hashing, e.g. PKCS11Constants.CKM_SHA_1

Parameters:
hashAlgorithm - the hash algorithm that shall be used for data hashing

getMgfHashAlgorithm

public long getMgfHashAlgorithm()
the hash algorithm used by the mask generation function

Returns:
the mgf1 hash algorithm

setMgfHashAlgorithm

public void setMgfHashAlgorithm(long mgfHashAlgorithm)
set the hash algorithm to be used by the mask generation function, e.g. MessageGenerationFunctionType.SHA1

Parameters:
mgfHashAlgorithm - the mgf1 hash algorithm

getOaepSourceType

public long getOaepSourceType()
Returns the OAEP source type.

Returns:
the OAEP source type

setOaepSourceType

public void setOaepSourceType(long oaepSourceType)
Sets the OAEP source type, typically RSAPkcsOaepParameters.SourceType.DATA_SPECIFIED.

Parameters:
oaepSourceType - the OAEP source type

getOaepSourceData

public byte[] getOaepSourceData()
Returns the OAEP source data

Returns:
the OAEP source data

setOaepSourceData

public void setOaepSourceData(byte[] oaepSourceData)
Set the OAEP source data

Parameters:
oaepSourceData - the source data

IAIK PKCS#11 Provider API Documentation
version 1.6

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/

IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.
version 1.6