@InterfaceAudience.Public public final class Encryption extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | Encryption.ContextCrypto context | 
| Modifier and Type | Field and Description | 
|---|---|
| (package private) static Map<Pair<String,String>,KeyProvider> | keyProviderCache | 
| private static org.slf4j.Logger | LOG | 
| Modifier | Constructor and Description | 
|---|---|
| private  | Encryption() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | decrypt(byte[] dest,
       int destOffset,
       InputStream in,
       int destSize,
       Decryptor d)Decrypt a block of ciphertext read in from a stream with the given
 cipher and context | 
| static void | decrypt(byte[] dest,
       int destOffset,
       InputStream in,
       int destSize,
       Encryption.Context context,
       byte[] iv)Decrypt a block of ciphertext from a stream given a context and IV | 
| static void | decrypt(OutputStream out,
       InputStream in,
       int outLen,
       Decryptor d)Decrypt a stream of ciphertext given a decryptor | 
| static void | decrypt(OutputStream out,
       InputStream in,
       int outLen,
       Encryption.Context context,
       byte[] iv)Decrypt a stream of ciphertext given a context and IV | 
| static void | decryptWithSubjectKey(OutputStream out,
                     InputStream in,
                     int outLen,
                     String subject,
                     org.apache.hadoop.conf.Configuration conf,
                     Cipher cipher,
                     byte[] iv)Decrypts a block of ciphertext with the symmetric key resolved for the given subject | 
| static void | encrypt(OutputStream out,
       byte[] src,
       int offset,
       int length,
       Encryption.Context context,
       byte[] iv)Encrypt a block of plaintext | 
| static void | encrypt(OutputStream out,
       byte[] src,
       int offset,
       int length,
       Encryptor e)Encrypt a block of plaintext | 
| static void | encrypt(OutputStream out,
       InputStream in,
       Encryption.Context context,
       byte[] iv)Encrypt a stream of plaintext given a context and IV | 
| static void | encrypt(OutputStream out,
       InputStream in,
       Encryptor e)Encrypt a stream of plaintext given an encryptor | 
| static void | encryptWithSubjectKey(OutputStream out,
                     InputStream in,
                     String subject,
                     org.apache.hadoop.conf.Configuration conf,
                     Cipher cipher,
                     byte[] iv)Encrypts a block of plaintext with the symmetric key resolved for the given subject | 
| static Cipher | getCipher(org.apache.hadoop.conf.Configuration conf,
         String name)Get an cipher given a name | 
| static CipherProvider | getCipherProvider(org.apache.hadoop.conf.Configuration conf) | 
| private static ClassLoader | getClassLoaderForClass(Class<?> c) | 
| static KeyProvider | getKeyProvider(org.apache.hadoop.conf.Configuration conf) | 
| static Key | getSecretKeyForSubject(String subject,
                      org.apache.hadoop.conf.Configuration conf)Resolves a key for the given subject | 
| static String[] | getSupportedCiphers()Get names of supported encryption algorithms | 
| static String[] | getSupportedCiphers(org.apache.hadoop.conf.Configuration conf)Get names of supported encryption algorithms | 
| static byte[] | hash128(byte[]... args)Return the MD5 digest of the concatenation of the supplied arguments. | 
| static byte[] | hash128(String... args)Return the MD5 digest of the concatenation of the supplied arguments. | 
| static byte[] | hash256(byte[]... args)Return the SHA-256 digest of the concatenation of the supplied arguments. | 
| static byte[] | hash256(String... args)Return the SHA-256 digest of the concatenation of the supplied arguments. | 
| static void | incrementIv(byte[] iv) | 
| static void | incrementIv(byte[] iv,
           int v) | 
| static Encryption.Context | newContext() | 
| static Encryption.Context | newContext(org.apache.hadoop.conf.Configuration conf) | 
| static byte[] | pbkdf128(byte[]... args)Return a 128 bit key derived from the concatenation of the supplied
 arguments using PBKDF2WithHmacSHA1 at 10,000 iterations. | 
