// Read file contents into array 'buf' sizeBuf = in.read(buf); in.close(); //Generate a signature 'b' with a Private Key s.update(buf); byte[] b = s.sign(); //Create a StringBuffer and add to it the original XML file and the signature StringBuffer sb = new StringBuffer(new String(buf,0,sizeBuf-4)); sb.append(new sun.misc.BASE64Encoder().encode(b)); sb.append(new String(buf, sizeBuf-4, 4)); //Read the buffer and insert into Tamino StringReader sr = new StringReader(sb.toString()); xmlObject.readFrom(sr); xmlObjectAccessor.insert( xmlObject );