1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 2005 The Apache Software Foundation.
   7  *
   8  *  Licensed under the Apache License, Version 2.0 (the "License");
   9  *  you may not use this file except in compliance with the License.
  10  *  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  *  Unless required by applicable law or agreed to in writing, software
  15  *  distributed under the License is distributed on an "AS IS" BASIS,
  16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  *  See the License for the specific language governing permissions and
  18  *  limitations under the License.
  19  *
  20  */
  21 /*
  22  * ===========================================================================
  23  *
  24  * (C) Copyright IBM Corp. 2003 All Rights Reserved.
  25  *
  26  * ===========================================================================
  27  */
  28 /*
  29  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
  30  */
  31 /*
  32  * $Id: XMLDSigRI.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
  33  */
  34 package org.jcp.xml.dsig.internal.dom;
  35 
  36 import java.util.*;
  37 import java.security.*;
  38 
  39 import javax.xml.crypto.dsig.*;
  40 
  41 /**
  42  * The XMLDSig RI Provider.
  43  *
  44  * @author Joyce Leung
  45  */
  46 
  47 /**
  48  * Defines the XMLDSigRI provider.
  49  */
  50 
  51 public final class XMLDSigRI extends Provider {
  52 
  53     static final long serialVersionUID = -5049765099299494554L;
  54 
  55     private static final String INFO = "XMLDSig " +
  56     "(DOM XMLSignatureFactory; DOM KeyInfoFactory)";
  57 
  58     public XMLDSigRI() {
  59         /* We are the XMLDSig provider */
  60         super("XMLDSig", 1.0, INFO);
  61 
  62         final Map map = new HashMap();
  63         map.put("XMLSignatureFactory.DOM",
  64                 "org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory");
  65         map.put("KeyInfoFactory.DOM",
  66                 "org.jcp.xml.dsig.internal.dom.DOMKeyInfoFactory");
  67 
  68 
  69         // Inclusive C14N
  70         map.put((String)"TransformService." + CanonicalizationMethod.INCLUSIVE,
  71                 "org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14NMethod");
  72         map.put("Alg.Alias.TransformService.INCLUSIVE",
  73                 CanonicalizationMethod.INCLUSIVE);
  74         map.put((String)"TransformService." + CanonicalizationMethod.INCLUSIVE +
  75                 " MechanismType", "DOM");
  76 
  77         // InclusiveWithComments C14N
  78         map.put((String) "TransformService." +
  79                 CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS,
  80                 "org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14NMethod");
  81         map.put("Alg.Alias.TransformService.INCLUSIVE_WITH_COMMENTS",
  82                 CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS);
  83         map.put((String) "TransformService." +
  84                 CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS +
  85                 " MechanismType", "DOM");
  86 
  87         // Inclusive C14N 1.1
  88         map.put((String)"TransformService." +
  89                 "http://www.w3.org/2006/12/xml-c14n11",
  90                 "org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14N11Method");
  91         map.put((String)"TransformService." +
  92                 "http://www.w3.org/2006/12/xml-c14n11" +
  93                 " MechanismType", "DOM");
  94 
  95         // InclusiveWithComments C14N 1.1
  96         map.put((String)"TransformService." +
  97                 "http://www.w3.org/2006/12/xml-c14n11#WithComments",
  98                 "org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14N11Method");
  99         map.put((String)"TransformService." +
 100                 "http://www.w3.org/2006/12/xml-c14n11#WithComments" +
 101                 " MechanismType", "DOM");
 102 
 103         // Exclusive C14N
 104         map.put((String) "TransformService." + CanonicalizationMethod.EXCLUSIVE,
 105                 "org.jcp.xml.dsig.internal.dom.DOMExcC14NMethod");
 106         map.put("Alg.Alias.TransformService.EXCLUSIVE",
 107                 CanonicalizationMethod.EXCLUSIVE);
 108         map.put((String)"TransformService." + CanonicalizationMethod.EXCLUSIVE +
 109                 " MechanismType", "DOM");
 110 
 111         // ExclusiveWithComments C14N
 112         map.put((String) "TransformService." +
 113                 CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS,
 114                 "org.jcp.xml.dsig.internal.dom.DOMExcC14NMethod");
 115         map.put("Alg.Alias.TransformService.EXCLUSIVE_WITH_COMMENTS",
 116                 CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS);
 117         map.put((String) "TransformService." +
 118                 CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS +
 119                 " MechanismType", "DOM");
 120 
 121         // Base64 Transform
 122         map.put((String) "TransformService." + Transform.BASE64,
 123                 "org.jcp.xml.dsig.internal.dom.DOMBase64Transform");
 124         map.put("Alg.Alias.TransformService.BASE64", Transform.BASE64);
 125         map.put((String) "TransformService." + Transform.BASE64 +
 126                 " MechanismType", "DOM");
 127 
 128         // Enveloped Transform
 129         map.put((String) "TransformService." + Transform.ENVELOPED,
 130                 "org.jcp.xml.dsig.internal.dom.DOMEnvelopedTransform");
 131         map.put("Alg.Alias.TransformService.ENVELOPED", Transform.ENVELOPED);
 132         map.put((String) "TransformService." + Transform.ENVELOPED +
 133                 " MechanismType", "DOM");
 134 
 135         // XPath2 Transform
 136         map.put((String) "TransformService." + Transform.XPATH2,
 137                 "org.jcp.xml.dsig.internal.dom.DOMXPathFilter2Transform");
 138         map.put("Alg.Alias.TransformService.XPATH2", Transform.XPATH2);
 139         map.put((String) "TransformService." + Transform.XPATH2 +
 140                 " MechanismType", "DOM");
 141 
 142         // XPath Transform
 143         map.put((String) "TransformService." + Transform.XPATH,
 144                 "org.jcp.xml.dsig.internal.dom.DOMXPathTransform");
 145         map.put("Alg.Alias.TransformService.XPATH", Transform.XPATH);
 146         map.put((String) "TransformService." + Transform.XPATH +
 147                 " MechanismType", "DOM");
 148 
 149         // XSLT Transform
 150         map.put((String) "TransformService." + Transform.XSLT,
 151                 "org.jcp.xml.dsig.internal.dom.DOMXSLTTransform");
 152         map.put("Alg.Alias.TransformService.XSLT", Transform.XSLT);
 153         map.put((String) "TransformService." + Transform.XSLT +
 154                 " MechanismType", "DOM");
 155 
 156         AccessController.doPrivileged(new java.security.PrivilegedAction() {
 157             public Object run() {
 158                 putAll(map);
 159                 return null;
 160             }
 161         });
 162     }
 163 }