Java Code Examples for java.util.Objects.checkFromIndexSize()

The following are Jave code examples for showing how to use checkFromIndexSize() of the java.util.Objects class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: openjdk-jdk10   File: AESCrypt.java   Source Code and License Vote up 5 votes
/**
 * Encrypt exactly one block of plaintext.
 */
void encryptBlock(byte[] in, int inOffset,
                  byte[] out, int outOffset) {
    Objects.checkFromIndexSize(inOffset, AES_BLOCK_SIZE, in.length);
    Objects.checkFromIndexSize(outOffset, AES_BLOCK_SIZE, out.length);
    implEncryptBlock(in, inOffset, out, outOffset);
}
 
Example 2
Project: openjdk-jdk10   File: AESCrypt.java   Source Code and License Vote up 5 votes
/**
 * Decrypt exactly one block of plaintext.
 */
void decryptBlock(byte[] in, int inOffset,
                  byte[] out, int outOffset) {
    Objects.checkFromIndexSize(inOffset, AES_BLOCK_SIZE, in.length);
    Objects.checkFromIndexSize(outOffset, AES_BLOCK_SIZE, out.length);
    implDecryptBlock(in, inOffset, out, outOffset);
}
 
Example 3
Project: openjdk-jdk10   File: CounterMode.java   Source Code and License Vote up 5 votes
/**
 * Do the actual encryption/decryption operation.
 * Essentially we XOR the input plaintext/ciphertext stream with a
 * keystream generated by encrypting the counter values. Counter values
 * are encrypted on demand.
 */
private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
    if (len == 0) {
        return 0;
    }
    Objects.checkFromIndexSize(inOff, len, in.length);
    Objects.checkFromIndexSize(outOff, len, out.length);
    return implCrypt(in, inOff, len, out, outOff);
}