FileDocCategorySizeDatePackage
DSAKeyPairGeneratorImpl.javaAPI DocAndroid 1.5 API3058Wed May 06 22:41:06 BST 2009org.apache.harmony.security.tests.support.interfaces

DSAKeyPairGeneratorImpl

public class DSAKeyPairGeneratorImpl extends Object implements DSAKeyPairGenerator
Additional class for verification DSAKeyPairGenerator interface

Fields Summary
private KeyPairGenerator
dsaKeyPairGenerator
private SecureRandom
secureRandom
private DSAParams
dsaParams
private int
lengthModulus
Constructors Summary
public DSAKeyPairGeneratorImpl(DSAParams dsap)

    
       
        dsaKeyPairGenerator = null;
        try {
            dsaKeyPairGenerator = KeyPairGenerator.getInstance("DSA");
        } catch (Exception e) {
            dsaKeyPairGenerator = null;
        }
        dsaParams = dsap;
    
Methods Summary
public voidinitialize(java.security.interfaces.DSAParams params, java.security.SecureRandom random)

        if (random == null) {
            throw new InvalidParameterException("Incorrect random");
        }
        if (params == null) {
            throw new InvalidParameterException("Incorrect params");
        }
        secureRandom = random;
        dsaParams = params;
        
    
public voidinitialize(int modlen, boolean genParams, java.security.SecureRandom random)

        int len = 512;
        while (len <= 1024) {
            if (len == modlen) {
                lengthModulus = modlen;
                break;
            } else {
                len = len + 8;
                if (len == 1032) {
                    throw new InvalidParameterException("Incorrect modlen");
                }
            }
        }
        if (modlen < 512 || modlen > 1024) {
            throw new InvalidParameterException("Incorrect modlen");
        }
        if (random == null) {
            throw new InvalidParameterException("Incorrect random");
        }
        if (genParams == false && dsaParams == null) {
            throw new InvalidParameterException("there are not precomputed parameters");
        }
        secureRandom = random;