public CipherOutputStream(BlockCipher tc, OutputStream bo) { this.bo = bo; changeCipher(tc); }
public void writePlain(int b) throws IOException { if (pos != 0) throw new IOException("Cannot write plain since crypto buffer is not aligned."); internal_write(b); }
public void write(int b) throws IOException { buffer[pos++] = (byte) b; if (pos >= blockSize) writeBlock(); }
send_packet_header_buffer[4] = (byte) padd_len; cos.write(send_packet_header_buffer, 0, 5); cos.write(message, off, len); cos.write(send_padding_buffer, 0, padd_len); cos.writePlain(send_mac_buffer, 0, send_mac_buffer.length); cos.flush();
public TransportConnection(InputStream is, OutputStream os, SecureRandom rnd) { this.cis = new CipherInputStream(new NullCipher(), is); this.cos = new CipherOutputStream(new NullCipher(), os); this.rnd = rnd; }
send_packet_header_buffer[4] = (byte) padd_len; cos.write(send_packet_header_buffer, 0, 5); cos.write(message, off, len); cos.write(send_padding_buffer, 0, padd_len); cos.writePlain(send_mac_buffer, 0, send_mac_buffer.length); cos.flush();
public TransportConnection(InputStream is, OutputStream os, SecureRandom rnd) { this.cis = new CipherInputStream(new NullCipher(), is); this.cos = new CipherOutputStream(new NullCipher(), os); this.rnd = rnd; }
send_packet_header_buffer[4] = (byte) padd_len; cos.write(send_packet_header_buffer, 0, 5); cos.write(message, off, len); cos.write(send_padding_buffer, 0, padd_len); cos.writePlain(send_mac_buffer, 0, send_mac_buffer.length); cos.flush();
public void writePlain(byte[] b, int off, int len) throws IOException { if (pos != 0) throw new IOException("Cannot write plain since crypto buffer is not aligned."); internal_write(b, off, len); } }
public void write(int b) throws IOException { buffer[pos++] = (byte) b; if (pos >= blockSize) writeBlock(); }
public CipherOutputStream(BlockCipher tc, OutputStream bo) { this.bo = bo; changeCipher(tc); }
public TransportConnection(InputStream is, OutputStream os, SecureRandom rnd) { this.cis = new CipherInputStream(new NullCipher(), is); this.cos = new CipherOutputStream(new NullCipher(), os); this.rnd = rnd; }
public void writePlain(byte[] b, int off, int len) throws IOException { if (pos != 0) throw new IOException("Cannot write plain since crypto buffer is not aligned."); internal_write(b, off, len); } }
public void write(int b) throws IOException { buffer[pos++] = (byte) b; if (pos >= blockSize) writeBlock(); }
public CipherOutputStream(BlockCipher tc, OutputStream bo) { this.bo = bo; changeCipher(tc); }
public void writePlain(int b) throws IOException { if (pos != 0) throw new IOException("Cannot write plain since crypto buffer is not aligned."); internal_write(b); }
public void write(byte[] src, int off, int len) throws IOException { while (len > 0) { int avail = blockSize - pos; int copy = Math.min(avail, len); System.arraycopy(src, off, buffer, pos, copy); pos += copy; off += copy; len -= copy; if (pos >= blockSize) writeBlock(); } }
public void changeSendCipher(BlockCipher bc, MAC mac) { if ((bc instanceof NullCipher) == false) { /* Only use zero byte padding for the first few packets */ useRandomPadding = true; /* Once we start encrypting, there is no way back */ } cos.changeCipher(bc); send_mac = mac; send_mac_buffer = (mac != null) ? new byte[mac.size()] : null; send_padd_blocksize = bc.getBlockSize(); if (send_padd_blocksize < 8) send_padd_blocksize = 8; }
public void writePlain(int b) throws IOException { if (pos != 0) throw new IOException("Cannot write plain since crypto buffer is not aligned."); internal_write(b); }
public void write(byte[] src, int off, int len) throws IOException { while (len > 0) { int avail = blockSize - pos; int copy = Math.min(avail, len); System.arraycopy(src, off, buffer, pos, copy); pos += copy; off += copy; len -= copy; if (pos >= blockSize) writeBlock(); } }