Class CryptoUtils

java.lang.Object
org.apache.orc.impl.CryptoUtils

public class CryptoUtils extends Object
This class has routines to work with encryption within ORC files.
  • Constructor Details

    • CryptoUtils

      public CryptoUtils()
  • Method Details

    • modifyIvForStream

      public static Consumer<byte[]> modifyIvForStream(StreamName name, long stripeId)
      Update the unique IV for each stream within a single key. The top bytes are set with the column, stream kind, and stripe id and the lower 8 bytes are always 0.
      Parameters:
      name - the stream name
      stripeId - the stripe id
    • modifyIvForStream

      public static Consumer<byte[]> modifyIvForStream(int columnId, OrcProto.Stream.Kind kind, long stripeId)
      Update the unique IV for each stream within a single key. The top bytes are set with the column, stream kind, and stripe id and the lower 8 bytes are always 0.
      Parameters:
      columnId - the column id
      kind - the stream kind
      stripeId - the stripe id
    • modifyIvForStripe

      public static Consumer<byte[]> modifyIvForStripe(long stripeId)
      Modify the IV for the given stripe id and make sure the low bytes are set to 0.
      Parameters:
      stripeId - the stripe id
    • clearCounter

      public static void clearCounter(byte[] iv)
      Clear the counter part of the IV.
      Parameters:
      iv - the IV to modify
    • getKeyProvider

      public static KeyProvider getKeyProvider(Configuration conf, Random random) throws IOException
      Create a KeyProvider. It will cache the result, so that only one provider of each kind will be created.
      Parameters:
      random - the random generator to use
      Returns:
      the new KeyProvider
      Throws:
      IOException