KeyManager { public SecretKey generateSecretKey( KeyGenerator keyGen ) { try { this.keyGen = keyGen; secretKey = this.keyGen.generateKey(); } catch ( Exception e ) { LOG.error( "Error generating Secret Key", e ); } return secretKey; }  KeyPairGenerator prepareKeyPairGeneration( KeyPairType keyPairType, int keySize ); KeyPair generateKeyPair( KeyPairGenerator keyPairGen ); PrivateKey generatePrivateKeyPair( KeyPair keyPair ); PublicKey generatePublicKeyPair( KeyPair keyPair ); byte[] generatePrivateKeyPairBytes(); byte[] generatePublicKeyPairBytes(); void prepareSecretKeyGeneration( SecretKeyType secretKeyType ); SecretKey generateSecretKey( KeyGenerator keyGen ); KeyPairGenerator getKeyGen(); void setKeyGen( KeyPairGenerator keyPairGen ); PrivateKey getPrivateKey(); void setPrivateKey( PrivateKey privateKey ); PublicKey getPublicKey(); void setPublicKey( PublicKey publicKey ); KeyPairGenerator getKeyPairGen(); void setKeyPairGen( KeyPairGenerator keyPairGen ); KeyPair getKeyPair(); void setKeyPair( KeyPair keyPair ); SecretKey getSecretKey(); void setSecretKey( SecretKey secretKey ); void setKeyGen( KeyGenerator keyGen ); Signature getSignature(); void setSignature( Signature signature );  }
@Test public void testGenerateSecretKey() throws Exception { keyManager.generateSecretKey( keyGenerator ); }