FileDocCategorySizeDatePackage
XYZKeyPairGenerator.javaAPI DocExample982Sat Jan 13 13:05:42 GMT 2001javasec.samples.ch09

XYZKeyPairGenerator

public class XYZKeyPairGenerator extends KeyPairGenerator

Fields Summary
SecureRandom
random
Constructors Summary
public XYZKeyPairGenerator()

        super("XYZ");
    
Methods Summary
public java.security.KeyPairgenerateKeyPair()

        int rotValue = random.nextInt() % 25;
        XYZKey pub = new XYZKey();
        XYZKey priv = new XYZKey();
        pub.rotValue = rotValue;
        priv.rotValue = -rotValue;
        KeyPair kp = new KeyPair(pub, priv);
        return kp;
    
public voidinitialize(int strength, java.security.SecureRandom sr)

        random = sr;
    
public static voidmain(java.lang.String[] args)

        Security.addProvider(new XYZProvider());
        KeyPairGenerator kpg = KeyPairGenerator.getInstance("XYZ");
        kpg.initialize(0, new SecureRandom());
        KeyPair kp = kpg.generateKeyPair();
        System.out.println("Got key pair " + kp);