Code example for DSAPrivateKey

Methods: getAlgorithm, getEncoded, getFormat, getParams, getX

0
    } 
 
 
    private void checkPrivateIntegers(DSAPrivateKey pk) {
 
        DSAParams params = pk.getParams();
 
        assertEquals("failure for 'pk.getX().compareTo(privateX)'", 0, pk
                .getX().compareTo(privateX));
 
        assertEquals("failure for 'params.getP().compareTo(privateP)'", 0,
                params.getP().compareTo(privateP));
        assertEquals("failure for 'params.getQ().compareTo(privateQ)'", 0,
                params.getQ().compareTo(privateQ));
        assertEquals("failure for 'params.getG().compareTo(privateG)'", 0,
                params.getG().compareTo(privateG));
    } 
 
 
    private void checkPrivateKeys(DSAPrivateKey pk) {
 
        checkPrivateIntegers(pk);
 
        assertEquals(
                "failure for 'pk.getAlgorithm().compareTo(privateAlgorithm)'", 
                0, pk.getAlgorithm().compareTo(privateAlgorithm));
        assertEquals("failure for 'pk.getFormat().compareTo(privateFormat)", 0,
                pk.getFormat().compareTo(privateFormat));
 
        if ( privateEncoding != null) {
            assertTrue("failure: encodings are not equal",
                       Arrays.equals(pk.getEncoded(), privateEncoding) );
        } 
    } 
 
 
    /**