source: class CertificateCoderTest {
  
  	private String password;
  	private String alias;
  	private String certificatePath;
  	private String keyStorePath;
  
  	@Test
  	public void testSign() throws Exception {
  
target: 		System.err.println("私钥加密——公钥解密");
  
  		String inputStr = "sign";
  		byte[] data = inputStr.getBytes();
  
  		byte[] encodedData = CertificateCoder.encryptByPrivateKey(data,
  				keyStorePath, alias, password);
  
  		byte[] decodedData = CertificateCoder.decryptByPublicKey(encodedData,
  				certificatePath);
  
  		String outputStr = new String(decodedData);
  		System.err.println("加密前: " + inputStr + "\n\r" + "解密后: " + outputStr);
  		assertEquals(inputStr, outputStr);
  
  		System.err.println("私钥签名——公钥验证签名");
  		// 产生签名
  		String sign = CertificateCoder.sign(encodedData, keyStorePath, alias,
  				password);
  		System.err.println("签名:\r" + sign);
  
  		// 验证签名
  		boolean status = CertificateCoder.verify(encodedData, sign,
  				certificatePath);
  		System.err.println("状态:\r" + status);
  		assertTrue(status);
  
  	}
  
  }