code: public static void encryptPrivateKeyWithPassword(final PrivateKey privateKey, final File file,
  		final String password) throws NoSuchAlgorithmException, InvalidKeySpecException,
  		NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException,
  		IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException
  	{
  		encryptPrivateKeyWithPassword(privateKey, new FileOutputStream(file), password);
  	}
docs: Encrypt the given {@link PrivateKey} with the given password and write the result to the
  given {@link File}.
  
  @param privateKey
  the private key to encrypt
  @param file
  the file
  @param password
  the password
  @throws NoSuchAlgorithmException
  is thrown if instantiation of the SecretKeyFactory object fails.
  @throws InvalidKeySpecException
  is thrown if generation of the SecretKey object fails.
  @throws NoSuchPaddingException
  the no such padding exception
  @throws InvalidKeyException
  is thrown if initialization of the cipher object fails
  @throws InvalidAlgorithmParameterException
  is thrown if initialization of the cypher object fails.
  @throws IllegalBlockSizeException
  the illegal block size exception
  @throws BadPaddingException
  the bad padding exception
  @throws InvalidParameterSpecException
  the invalid parameter spec exception
  @throws IOException
  Signals that an I/O exception has occurred