1 17 package com.sun.org.apache.xml.internal.security.utils; 18 19 import java.io.ByteArrayOutputStream ; 20 21 import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithm; 22 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; 23 24 28 public class SignerOutputStream extends ByteArrayOutputStream { 29 final static byte none[]="error".getBytes(); 30 final SignatureAlgorithm sa; 31 34 public SignerOutputStream(SignatureAlgorithm sa) { 35 this.sa=sa; 36 } 37 38 39 public byte[] toByteArray() { 40 return none; 41 } 42 43 44 public void write(byte[] arg0) { 45 try { 46 sa.update(arg0); 47 } catch (XMLSignatureException e) { 48 throw new RuntimeException (""+e); 49 } 50 } 51 52 53 public void write(int arg0) { 54 try { 55 sa.update((byte)arg0); 56 } catch (XMLSignatureException e) { 57 throw new RuntimeException (""+e); 58 } 59 } 60 61 62 public void write(byte[] arg0, int arg1, int arg2) { 63 try { 64 sa.update(arg0,arg1,arg2); 65 } catch (XMLSignatureException e) { 66 throw new RuntimeException (""+e); 67 } 68 } 69 70 71 } 72 | Popular Tags |