IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo
Class DemoUtil

java.lang.Object
  extended by demo.DemoUtil
Direct Known Subclasses:
DemoSMimeUtil

public class DemoUtil
extends java.lang.Object

Some basic utility methods used by the demos.


Field Summary
static boolean CREATE_DEMO_KEYSTORE_AUTOMATICAllY
          Whether to create a new demo keystore automatically if it is not present or to explicitly ask if to create it.
static boolean DEMO_DEBUG
          Debug flag for all demos
static iaik.asn1.ObjectID IAIK_JAVA_SECURITY_DEMO_CMS_OID
          Base OID for IAIK-CMS demos.
 
Method Summary
static void addIaikProvider()
          Adds the IAIK JCE as a first security provider.
static void addProvider(java.lang.String name)
          Adds the cryptography provider with the given name.
static iaik.asn1.structures.AlgorithmID createPssAlgorithmID(iaik.asn1.structures.AlgorithmID hashID, iaik.asn1.structures.AlgorithmID mgfID, int saltLength)
          Creates a RSA-PSS AlgorithmID with the supplied parameters (hash algorithm id, mask generation function, salt length).
static double getIaikProviderVersion()
          Gets the version number of the IAIK-JCE provider used for this demos.
static void initDemos()
          Perform a some initial setup to allow the demos to work
static void initDemos(boolean quickStart)
          Perform a some initial setup to allow the demos to work
static void initRandom()
          Setup the random number generator for a quick start.
static void initRandom(boolean quick)
          Setup the random number generator for a quick start.
static void waitKey()
          Wait for the user to press the return key on System.in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEMO_DEBUG

public static final boolean DEMO_DEBUG
Debug flag for all demos

See Also:
Constant Field Values

IAIK_JAVA_SECURITY_DEMO_CMS_OID

public static final iaik.asn1.ObjectID IAIK_JAVA_SECURITY_DEMO_CMS_OID
Base OID for IAIK-CMS demos.


CREATE_DEMO_KEYSTORE_AUTOMATICAllY

public static boolean CREATE_DEMO_KEYSTORE_AUTOMATICAllY
Whether to create a new demo keystore automatically if it is not present or to explicitly ask if to create it.

Method Detail

initDemos

public static void initDemos()
Perform a some initial setup to allow the demos to work


initDemos

public static void initDemos(boolean quickStart)
Perform a some initial setup to allow the demos to work

Parameters:
quickStart - whether to init the random generator with a (not strong) seed for quick start (ONLY FOR DEMO PURPOSES; NOT FOR PRODUCTION ENVIRONMENT!)

addIaikProvider

public static void addIaikProvider()
Adds the IAIK JCE as a first security provider.


getIaikProviderVersion

public static double getIaikProviderVersion()
Gets the version number of the IAIK-JCE provider used for this demos.

Returns:
the version number of the IAIK JCA/JCE provider

addProvider

public static void addProvider(java.lang.String name)
Adds the cryptography provider with the given name. Note that it may not be enough to just add it as a provider; see the SecurityProvider class for more information.

Parameters:
name - the name of the provider to be added

initRandom

public static void initRandom()
Setup the random number generator for a quick start. THIS IS NOT SECURE AND SHOULD BE USED FOR DEMO PURPOSES ONLY. ANY CRYPTOGRAPHIC KEY DERIVED IN THIS WAY IS WEAK AND NO STRONGER THAN 20 BIT!!!


initRandom

public static void initRandom(boolean quick)
Setup the random number generator for a quick start. THIS IS NOT SECURE AND SHOULD BE USED FOR DEMO PURPOSES ONLY. ANY CRYPTOGRAPHIC KEY DERIVED IN THIS WAY IS WEAK AND NO STRONGER THAN 20 BIT!!!

Parameters:
quick - whether to init the random generator with a (not strong) seed for quick start (only for demonstration purposes)

createPssAlgorithmID

public static iaik.asn1.structures.AlgorithmID createPssAlgorithmID(iaik.asn1.structures.AlgorithmID hashID,
                                                                    iaik.asn1.structures.AlgorithmID mgfID,
                                                                    int saltLength)
                                                             throws java.security.InvalidAlgorithmParameterException,
                                                                    java.security.NoSuchAlgorithmException
Creates a RSA-PSS AlgorithmID with the supplied parameters (hash algorithm id, mask generation function, salt length).

Parameters:
hashID - the hash algorithm to be used
mgfID - the mask generation function to be used
saltLength - the salt length to be used
Returns:
the RSA-PSS algorithm id with the given parameters
Throws:
java.security.InvalidAlgorithmParameterException - if the parameters cannot be created/set
java.security.NoSuchAlgorithmException - if there is no AlgorithmParameters implementation for RSA-PSS

waitKey

public static void waitKey()
Wait for the user to press the return key on System.in.


IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC