package eu.osci;

import java.util.Hashtable;

import javax.xml.namespace.QName;


/**
 * The class for constants in the OSCI 2 context.<br>
 * Copyright © 2010 Freie Hansestadt Bremen. <br>
 * Created by bremen online services Entwicklungs- und Betriebsgesellschaft mbH & Co. KG. <br>
 * This library (Starter Kit) can be used by anybody according to the Bremer Lizenz für freie
 * Softwarebibliotheken. The license terms can be viewed at www.osci.de or can be ordered at the
 * OSCI-Leitstelle (Die Senatorin für Finanzen, Freie Hansestadt Bremen, Postfach 10 15 40, 28015 Bremen).
 * 
 * @author R. Lindemann
 */
public class OSCIConstants
{

  /**
   * Hashtable with the required JCA/JCE identifiers.
   */
  public final static Hashtable<String, String> JCA_JCE_MAP = new Hashtable<String, String>();

  /**
   * Character encoding UTF-8.
   */
  public final static String CHAR_ENCODING = "UTF-8";

  /**
   * Addressing value for anonymous endpoints (replyTo).
   */
  public static final String ANONYMOUS_ADDRESS = "http://www.w3c.org/ws/2005/05/08/addressing/anonymous";

  /**
   * This is the one possible value for the attribute ReceiptIssuerRole from the element RecipientInfo.
   */
  public static final String RECIPIENT_ISSUER_ROLE_MSGBOX = "http://www.osci.eu/ws/2008/05/transport/role/MsgBox";

  /**
   * This is the one possible value for the attribute ReceiptIssuerRole from the element RecipientInfo.
   */
  public static final String RECIPIENT_ISSUER_ROLE_RECIPIENT = "http://www.osci.eu/ws/2008/05/transport/role/Recipient";


  // ############################ Addressing ######################################
  // ############################ Addressing ######################################
  // ############################ Addressing ######################################

  /**
   * The namespace for the addressing elements.
   */
  public static final String NAMESPACE_ADDRESSING = "http://www.w3.org/2005/08/addressing";

  // ######################################### OSCI Namespace QNames ##########################
  // ######################################### OSCI Namespace QNames ##########################
  // ######################################### OSCI Namespace QNames ##########################

  /**
   * The namespace of OSCI 2.
   */
  public static final String NAMESPACE_OSCI20 = "http://www.osci.eu/ws/2008/05/transport";

  // ####################### others #################################
  // ####################### others #################################
  // ####################### others #################################
  /**
   * The namespace for XKMS.
   */
  public static final String NAMESPACE_XKMS = "http://www.w3.org/2002/03/xkms#";

  /**
   * The QName for the XKMS 'CompoundResult' element.
   */
  public static final QName QNAME_COMPOUND_RESULT = new QName(NAMESPACE_XKMS, "CompoundResult");

  /**
   * The QName for WS-Trust 'RequestSecurityTokenResponseCollection' element.
   */
  public static final QName QNAME_RSTR_COLLECTION = new QName(
                                                              "http://docs.oasis-open.org/ws-sx/ws-trust/200512",
                                                              "RequestSecurityTokenResponseCollection");

  // ######################################################################################
  // ############################ JCA JCE Properties ######################################
  // ######################################################################################
  /**
   * Algorithm for signature creation, constant for SHA1withRSA.
   */
  public final static String SIGNATURE_ALGORITHM_RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";

  /**
   * Algorithm for signature creation, constant for SHA1withRSA, JCA/JCE identifier.
   */
  private final static String SIGNATURE_ALGORITHM_RSA_SHA1_JCA_JCE = "SHA1withRSA";

  /**
   * Algorithm for signature creation, constant for SHA256withRSA.
   */
  public final static String SIGNATURE_ALGORITHM_RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";

  /**
   * Algorithm for signature creation, constant for SHA256withRSA, JCA/JCE identifier.
   */
  private final static String SIGNATURE_ALGORITHM_RSA_SHA256_JCA_JCE = "SHA256withRSA";

  /**
   * Algorithm for signature creation, constant for SHA512withRSA.
   */
  public final static String SIGNATURE_ALGORITHM_RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";

  /**
   * Algorithm for signature creation, constant for SHA512withRSA, JCA/JCE identifier.
   */
  private final static String SIGNATURE_ALGORITHM_RSA_SHA512_JCA_JCE = "SHA512withRSA";

  /**
   * Algorithm for signature creation, constant for RIPEMD160withRSA.
   */
  public final static String SIGNATURE_ALGORITHM_RSA_RIPEMD160 = "http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160";

  /**
   * Algorithm for signature creation, constant for RIPEMD160withRSA, JCA/JCE identifier.
   */
  private final static String SIGNATURE_ALGORITHM_RSA_RIPEMD160_JCA_JCE = "RIPEMD160withRSA";

  /**
   * Algorithm for hash value creation, constant for SHA1.
   */
  public final static String DIGEST_ALGORITHM_SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";

  /**
   * Algorithm for hash value creation, constant for SHA1, JCA/JCE-Identifier.
   */
  private final static String DIGEST_ALGORITHM_SHA1_JCA_JCE = "SHA-1";

  /**
   * Algorithm for hash value creation, constant for SHA256.
   */
  public final static String DIGEST_ALGORITHM_SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";

