Code example for KeyPair

Methods: getPrivate

0
 
		KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("EC");
		keyPairGen.initialize(112);
		KeyPair keyPair = keyPairGen.generateKeyPair();
//		PublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); 
		PrivateKey privateKey = keyPair.getPrivate();
		signature = Signature.getInstance("SHA1withECDSA");
 
		signature.initSign(privateKey);
		 
		signature.update(plainBytes);
		signedBytes = signature.sign();
	} 
	//  
 
	public void execute() throws Exception { 
		signature.update(plainBytes);
		signedBytes = signature.sign();
	} 
}