### Question:
CertificateManager { public byte[] sign(Certificate cert, byte[] challenge) throws SignatureImpossibleException { byte[] signedChallenge; try { PrivateKey pk = getPrivateKey(cert); Signature signature = Signature.getInstance("SHA1withRSA"); signature.initSign(pk); signature.update(challenge); signedChallenge = signature.sign(); } catch(Exception e) { throw new SignatureImpossibleException(e.getMessage()); } return signedChallenge; } CertificateManager(KeyStoreLoader loader); void setPasswordRequestListener(KeyStoreEntryPasswordRequestListener passwordRequestListener); void setKeyStoreRequestListener(KeyStoreRequestListener keyStoreRequestListener); Certificate[] getCerts(); boolean hasNoCertificates(); byte[] sign(Certificate cert, byte[] challenge); Signature extractSignature(Certificate cert); boolean verify(Certificate cert, byte[] original, byte[] signed); void load();  }### Answer:
@Test public void testSign() throws Exception { Certificate cert = manager.getCerts()[0]; byte[] challenge = "Sign this!".getBytes(); byte[] signed = manager.sign(cert, challenge); Signature verifier = Signature.getInstance("SHA1withRSA"); verifier.initVerify(cert); verifier.update(challenge); assertTrue(verifier.verify(signed)); }