javax.xml.crypto.dsig.spec.TransformParameterSpec Java Examples

The following examples show how to use javax.xml.crypto.dsig.spec.TransformParameterSpec. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DigitalSignatures.java    From org.hl7.fhir.core with Apache License 2.0 8 votes vote down vote up
public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, KeyException, MarshalException, XMLSignatureException, FHIRException {
  // http://docs.oracle.com/javase/7/docs/technotes/guides/security/xmldsig/XMLDigitalSignature.html
  //
  byte[] inputXml = "<Envelope xmlns=\"urn:envelope\">\r\n</Envelope>\r\n".getBytes();
  // load the document that's going to be signed
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
  dbf.setNamespaceAware(true);
  DocumentBuilder builder = dbf.newDocumentBuilder();  
  Document doc = builder.parse(new ByteArrayInputStream(inputXml)); 
  
  // create a key pair
  KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
  kpg.initialize(512);
  KeyPair kp = kpg.generateKeyPair(); 
  
  // sign the document
  DOMSignContext dsc = new DOMSignContext(kp.getPrivate(), doc.getDocumentElement()); 
  XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); 
 
  Reference ref = fac.newReference("", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)), null, null);
  SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec) null), fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null), Collections.singletonList(ref));
  
  KeyInfoFactory kif = fac.getKeyInfoFactory(); 
  KeyValue kv = kif.newKeyValue(kp.getPublic());
  KeyInfo ki = kif.newKeyInfo(Collections.singletonList(kv));
  XMLSignature signature = fac.newXMLSignature(si, ki); 
  signature.sign(dsc);
  
  OutputStream os = System.out;
  new XmlGenerator().generate(doc.getDocumentElement(), os);
}
 
Example #2
Source File: DigitalSignatures.java    From org.hl7.fhir.core with Apache License 2.0 7 votes vote down vote up
public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, KeyException, MarshalException, XMLSignatureException, FHIRException, org.hl7.fhir.exceptions.FHIRException {
  // http://docs.oracle.com/javase/7/docs/technotes/guides/security/xmldsig/XMLDigitalSignature.html
  //
  byte[] inputXml = "<Envelope xmlns=\"urn:envelope\">\r\n</Envelope>\r\n".getBytes();
  // load the document that's going to be signed
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
  dbf.setNamespaceAware(true);
  DocumentBuilder builder = dbf.newDocumentBuilder();  
  Document doc = builder.parse(new ByteArrayInputStream(inputXml)); 
  
  // create a key pair
  KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
  kpg.initialize(512);
  KeyPair kp = kpg.generateKeyPair(); 
  
  // sign the document
  DOMSignContext dsc = new DOMSignContext(kp.getPrivate(), doc.getDocumentElement()); 
  XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); 
 
  Reference ref = fac.newReference("", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)), null, null);
  SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec) null), fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null), Collections.singletonList(ref));
  
  KeyInfoFactory kif = fac.getKeyInfoFactory(); 
  KeyValue kv = kif.newKeyValue(kp.getPublic());
  KeyInfo ki = kif.newKeyInfo(Collections.singletonList(kv));
  XMLSignature signature = fac.newXMLSignature(si, ki); 
  signature.sign(dsc);
  
  OutputStream os = System.out;
  new XmlGenerator().generate(doc.getDocumentElement(), os);
}
 
Example #3
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #4
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #5
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #6
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #7
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #8
Source File: DOMXSLTTransform.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    }
    if (!(params instanceof XSLTTransformParameterSpec)) {
        throw new InvalidAlgorithmParameterException("unrecognized params");
    }
    this.params = params;
}
 
Example #9
Source File: DOMCanonicalXMLC14NMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML C14N algorithm");
    }
}
 
Example #10
Source File: DOMXPathFilter2Transform.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    } else if (!(params instanceof XPathFilter2ParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type XPathFilter2ParameterSpec");
    }
    this.params = params;
}
 
