1 17 package com.sun.org.apache.xml.internal.security.transforms.implementations; 18 19 20 21 import java.io.OutputStream ; 22 23 import com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException; 24 import com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315WithComments; 25 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; 26 import com.sun.org.apache.xml.internal.security.transforms.TransformSpi; 27 import com.sun.org.apache.xml.internal.security.transforms.Transforms; 28 29 30 36 public class TransformC14NWithComments extends TransformSpi { 37 38 39 public static final String implementedTransformURI = 40 Transforms.TRANSFORM_C14N_WITH_COMMENTS; 41 42 43 44 protected String engineGetURI() { 45 return implementedTransformURI; 46 } 47 48 protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input) 49 throws CanonicalizationException { 50 return enginePerformTransform(input,null); 51 } 52 53 protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input,OutputStream os) 54 throws CanonicalizationException { 55 56 Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments(); 57 if (os!=null) { 58 c14n.setWriter( os); 59 } 60 61 byte[] result = null; 62 input.setNeedsToBeExpanded(true); 63 result=c14n.engineCanonicalize(input); 64 XMLSignatureInput output=new XMLSignatureInput(result); 65 if (os!=null) { 66 output.setOutputStream(os); 67 } 68 return output; 69 } 70 } 71 | Popular Tags |