Package org.apache.hadoop.hbase.io.crypto

Examples of org.apache.hadoop.hbase.io.crypto.Decryptor


    Encryption.Context cryptoContext = fileContext.getEncryptionContext();
    if (cryptoContext != Encryption.Context.NONE) {

      Cipher cipher = cryptoContext.getCipher();
      Decryptor decryptor = cipher.getDecryptor();
      decryptor.setKey(cryptoContext.getKey());

      // Encrypted block format:
      // +--------------------------+
      // | byte iv length           |
      // +--------------------------+
      // | iv data ...              |
      // +--------------------------+
      // | encrypted block data ... |
      // +--------------------------+

      int ivLength = in.read();
      if (ivLength > 0) {
        byte[] iv = new byte[ivLength];
        IOUtils.readFully(in, iv);
        decryptor.setIv(iv);
        // All encrypted blocks will have a nonzero IV length. If we see an IV
        // length of zero, this means the encoding context had 0 bytes of
        // plaintext to encode.
        decryptor.reset();
        in = decryptor.createDecryptionStream(in);
      }
      onDiskSizeWithoutHeader -= Bytes.SIZEOF_BYTE + ivLength;
    }

    Compression.Algorithm compression = fileContext.getCompression();
View Full Code Here


  public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv)
      throws IOException {
    Preconditions.checkNotNull(context);
    Preconditions.checkState(context.getKey() != null, "Context does not have a key");
    Preconditions.checkNotNull(iv);
    Decryptor d = getDecryptor();
    d.setKey(context.getKey());
    d.setIv(iv);
    return d.createDecryptionStream(in);
  }
View Full Code Here

  public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv)
      throws IOException {
    Preconditions.checkNotNull(context);
    Preconditions.checkState(context.getKey() != null, "Context does not have a key");
    Preconditions.checkNotNull(iv);
    Decryptor d = getDecryptor();
    d.setKey(context.getKey());
    d.setIv(iv);
    return d.createDecryptionStream(in);
  }
View Full Code Here

    Encryption.Context cryptoContext = fileContext.getEncryptionContext();
    if (cryptoContext != Encryption.Context.NONE) {

      Cipher cipher = cryptoContext.getCipher();
      Decryptor decryptor = cipher.getDecryptor();
      decryptor.setKey(cryptoContext.getKey());

      // Encrypted block format:
      // +--------------------------+
      // | byte iv length           |
      // +--------------------------+
      // | iv data ...              |
      // +--------------------------+
      // | encrypted block data ... |
      // +--------------------------+

      int ivLength = in.read();
      if (ivLength > 0) {
        byte[] iv = new byte[ivLength];
        IOUtils.readFully(in, iv);
        decryptor.setIv(iv);
        // All encrypted blocks will have a nonzero IV length. If we see an IV
        // length of zero, this means the encoding context had 0 bytes of
        // plaintext to encode.
        decryptor.reset();
        in = decryptor.createDecryptionStream(in);
      }
      onDiskSizeWithoutHeader -= Bytes.SIZEOF_BYTE + ivLength;
    }

    Compression.Algorithm compression = fileContext.getCompression();
View Full Code Here

  public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv)
      throws IOException {
    Preconditions.checkNotNull(context);
    Preconditions.checkState(context.getKey() != null, "Context does not have a key");
    Preconditions.checkNotNull(iv);
    Decryptor d = getDecryptor();
    d.setKey(context.getKey());
    d.setIv(iv);
    return d.createDecryptionStream(in);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.crypto.Decryptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.