Example usage for org.apache.hadoop.hdfs UnknownCipherSuiteException UnknownCipherSuiteException

List of usage examples for org.apache.hadoop.hdfs UnknownCipherSuiteException UnknownCipherSuiteException

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs UnknownCipherSuiteException UnknownCipherSuiteException.

Prototype

public UnknownCipherSuiteException(String msg) 

Source Link

Usage

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Obtain a CryptoCodec based on the CipherSuite set in a FileEncryptionInfo
 * and the available CryptoCodecs configured in the Configuration.
 * /*from   w  w  w.  java2s .  c  o  m*/
 * @param conf
 *            Configuration
 * @param feInfo
 *            FileEncryptionInfo
 * @return CryptoCodec
 * @throws IOException
 *             if no suitable CryptoCodec for the CipherSuite is
 *             available.
 */
private static CryptoCodec getCryptoCodec(Configuration conf, FileEncryptionInfo feInfo) throws IOException {
    final CipherSuite suite = feInfo.getCipherSuite();
    if (suite.equals(CipherSuite.UNKNOWN)) {
        throw new IOException("NameNode specified unknown CipherSuite with ID " + suite.getUnknownValue()
                + ", cannot instantiate CryptoCodec.");
    }
    final CryptoCodec codec = CryptoCodec.getInstance(conf, suite);
    if (codec == null) {
        throw new UnknownCipherSuiteException("No configuration found for the cipher suite "
                + suite.getConfigSuffix() + " prefixed with " + HADOOP_SECURITY_CRYPTO_CODEC_CLASSES_KEY_PREFIX
                + ". Please see the example configuration "
                + "hadoop.security.crypto.codec.classes.EXAMPLECIPHERSUITE "
                + "at core-default.xml for details.");
    }
    return codec;
}