<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://gvwiki.greenvulcano.com/gvwiki/index.php?action=history&amp;feed=atom&amp;title=CryptoHelper</id>
	<title>CryptoHelper - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://gvwiki.greenvulcano.com/gvwiki/index.php?action=history&amp;feed=atom&amp;title=CryptoHelper"/>
	<link rel="alternate" type="text/html" href="https://gvwiki.greenvulcano.com/gvwiki/index.php?title=CryptoHelper&amp;action=history"/>
	<updated>2026-05-05T07:43:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.7</generator>
	<entry>
		<id>https://gvwiki.greenvulcano.com/gvwiki/index.php?title=CryptoHelper&amp;diff=3384&amp;oldid=prev</id>
		<title>G.dimaio: Created page with &quot;Class FQN: '''it.greenvulcano.util.crypto.CryptoHelper'''  The keystore/key management is handled by GVCryptoHelper configuration section.  ==Following the CryptoHelper publi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://gvwiki.greenvulcano.com/gvwiki/index.php?title=CryptoHelper&amp;diff=3384&amp;oldid=prev"/>
		<updated>2012-07-17T13:09:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Class FQN: &amp;#039;&amp;#039;&amp;#039;it.greenvulcano.util.crypto.CryptoHelper&amp;#039;&amp;#039;&amp;#039;  The keystore/key management is handled by &lt;a href=&quot;/gvwiki/index.php?title=GVCryptoHelper&quot; title=&quot;GVCryptoHelper&quot;&gt;GVCryptoHelper&lt;/a&gt; configuration section.  ==Following the CryptoHelper publi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Class FQN: '''it.greenvulcano.util.crypto.CryptoHelper'''&lt;br /&gt;
&lt;br /&gt;
The keystore/key management is handled by [[GVCryptoHelper]] configuration section.&lt;br /&gt;
&lt;br /&gt;
==Following the CryptoHelper public constants==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java5&amp;quot;&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * default keyId for configuration cypher key&lt;br /&gt;
     */&lt;br /&gt;
    public static final String       DEFAULT_KEY_ID         = &amp;quot;XMLConfig&amp;quot;;&lt;br /&gt;
    /**&lt;br /&gt;
     * default keyStoreId for configuration cypher key&lt;br /&gt;
     */&lt;br /&gt;
    public static final String       DEFAULT_KEYSTORE_ID    = &amp;quot;GVEsb&amp;quot;;&lt;br /&gt;
    /**&lt;br /&gt;
     * default file name for configuration keystore&lt;br /&gt;
     */&lt;br /&gt;
    public static final String       DEFAULT_KEY_STORE_NAME = &amp;quot;GVEsb.jks&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Following the CryptoHelper public static methods==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java5&amp;quot;&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * Check if the given data is already encrypted with the keyID key.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     * @param data&lt;br /&gt;
     * @return&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     */&lt;br /&gt;
    public static boolean isEncrypted(String keyID, String data) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Encrypt the given data with the algorithm of the keyID key. The result is encoded in Base64 and with the type prefix.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     *        the key identification name&lt;br /&gt;
     * @param data&lt;br /&gt;
     *        the data to encrypt, with encoding 'ISO-8859-1'&lt;br /&gt;
     * @param encode&lt;br /&gt;
     *        if true the the output is encoded with the type prefix&lt;br /&gt;
     * &lt;br /&gt;
     * @return the encrypted data&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static String encrypt(String keyID, String data, boolean encode) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Encrypt the given data with the algorithm of the keyID key. The result is encoded in Base64 and with the type prefix.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     *        the key identification name&lt;br /&gt;
     * @param data&lt;br /&gt;
     *        the data to encrypt&lt;br /&gt;
     * @param inputEnc&lt;br /&gt;
     *        the input encoding&lt;br /&gt;
     * @param encode&lt;br /&gt;
     *        if true the the output is encoded with the type prefix&lt;br /&gt;
     * &lt;br /&gt;
     * @return the encrypted data&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static String encrypt(String keyID, String data, String inputEnc, boolean encode) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Decrypt the given data with the algorithm of the keyID key. The input must be encoded in Base64 and with the type prefix.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     *        the key identification name&lt;br /&gt;
     * @param data&lt;br /&gt;
     *        the data to decrypt, with encoding 'ISO-8859-1'&lt;br /&gt;
     * @param canBeClear&lt;br /&gt;
     *        if true the data can be in clear form&lt;br /&gt;
     * @return the decrypted data&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static String decrypt(String keyID, String data, boolean canBeClear) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Decrypt the given data with the algorithm of the keyID key. The input must be encoded in Base64 and with the type prefix.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     *        the key identification name&lt;br /&gt;
     * @param data&lt;br /&gt;
     *        the data to decrypt&lt;br /&gt;
     * @param inputEnc&lt;br /&gt;
     *        the input encoding&lt;br /&gt;
     * @param canBeClear&lt;br /&gt;
     *        if true the data can be in clear form&lt;br /&gt;
     * @return the decrypted data&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static String decrypt(String keyID, String data, String inputEnc, boolean canBeClear) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Encrypt the given data with the algorithm of the keyID key.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     *        the key identification name&lt;br /&gt;
     * @param data&lt;br /&gt;
     *        the data to encrypt&lt;br /&gt;
     * @param encode&lt;br /&gt;
     *        if true the the output is encoded with the type prefix&lt;br /&gt;
     * &lt;br /&gt;
     * @return the encrypted data&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static byte[] encrypt(String keyID, byte[] data, boolean encode) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Decrypt the given data with the algorithm of the keyID key. The input must be encoded in Base64.&lt;br /&gt;
     * &lt;br /&gt;
     * @param keyID&lt;br /&gt;
     *        the key identification name&lt;br /&gt;
     * @param data&lt;br /&gt;
     *        the data to decrypt&lt;br /&gt;
     * @param canBeClear&lt;br /&gt;
     *        if true the data can be in clear form&lt;br /&gt;
     * @return the decrypted data&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     * @throws CryptoUtilsException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static byte[] decrypt(String keyID, byte[] data, boolean canBeClear) throws CryptoHelperException, CryptoUtilsException&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Retrieve the requested KeyStoreID&lt;br /&gt;
     * &lt;br /&gt;
     * @param kStoreID&lt;br /&gt;
     *        the keyStore identification name&lt;br /&gt;
     * @return the requested KeyStore&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static KeyStore getKeyStore(String keyStoreID) throws CryptoHelperException, KeyStoreUtilsException&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * Retrieve the requested KeyStoreID&lt;br /&gt;
     * &lt;br /&gt;
     * @param kStoreID&lt;br /&gt;
     *        the keyStore identification name&lt;br /&gt;
     * @return the requested KeyStoreID&lt;br /&gt;
     * @throws CryptoHelperException&lt;br /&gt;
     *         if error occurs&lt;br /&gt;
     */&lt;br /&gt;
    public static synchronized KeyStoreID getKeyStoreID(String kStoreID) throws CryptoHelperException&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>G.dimaio</name></author>
		
	</entry>
</feed>