| static byte[] | pbkdf128(String... args)Return a 128 bit key derived from the concatenation of the supplied
 arguments using PBKDF2WithHmacSHA1 at 10,000 iterations. | 
private static final org.slf4j.Logger LOG
static final Map<Pair<String,String>,KeyProvider> keyProviderCache
private Encryption()
public static Encryption.Context newContext()
public static Encryption.Context newContext(org.apache.hadoop.conf.Configuration conf)
public static Cipher getCipher(org.apache.hadoop.conf.Configuration conf, String name)
name - the cipher namepublic static String[] getSupportedCiphers()
public static String[] getSupportedCiphers(org.apache.hadoop.conf.Configuration conf)
public static byte[] hash128(String... args)
public static byte[] hash128(byte[]... args)
public static byte[] hash256(String... args)
public static byte[] hash256(byte[]... args)
public static byte[] pbkdf128(String... args)
public static byte[] pbkdf128(byte[]... args)
public static void encrypt(OutputStream out, byte[] src, int offset, int length, Encryptor e) throws IOException
The encryptor's state will be finalized. It should be reinitialized or returned to the pool.
out - ciphertextsrc - plaintextoffset - length - e - IOExceptionpublic static void encrypt(OutputStream out, byte[] src, int offset, int length, Encryption.Context context, byte[] iv) throws IOException
out - ciphertextsrc - plaintextoffset - length - context - iv - IOExceptionpublic static void encrypt(OutputStream out, InputStream in, Encryptor e) throws IOException
The encryptor's state will be finalized. It should be reinitialized or returned to the pool.
out - ciphertextin - plaintexte - IOExceptionpublic static void encrypt(OutputStream out, InputStream in, Encryption.Context context, byte[] iv) throws IOException
out - ciphertextin - plaintetcontext - iv - IOExceptionpublic static void decrypt(byte[] dest, int destOffset, InputStream in, int destSize, Decryptor d) throws IOException
The decryptor's state will be finalized. It should be reinitialized or returned to the pool.
dest - destOffset - in - destSize - d - IOExceptionpublic static void decrypt(byte[] dest, int destOffset, InputStream in, int destSize, Encryption.Context context, byte[] iv) throws IOException
dest - destOffset - in - destSize - context - iv - IOExceptionpublic static void decrypt(OutputStream out, InputStream in, int outLen, Decryptor d) throws IOException
out - in - outLen - d - IOExceptionpublic static void decrypt(OutputStream out, InputStream in, int outLen, Encryption.Context context, byte[] iv) throws IOException
out - in - outLen - context - iv - IOExceptionpublic static Key getSecretKeyForSubject(String subject, org.apache.hadoop.conf.Configuration conf) throws IOException
subject - conf - IOException - if the key is not foundpublic static void encryptWithSubjectKey(OutputStream out, InputStream in, String subject, org.apache.hadoop.conf.Configuration conf, Cipher cipher, byte[] iv) throws IOException
out - ciphertextin - plaintextconf - configurationcipher - the encryption algorithmiv - the initialization vector, can be nullIOExceptionpublic static void decryptWithSubjectKey(OutputStream out, InputStream in, int outLen, String subject, org.apache.hadoop.conf.Configuration conf, Cipher cipher, byte[] iv) throws IOException
out - plaintextin - ciphertextoutLen - the expected plaintext lengthsubject - the subject's key aliasconf - configurationcipher - the encryption algorithmiv - the initialization vector, can be nullIOExceptionprivate static ClassLoader getClassLoaderForClass(Class<?> c)
public static CipherProvider getCipherProvider(org.apache.hadoop.conf.Configuration conf)
public static KeyProvider getKeyProvider(org.apache.hadoop.conf.Configuration conf)
public static void incrementIv(byte[] iv)
public static void incrementIv(byte[] iv, int v)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.