FileDocCategorySizeDatePackage
XORKeyGenerator.javaAPI DocExample955Sun Jan 14 21:55:38 GMT 2001javasec.samples.ch09

XORKeyGenerator

public class XORKeyGenerator extends KeyGeneratorSpi

Fields Summary
SecureRandom
sr
Constructors Summary
public XORKeyGenerator()

        XYZProvider.verifyForJCE();
    
Methods Summary
public javax.crypto.SecretKeyengineGenerateKey()

        if (sr == null)
            sr = new SecureRandom();

        byte b[] = new byte[1];
        sr.nextBytes(b);
        return new XORKey(b[0]);
    
public voidengineInit(java.security.SecureRandom sr)

        this.sr = sr;
    
public voidengineInit(int len, java.security.SecureRandom sr)

        if (len != 32)
            throw new IllegalArgumentException("Only support 32 bit keys");
        this.sr = sr;
    
public voidengineInit(java.security.spec.AlgorithmParameterSpec aps, java.security.SecureRandom sr)

        throw new InvalidAlgorithmParameterException("Not supported");