Package org.apache.orc.impl
Class CryptoUtils
java.lang.Object
org.apache.orc.impl.CryptoUtils
This class has routines to work with encryption within ORC files.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearCounter(byte[] iv) Clear the counter part of the IV.static KeyProvidergetKeyProvider(Configuration conf, Random random) Create a KeyProvider.static Consumer<byte[]>modifyIvForStream(int columnId, OrcProto.Stream.Kind kind, long stripeId) Update the unique IV for each stream within a single key.static Consumer<byte[]>modifyIvForStream(StreamName name, long stripeId) Update the unique IV for each stream within a single key.static Consumer<byte[]>modifyIvForStripe(long stripeId) Modify the IV for the given stripe id and make sure the low bytes are set to 0.
-
Constructor Details
-
CryptoUtils
public CryptoUtils()
-
-
Method Details
-
modifyIvForStream
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 namestripeId- 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 idkind- the stream kindstripeId- the stripe id
-
modifyIvForStripe
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
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
-