All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14NMethod Maven / Gradle / Ivy

The newest version!
/*    */ package org.jcp.xml.dsig.internal.dom;
/*    */ 
/*    */ import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer;
/*    */ import com.sun.org.apache.xml.internal.security.c14n.InvalidCanonicalizerException;
/*    */ import java.security.InvalidAlgorithmParameterException;
/*    */ import javax.xml.crypto.Data;
/*    */ import javax.xml.crypto.XMLCryptoContext;
/*    */ import javax.xml.crypto.dsig.TransformException;
/*    */ import javax.xml.crypto.dsig.spec.TransformParameterSpec;
/*    */ 
/*    */ public final class DOMCanonicalXMLC14NMethod extends ApacheCanonicalizer
/*    */ {
/*    */   public void init(TransformParameterSpec params)
/*    */     throws InvalidAlgorithmParameterException
/*    */   {
/* 28 */     if (params != null)
/* 29 */       throw new InvalidAlgorithmParameterException("no parameters should be specified for Canonical XML C14N algorithm");
/*    */   }
/*    */ 
/*    */   public Data transform(Data data, XMLCryptoContext xc)
/*    */     throws TransformException
/*    */   {
/* 40 */     if ((data instanceof DOMSubTreeData)) {
/* 41 */       DOMSubTreeData subTree = (DOMSubTreeData)data;
/* 42 */       if (subTree.excludeComments()) {
/*    */         try {
/* 44 */           this.apacheCanonicalizer = Canonicalizer.getInstance("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
/*    */         }
/*    */         catch (InvalidCanonicalizerException ice) {
/* 47 */           throw new TransformException("Couldn't find Canonicalizer for: http://www.w3.org/TR/2001/REC-xml-c14n-20010315: " + ice.getMessage(), ice);
/*    */         }
/*    */ 
/*    */       }
/*    */ 
/*    */     }
/*    */ 
/* 55 */     return canonicalize(data, xc);
/*    */   }
/*    */ }

/* Location:           E:\HYN\Java\trunk\ref\lib-dep\xmldsig\xmldsig.jar
 * Qualified Name:     org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14NMethod
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy