FileDocCategorySizeDatePackage
PrintKey.javaAPI DocExample878Sat Jan 13 13:26:30 GMT 2001javasec.samples.ch09

PrintKey

public class PrintKey extends Object

Fields Summary
Constructors Summary
Methods Summary
public voidprintKey(java.security.Key k)

        if (k instanceof DSAKey) {
            System.out.println("key is DSA");
            System.out.println("P value is " +
                            ((DSAKey) k).getParams().getP());
        }
        else System.out.println("key is not DSA");
    
public voidprintKey(java.security.interfaces.DSAKey k)

        if (k instanceof DSAPublicKey)
            System.out.println("Public key value is " +
                                            ((DSAPublicKey) k).getY());
        else if (k instanceof DSAPrivateKey)
            System.out.println("Private key value is " +
                                            ((DSAPrivateKey) k).getX());
        else System.out.println("Bad key implementation");