当前位置: 首页>>代码示例>>Java>>正文


Java DataEncryptionKey类代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey的典型用法代码示例。如果您正苦于以下问题:Java DataEncryptionKey类的具体用法?Java DataEncryptionKey怎么用?Java DataEncryptionKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataEncryptionKey类属于org.apache.hadoop.hdfs.security.token.block包,在下文中一共展示了DataEncryptionKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkTrustAndSend

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
/**
 * Checks if an address is already trusted and then sends client SASL
 * negotiation if required.
 *
 * @param addr connection address
 * @param underlyingOut connection output stream
 * @param underlyingIn connection input stream
 * @param encryptionKeyFactory for creation of an encryption key
 * @param accessToken connection block access token
 * @param datanodeId ID of destination DataNode
 * @return new pair of streams, wrapped after SASL negotiation
 * @throws IOException for any error
 */
private IOStreamPair checkTrustAndSend(InetAddress addr,
    OutputStream underlyingOut, InputStream underlyingIn,
    DataEncryptionKeyFactory encryptionKeyFactory,
    Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId)
    throws IOException {
  if (!trustedChannelResolver.isTrusted() &&
      !trustedChannelResolver.isTrusted(addr)) {
    // The encryption key factory only returns a key if encryption is enabled.
    DataEncryptionKey encryptionKey =
      encryptionKeyFactory.newDataEncryptionKey();
    return send(addr, underlyingOut, underlyingIn, encryptionKey, accessToken,
      datanodeId);
  } else {
    LOG.debug(
      "SASL client skipping handshake on trusted connection for addr = {}, "
      + "datanodeId = {}", addr, datanodeId);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:SaslDataTransferClient.java

示例2: getEncryptedStreams

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
/**
 * Sends client SASL negotiation for specialized encrypted handshake.
 *
 * @param underlyingOut connection output stream
 * @param underlyingIn connection input stream
 * @param encryptionKey for an encrypted SASL handshake
 * @return new pair of streams, wrapped after SASL negotiation
 * @throws IOException for any error
 */
private IOStreamPair getEncryptedStreams(OutputStream underlyingOut,
    InputStream underlyingIn, DataEncryptionKey encryptionKey)
    throws IOException {
  Map<String, String> saslProps = createSaslPropertiesForEncryption(
    encryptionKey.encryptionAlgorithm);

  LOG.debug("Client using encryption algorithm {}",
    encryptionKey.encryptionAlgorithm);

  String userName = getUserNameFromEncryptionKey(encryptionKey);
  char[] password = encryptionKeyToPassword(encryptionKey.encryptionKey);
  CallbackHandler callbackHandler = new SaslClientCallbackHandler(userName,
    password);
  return doSaslHandshake(underlyingOut, underlyingIn, userName, saslProps,
    callbackHandler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:SaslDataTransferClient.java

示例3: getDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@Override
public GetDataEncryptionKeyResponseProto getDataEncryptionKey(
    RpcController controller, GetDataEncryptionKeyRequestProto request)
    throws ServiceException {
  try {
    GetDataEncryptionKeyResponseProto.Builder builder = 
        GetDataEncryptionKeyResponseProto.newBuilder();
    DataEncryptionKey encryptionKey = server.getDataEncryptionKey();
    if (encryptionKey != null) {
      builder.setDataEncryptionKey(PBHelper.convert(encryptionKey));
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java

示例4: checkTrustAndSend

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
/**
 * Checks if an address is already trusted and then sends client SASL
 * negotiation if required.
 *
 * @param addr connection address
 * @param underlyingOut connection output stream
 * @param underlyingIn connection input stream
 * @param encryptionKeyFactory for creation of an encryption key
 * @param accessToken connection block access token
 * @param datanodeId ID of destination DataNode
 * @return new pair of streams, wrapped after SASL negotiation
 * @throws IOException for any error
 */
private IOStreamPair checkTrustAndSend(InetAddress addr,
    OutputStream underlyingOut, InputStream underlyingIn,
    DataEncryptionKeyFactory encryptionKeyFactory,
    Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId)
    throws IOException {
  if (!trustedChannelResolver.isTrusted() &&
      !trustedChannelResolver.isTrusted(addr)) {
    // The encryption key factory only returns a key if encryption is enabled.
    DataEncryptionKey encryptionKey =
        encryptionKeyFactory.newDataEncryptionKey();
    return send(addr, underlyingOut, underlyingIn, encryptionKey, accessToken,
        datanodeId);
  } else {
    LOG.debug(
        "SASL client skipping handshake on trusted connection for addr = {}, "
            + "datanodeId = {}", addr, datanodeId);
    return null;
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:SaslDataTransferClient.java

示例5: getEncryptedStreams

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
/**
 * Sends client SASL negotiation for specialized encrypted handshake.
 *
 * @param underlyingOut connection output stream
 * @param underlyingIn connection input stream
 * @param encryptionKey for an encrypted SASL handshake
 * @return new pair of streams, wrapped after SASL negotiation
 * @throws IOException for any error
 */
private IOStreamPair getEncryptedStreams(OutputStream underlyingOut,
    InputStream underlyingIn, DataEncryptionKey encryptionKey)
    throws IOException {
  Map<String, String> saslProps = createSaslPropertiesForEncryption(
      encryptionKey.encryptionAlgorithm);

  LOG.debug("Client using encryption algorithm {}",
      encryptionKey.encryptionAlgorithm);

  String userName = getUserNameFromEncryptionKey(encryptionKey);
  char[] password = encryptionKeyToPassword(encryptionKey.encryptionKey);
  CallbackHandler callbackHandler = new SaslClientCallbackHandler(userName,
      password);
  return doSaslHandshake(underlyingOut, underlyingIn, userName, saslProps,
      callbackHandler);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:SaslDataTransferClient.java

示例6: getDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@Override
public GetDataEncryptionKeyResponseProto getDataEncryptionKey(
    RpcController controller, GetDataEncryptionKeyRequestProto request)
    throws ServiceException {
  try {
    GetDataEncryptionKeyResponseProto.Builder builder = 
        GetDataEncryptionKeyResponseProto.newBuilder();
    DataEncryptionKey encryptionKey = server.getDataEncryptionKey();
    if (encryptionKey != null) {
      builder.setDataEncryptionKey(PBHelperClient.convert(encryptionKey));
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java

示例7: getDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@InterfaceAudience.Private
public DataEncryptionKey getDataEncryptionKey()
    throws IOException {
  if (shouldEncryptData()) {
    synchronized (this) {
      if (encryptionKey == null ||
          encryptionKey.expiryDate < Time.now()) {
        LOG.debug("Getting new encryption token from NN");
        encryptionKey = namenode.getDataEncryptionKey();
      }
      return encryptionKey;
    }
  } else {
    return null;
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:17,代码来源:DFSClient.java

示例8: peerFromSocketAndKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
public static Peer peerFromSocketAndKey(Socket s,
      DataEncryptionKey key) throws IOException {
  Peer peer = null;
  boolean success = false;
  try {
    peer = peerFromSocket(s); 
    if (key != null) {
      peer = new EncryptedPeer(peer, key);
    }
    success = true;
    return peer;
  } finally {
    if (!success) {
      IOUtils.cleanup(null, peer);
    }
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:18,代码来源:TcpPeerServer.java

示例9: getDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@Override
public GetDataEncryptionKeyResponseProto getDataEncryptionKey(
    RpcController controller, GetDataEncryptionKeyRequestProto request)
    throws ServiceException {
  try {
    GetDataEncryptionKeyResponseProto.Builder builder =
        GetDataEncryptionKeyResponseProto.newBuilder();
    DataEncryptionKey encryptionKey = server.getDataEncryptionKey();
    if (encryptionKey != null) {
      builder.setDataEncryptionKey(PBHelper.convert(encryptionKey));
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java

示例10: getDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@InterfaceAudience.Private
public DataEncryptionKey getDataEncryptionKey()
    throws IOException {
  if (shouldEncryptData() && 
      !this.trustedChannelResolver.isTrusted()) {
    synchronized (this) {
      if (encryptionKey == null ||
          encryptionKey.expiryDate < Time.now()) {
        LOG.debug("Getting new encryption token from NN");
        encryptionKey = namenode.getDataEncryptionKey();
      }
      return encryptionKey;
    }
  } else {
    return null;
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:18,代码来源:DFSClient.java

示例11: newDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@Override
public DataEncryptionKey newDataEncryptionKey() throws IOException {
  if (shouldEncryptData()) {
    synchronized (this) {
      if (encryptionKey == null ||
          encryptionKey.expiryDate < Time.now()) {
        LOG.debug("Getting new encryption token from NN");
        encryptionKey = namenode.getDataEncryptionKey();
      }
      return encryptionKey;
    }
  } else {
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:DFSClient.java

示例12: newDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
@Override
public DataEncryptionKey newDataEncryptionKey() {
  if (encryptDataTransfer) {
    synchronized (this) {
      if (encryptionKey == null) {
        encryptionKey = blockTokenSecretManager.generateDataEncryptionKey();
      }
      return encryptionKey;
    }
  } else {
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:KeyManager.java

示例13: generateDataEncryptionKey

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
public DataEncryptionKey generateDataEncryptionKey() {
  if (isBlockTokenEnabled() && encryptDataTransfer) {
    return blockTokenSecretManager.generateDataEncryptionKey();
  } else {
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:BlockManager.java

示例14: getDataEncryptionKeyFactoryForBlock

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
/**
 * Returns a new DataEncryptionKeyFactory that generates a key from the
 * BlockPoolTokenSecretManager, using the block pool ID of the given block.
 *
 * @param block for which the factory needs to create a key
 * @return DataEncryptionKeyFactory for block's block pool ID
 */
DataEncryptionKeyFactory getDataEncryptionKeyFactoryForBlock(
    final ExtendedBlock block) {
  return new DataEncryptionKeyFactory() {
    @Override
    public DataEncryptionKey newDataEncryptionKey() {
      return dnConf.encryptDataTransfer ?
        blockPoolTokenSecretManager.generateDataEncryptionKey(
          block.getBlockPoolId()) : null;
    }
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:DataNode.java

示例15: convert

import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; //导入依赖的package包/类
public static DataEncryptionKey convert(DataEncryptionKeyProto bet) {
  String encryptionAlgorithm = bet.getEncryptionAlgorithm();
  return new DataEncryptionKey(bet.getKeyId(),
      bet.getBlockPoolId(),
      bet.getNonce().toByteArray(),
      bet.getEncryptionKey().toByteArray(),
      bet.getExpiryDate(),
      encryptionAlgorithm.isEmpty() ? null : encryptionAlgorithm);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:PBHelper.java


注:本文中的org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。