final byte signBA[]; { Signature signature = Signature.getInstance(sigAlgName, providerName); signature.initSign( keyPair.getPrivate() ); signature.update( signInput ); signBA = signature.sign(); } { Signature signature = Signature.getInstance(sigAlgName); signature.initVerify(keyPair.getPublic()); signature.update(signInput); boolean result = signature.verify(signBA); System.out.println("Signature test of key "+alias+ ": signature length " + signBA.length + "; test nr " + i + "; first byte " + Integer.toHexString(0xff&signBA[0]) + "; verifying " + result); }
final byte signBA[]; { Signature signature = Signature.getInstance(sigAlgName, providerName); signature.initSign( keyPair.getPrivate() ); signature.update( signInput ); signBA = signature.sign(); } { Signature signature = Signature.getInstance(sigAlgName); signature.initVerify(keyPair.getPublic()); signature.update(signInput); boolean result = signature.verify(signBA); System.out.println("Signature test of key "+alias+ ": signature length " + signBA.length + "; test nr " + i + "; first byte " + Integer.toHexString(0xff&signBA[0]) + "; verifying " + result); } System.gc(); System.runFinalization();
    public void doIt(int i) throws Exception {            final byte signBA[]; {                Signature signature = Signature.getInstance(sigAlgName, providerName);                signature.initSign( keyPair.getPrivate() );                signature.update( signInput );                signBA = signature.sign();            }            {                Signature signature = Signature.getInstance(sigAlgName);                signature.initVerify(keyPair.getPublic());                signature.update(signInput);                boolean result = signature.verify(signBA);                System.out.println("Signature test of key "+alias+                                   ": signature length " + signBA.length +                                   "; test nr " + i +                                   "; first byte " + Integer.toHexString(0xff&signBA[0]) +                                   "; verifying " + result);            }    }