Example usage for org.bouncycastle.util Arrays concatenate

List of usage examples for org.bouncycastle.util Arrays concatenate

Introduction

In this page you can find the example usage for org.bouncycastle.util Arrays concatenate.

Prototype

public static int[] concatenate(int[] a, int[] b) 

Source Link

Usage

From source file:org.sufficientlysecure.keychain.securitytoken.UsbTransport.java

License:Open Source License

/**
 * Transmits XfrBlock/*from   w  w w.j a  v  a  2 s .co  m*/
 * 6.1.4 PC_to_RDR_XfrBlock
 * @param payload payload to transmit
 * @throws UsbTransportException
 */
private void sendXfrBlock(byte[] payload) throws UsbTransportException {
    int l = payload.length;
    byte[] data = Arrays.concatenate(new byte[] { 0x6f, (byte) l, (byte) (l >> 8), (byte) (l >> 16),
            (byte) (l >> 24), 0x00, mCounter++, 0x00, 0x00, 0x00 }, payload);

    int send = 0;
    while (send < data.length) {
        final int len = Math.min(mBulkIn.getMaxPacketSize(), data.length - send);
        sendRaw(Arrays.copyOfRange(data, send, send + len));
        send += len;
    }
}

From source file:test.java.miro.validator.types.TrustAnchorLocatorTest.java

License:Open Source License

@Test
public void testSubjectPubKeyInfoFromByteArray() {
    byte[] bs = "ajsdasdj\n".getBytes();
    byte[] pubKeyInfo = "1234910302392".getBytes();
    byte[] input = Arrays.concatenate(bs, pubKeyInfo);
    byte[] spki = TrustAnchorLocator.getSubjectPubKeyInfoFromTALbytes(input);
    assertArrayEquals(pubKeyInfo, spki);
}

From source file:Utils.bytes.Bytes.java

public void append(byte[] data) {
    this.bytes = Arrays.concatenate(this.bytes, data);
}

From source file:Utils.bytes.Bytes.java

public void prepend(byte[] data) {
    this.bytes = Arrays.concatenate(data, this.bytes);
}

From source file:Utils.bytes.Bytes.java

public void splice(int from, int to) {
    byte[] first = Arrays.copyOf(bytes, from);
    byte[] second = Arrays.copyOfRange(bytes, to, this.bytes.length);

    this.bytes = Arrays.concatenate(first, second);
}