Java Key Create getKeyExchangeCipher()

Here you can find the source of getKeyExchangeCipher()

Description

Returns the key exchange cipher.

License

Apache License

Declaration

public static Cipher getKeyExchangeCipher() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.crypto.*;

import java.security.NoSuchAlgorithmException;

public class Main {
    /**//from  w w w  .  j  a  v a  2  s. c  o m
     * Defines the algorithm to use for key exchange.
     */
    public static final String ALGORITHM_KEY_EXCHANGE = "RSA";
    /**
     * Defines the key exchange algorithm settings.
     */
    public static final String ALGORITHM_KEY_EXCHANGE_SETTINGS = "";

    /**
     * Returns the key exchange cipher.
     * @return
     */
    public static Cipher getKeyExchangeCipher() {
        try {
            return Cipher.getInstance(getKeyExchangeCiperName());
        } catch (NoSuchAlgorithmException ex) {
            return null;
        } catch (NoSuchPaddingException ex) {
            return null;
        }
    }

    /**
     * Returns the complete cipher name for the key exchange algorithm.
     * @return
     */
    protected static String getKeyExchangeCiperName() {
        return ALGORITHM_KEY_EXCHANGE + ALGORITHM_KEY_EXCHANGE_SETTINGS;
    }
}

Related

  1. getKey(String keyString)
  2. getKey(String keyString)
  3. getKey(String salt, String password)
  4. getKey(String siteSecret)
  5. getKeyedDigest(String strSrc, String key)
  6. getKeyFactory()
  7. getKeyFactory()
  8. getKeyFactory()
  9. getKeyFactory(final String algorithm)