  /**
   * Algorithm for hash value creation, constant for SHA256, JCA/JCE identifier.
   */
  private final static String DIGEST_ALGORITHM_SHA256_JCA_JCE = "SHA-256";

  /**
   * Algorithm for hash value creation, constant for SHA512.
   */
  public final static String DIGEST_ALGORITHM_SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";

  /**
   * Algorithm for hash value creation, constant for SHA512, JCA/JCE identifier.
   */
  private final static String DIGEST_ALGORITHM_SHA512_JCA_JCE = "SHA-512";

  /**
   * Algorithm for hash value creation, constant for RIPEMD160.
   */
  public final static String DIGEST_ALGORITHM_RIPEMD160 = "http://www.w3.org/2001/04/xmlenc#ripemd160";

  /**
   * Algorithm for hash value creation, constant for RIPEMD160, JCA/JCE identifier.
   */
  private final static String DIGEST_ALGORITHM_RIPEMD160_JCA_JCE = "RIPEMD160";

  /**
   * Algorithm for symmetric encryption Two-Key-Triple-DES (CBC-Mode).
   */
  public final static String SYMMETRIC_CIPHER_ALGORITHM_TDES_CBC = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";

  /**
   * Algorithm for symmetric encryption Two-Key-Triple-DES (CBC-Mode), JCA/JCE identifier.
   */
  private final static String SYMMETRIC_CIPHER_ALGORITHM_TDES_CBC_JCA_JCE = "DESede/CBC/PKCS5Padding";

  /**
   * Algorithm for symmetric encryption AES-128.
   */
  public final static String SYMMETRIC_CIPHER_ALGORITHM_AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";

  /**
   * Algorithm for symmetric encryption AES (CBC-Mode), JCA/JCE identifier.
   */
  private final static String SYMMETRIC_CIPHER_ALGORITHM_AES_CBC_JCA_JCE = "AES/CBC/PKCS5Padding";

  /**
   * Algorithm for symmetric encryption AES-192.
   */
  public final static String SYMMETRIC_CIPHER_ALGORITHM_AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";

  /**
   * Algorithm for symmetric encryption AES-256.
   */
  public final static String SYMMETRIC_CIPHER_ALGORITHM_AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";

  /**
   * Algorithm for asymmetric encryption RSAES-PKCS1-v1_5.
   */
  public final static String ASYMMETRIC_CIPHER_ALGORITHM_RSA_1_5 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";

  public final static String TYPE_OF_BUS_CON_NOTIFICATION = "http://www.osci.eu/2008/common/urn/messageTypes/Notification";

  /**
   * Algorithm for asymmetric encryption RSAES-PKCS1-v1_5, JCA/JCE identifier.
   */
  private final static String ASYMMETRIC_CIPHER_ALGORITHM_RSA_1_5_JCA_JCE = "RSA/ECB/PKCS1Padding";


  /**
   * Canonicalisation
   */
  public final static String TRANSFORM_CANONICALIZATION = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
  static
  {
    JCA_JCE_MAP.put(ASYMMETRIC_CIPHER_ALGORITHM_RSA_1_5, ASYMMETRIC_CIPHER_ALGORITHM_RSA_1_5_JCA_JCE);
    JCA_JCE_MAP.put(DIGEST_ALGORITHM_SHA1, DIGEST_ALGORITHM_SHA1_JCA_JCE);
    JCA_JCE_MAP.put(DIGEST_ALGORITHM_SHA256, DIGEST_ALGORITHM_SHA256_JCA_JCE);
    JCA_JCE_MAP.put(DIGEST_ALGORITHM_SHA512, DIGEST_ALGORITHM_SHA512_JCA_JCE);
    JCA_JCE_MAP.put(DIGEST_ALGORITHM_RIPEMD160, DIGEST_ALGORITHM_RIPEMD160_JCA_JCE);
    JCA_JCE_MAP.put(SIGNATURE_ALGORITHM_RSA_SHA1, SIGNATURE_ALGORITHM_RSA_SHA1_JCA_JCE);
    JCA_JCE_MAP.put(SIGNATURE_ALGORITHM_RSA_SHA256, SIGNATURE_ALGORITHM_RSA_SHA256_JCA_JCE);
    JCA_JCE_MAP.put(SIGNATURE_ALGORITHM_RSA_SHA512, SIGNATURE_ALGORITHM_RSA_SHA512_JCA_JCE);
    JCA_JCE_MAP.put(SIGNATURE_ALGORITHM_RSA_RIPEMD160, SIGNATURE_ALGORITHM_RSA_RIPEMD160_JCA_JCE);
    JCA_JCE_MAP.put(SYMMETRIC_CIPHER_ALGORITHM_TDES_CBC, SYMMETRIC_CIPHER_ALGORITHM_TDES_CBC_JCA_JCE);
    JCA_JCE_MAP.put(SYMMETRIC_CIPHER_ALGORITHM_AES128, SYMMETRIC_CIPHER_ALGORITHM_AES_CBC_JCA_JCE);
    JCA_JCE_MAP.put(SYMMETRIC_CIPHER_ALGORITHM_AES192, SYMMETRIC_CIPHER_ALGORITHM_AES_CBC_JCA_JCE);
    JCA_JCE_MAP.put(SYMMETRIC_CIPHER_ALGORITHM_AES256, SYMMETRIC_CIPHER_ALGORITHM_AES_CBC_JCA_JCE);
  }
}
