01: /*
02: * $Id: Canonicalizer.java,v 1.5 2007/01/08 16:06:14 shyam_rao Exp $
03: * $Revision: 1.5 $
04: * $Date: 2007/01/08 16:06:14 $
05: */
06:
07: /*
08: * The contents of this file are subject to the terms
09: * of the Common Development and Distribution License
10: * (the License). You may not use this file except in
11: * compliance with the License.
12: *
13: * You can obtain a copy of the license at
14: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
15: * See the License for the specific language governing
16: * permissions and limitations under the License.
17: *
18: * When distributing Covered Code, include this CDDL
19: * Header Notice in each file and include the License file
20: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
21: * If applicable, add the following below the CDDL Header,
22: * with the fields enclosed by brackets [] replaced by
23: * you own identifying information:
24: * "Portions Copyrighted [year] [name of copyright owner]"
25: *
26: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
27: */
28:
29: package com.sun.xml.wss.impl.c14n;
30:
31: import com.sun.xml.wss.swa.MimeConstants;
32:
33: import com.sun.xml.wss.XWSSecurityException;
34: import java.io.InputStream;
35: import java.io.OutputStream;
36:
37: import java.util.logging.Logger;
38:
39: import com.sun.xml.wss.logging.LogDomainConstants;
40:
41: /**
42: * Interface for defining MIME Content Canonicalizer.
43: * (Section 4.3.2) "MIME Content Canonicalization"; SwA
44: *
45: * @author XWS-Security Team
46: */
47: public abstract class Canonicalizer {
48: String _charset = MimeConstants.US_ASCII;
49:
50: protected static final Logger log = Logger.getLogger(
51: LogDomainConstants.IMPL_CANON_DOMAIN,
52: LogDomainConstants.IMPL_CANON_DOMAIN_BUNDLE);
53:
54: public Canonicalizer() {
55: }
56:
57: Canonicalizer(String charset) {
58: this ._charset = charset;
59: }
60:
61: /*
62: * Main method that performs the actual Canonicalization.
63: */
64: public abstract byte[] canonicalize(byte[] input)
65: throws XWSSecurityException;
66:
67: public abstract InputStream canonicalize(InputStream input,
68: OutputStream outputStream)
69: throws javax.xml.crypto.dsig.TransformException;
70:
71: void setCharset(String charset) {
72: this ._charset = charset;
73: }
74:
75: public String getCharset() {
76: return _charset;
77: }
78: }
|