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