Example #11
Source File: DOMExcC14NMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof ExcC14NParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type ExcC14NParameterSpec");
        }
        this.params = (C14NMethodParameterSpec)params;
    }
}
 
Example #12
Source File: DOMXPathTransform.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    } else if (!(params instanceof XPathFilterParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type XPathFilterParameterSpec");
    }
    this.params = params;
}
 
Example #13
Source File: DOMCanonicalXMLC14N11Method.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML 1.1 algorithm");
    }
}
 
Example #14
Source File: DOMXSLTTransform.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    }
    if (!(params instanceof XSLTTransformParameterSpec)) {
        throw new InvalidAlgorithmParameterException("unrecognized params");
    }
    this.params = params;
}
 
Example #15
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    } else if (!(params instanceof XPathFilter2ParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type XPathFilter2ParameterSpec");
    }
    this.params = params;
}
 
Example #16
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    } else if (!(params instanceof XPathFilter2ParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type XPathFilter2ParameterSpec");
    }
    this.params = params;
}
 
Example #17
Source File: DOMXSLTTransform.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    }
    if (!(params instanceof XSLTTransformParameterSpec)) {
        throw new InvalidAlgorithmParameterException("unrecognized params");
    }
    this.params = params;
}
 
Example #18
Source File: DOMCanonicalXMLC14NMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML C14N algorithm");
    }
}
 
Example #19
Source File: DOMCanonicalXMLC14N11Method.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML 1.1 algorithm");
    }
}
 
Example #20
Source File: DOMExcC14NMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof ExcC14NParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type ExcC14NParameterSpec");
        }
        this.params = (C14NMethodParameterSpec)params;
    }
}
 
Example #21
Source File: RequestSigner.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public RequestSigner ( final Configuration configuration ) throws Exception
{
    this.fac = XMLSignatureFactory.getInstance ( "DOM" );
    this.md = this.fac.newDigestMethod ( configuration.getDigestMethod (), null );
    this.kif = this.fac.getKeyInfoFactory ();

    this.t = this.fac.newTransform ( Transform.ENVELOPED, (TransformParameterSpec)null );
    this.ref = this.fac.newReference ( "", this.md, Collections.singletonList ( this.t ), null, null );
    this.cm = this.fac.newCanonicalizationMethod ( CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec)null );
}
 
Example #22
Source File: DOMCanonicalXMLC14N11Method.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML 1.1 algorithm");
    }
}
 
Example #23
Source File: DOMExcC14NMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof ExcC14NParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type ExcC14NParameterSpec");
        }
        this.params = (C14NMethodParameterSpec)params;
    }
}
 
Example #24
Source File: DOMXSLTTransform.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    }
    if (!(params instanceof XSLTTransformParameterSpec)) {
        throw new InvalidAlgorithmParameterException("unrecognized params");
    }
    this.params = params;
}
 
Example #25
Source File: DOMXPathFilter2Transform.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    } else if (!(params instanceof XPathFilter2ParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type XPathFilter2ParameterSpec");
    }
    this.params = params;
}
 
Example #26
Source File: DOMExcC14NMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof ExcC14NParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type ExcC14NParameterSpec");
        }
        this.params = (C14NMethodParameterSpec)params;
    }
}
 
Example #27
Source File: DOMXPathTransform.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    } else if (!(params instanceof XPathFilterParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type XPathFilterParameterSpec");
    }
    this.params = params;
}
 
Example #28
Source File: DOMCanonicalXMLC14N11Method.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML 1.1 algorithm");
    }
}
 
Example #29
Source File: DOMCanonicalXMLC14NMethod.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for Canonical XML C14N algorithm");
    }
}
 
Example #30
Source File: DOMXSLTTransform.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void init(TransformParameterSpec params)
    throws InvalidAlgorithmParameterException {
    if (params == null) {
        throw new InvalidAlgorithmParameterException("params are required");
    }
    if (!(params instanceof XSLTTransformParameterSpec)) {
        throw new InvalidAlgorithmParameterException("unrecognized params");
    }
    this.params = params;
}