Java 类org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.CipherOptionProto 实例源码

项目:hadoop    文件:DataTransferSaslUtil.java   
/**
 * Reads a SASL negotiation message and negotiation cipher options. 
 * 
 * @param in stream to read
 * @param cipherOptions list to store negotiation cipher options
 * @return byte[] SASL negotiation message
 * @throws IOException for any error
 */
public static byte[] readSaslMessageAndNegotiationCipherOptions(
    InputStream in, List<CipherOption> cipherOptions) throws IOException {
  DataTransferEncryptorMessageProto proto =
      DataTransferEncryptorMessageProto.parseFrom(vintPrefixed(in));
  if (proto.getStatus() == DataTransferEncryptorStatus.ERROR_UNKNOWN_KEY) {
    throw new InvalidEncryptionKeyException(proto.getMessage());
  } else if (proto.getStatus() == DataTransferEncryptorStatus.ERROR) {
    throw new IOException(proto.getMessage());
  } else {
    List<CipherOptionProto> optionProtos = proto.getCipherOptionList();
    if (optionProtos != null) {
      for (CipherOptionProto optionProto : optionProtos) {
        cipherOptions.add(PBHelper.convert(optionProto));
      }
    }
    return proto.getPayload().toByteArray();
  }
}
项目:hadoop    文件:PBHelper.java   
public static CipherOptionProto convert(CipherOption option) {
  if (option != null) {
    CipherOptionProto.Builder builder = CipherOptionProto.
        newBuilder();
    if (option.getCipherSuite() != null) {
      builder.setSuite(convert(option.getCipherSuite()));
    }
    if (option.getInKey() != null) {
      builder.setInKey(ByteString.copyFrom(option.getInKey()));
    }
    if (option.getInIv() != null) {
      builder.setInIv(ByteString.copyFrom(option.getInIv()));
    }
    if (option.getOutKey() != null) {
      builder.setOutKey(ByteString.copyFrom(option.getOutKey()));
    }
    if (option.getOutIv() != null) {
      builder.setOutIv(ByteString.copyFrom(option.getOutIv()));
    }
    return builder.build();
  }
  return null;
}
项目:hadoop    文件:PBHelper.java   
public static CipherOption convert(CipherOptionProto proto) {
  if (proto != null) {
    CipherSuite suite = null;
    if (proto.getSuite() != null) {
      suite = convert(proto.getSuite());
    }
    byte[] inKey = null;
    if (proto.getInKey() != null) {
      inKey = proto.getInKey().toByteArray();
    }
    byte[] inIv = null;
    if (proto.getInIv() != null) {
      inIv = proto.getInIv().toByteArray();
    }
    byte[] outKey = null;
    if (proto.getOutKey() != null) {
      outKey = proto.getOutKey().toByteArray();
    }
    byte[] outIv = null;
    if (proto.getOutIv() != null) {
      outIv = proto.getOutIv().toByteArray();
    }
    return new CipherOption(suite, inKey, inIv, outKey, outIv);
  }
  return null;
}
项目:aliyun-oss-hadoop-fs    文件:DataTransferSaslUtil.java   
/**
 * Reads a SASL negotiation message and negotiation cipher options.
 *
 * @param in stream to read
 * @param cipherOptions list to store negotiation cipher options
 * @return byte[] SASL negotiation message
 * @throws IOException for any error
 */
public static byte[] readSaslMessageAndNegotiationCipherOptions(
    InputStream in, List<CipherOption> cipherOptions) throws IOException {
  DataTransferEncryptorMessageProto proto =
      DataTransferEncryptorMessageProto.parseFrom(vintPrefixed(in));
  if (proto.getStatus() == DataTransferEncryptorStatus.ERROR_UNKNOWN_KEY) {
    throw new InvalidEncryptionKeyException(proto.getMessage());
  } else if (proto.getStatus() == DataTransferEncryptorStatus.ERROR) {
    throw new IOException(proto.getMessage());
  } else {
    List<CipherOptionProto> optionProtos = proto.getCipherOptionList();
    if (optionProtos != null) {
      for (CipherOptionProto optionProto : optionProtos) {
        cipherOptions.add(PBHelperClient.convert(optionProto));
      }
    }
    return proto.getPayload().toByteArray();
  }
}
项目:big-c    文件:DataTransferSaslUtil.java   
/**
 * Reads a SASL negotiation message and negotiation cipher options. 
 * 
 * @param in stream to read
 * @param cipherOptions list to store negotiation cipher options
 * @return byte[] SASL negotiation message
 * @throws IOException for any error
 */
public static byte[] readSaslMessageAndNegotiationCipherOptions(
    InputStream in, List<CipherOption> cipherOptions) throws IOException {
  DataTransferEncryptorMessageProto proto =
      DataTransferEncryptorMessageProto.parseFrom(vintPrefixed(in));
  if (proto.getStatus() == DataTransferEncryptorStatus.ERROR_UNKNOWN_KEY) {
    throw new InvalidEncryptionKeyException(proto.getMessage());
  } else if (proto.getStatus() == DataTransferEncryptorStatus.ERROR) {
    throw new IOException(proto.getMessage());
  } else {
    List<CipherOptionProto> optionProtos = proto.getCipherOptionList();
    if (optionProtos != null) {
      for (CipherOptionProto optionProto : optionProtos) {
        cipherOptions.add(PBHelper.convert(optionProto));
      }
    }
    return proto.getPayload().toByteArray();
  }
}
项目:big-c    文件:PBHelper.java   
public static CipherOptionProto convert(CipherOption option) {
  if (option != null) {
    CipherOptionProto.Builder builder = CipherOptionProto.
        newBuilder();
    if (option.getCipherSuite() != null) {
      builder.setSuite(convert(option.getCipherSuite()));
    }
    if (option.getInKey() != null) {
      builder.setInKey(ByteString.copyFrom(option.getInKey()));
    }
    if (option.getInIv() != null) {
      builder.setInIv(ByteString.copyFrom(option.getInIv()));
    }
    if (option.getOutKey() != null) {
      builder.setOutKey(ByteString.copyFrom(option.getOutKey()));
    }
    if (option.getOutIv() != null) {
      builder.setOutIv(ByteString.copyFrom(option.getOutIv()));
    }
    return builder.build();
  }
  return null;
}
项目:big-c    文件:PBHelper.java   
public static CipherOption convert(CipherOptionProto proto) {
  if (proto != null) {
    CipherSuite suite = null;
    if (proto.getSuite() != null) {
      suite = convert(proto.getSuite());
    }
    byte[] inKey = null;
    if (proto.getInKey() != null) {
      inKey = proto.getInKey().toByteArray();
    }
    byte[] inIv = null;
    if (proto.getInIv() != null) {
      inIv = proto.getInIv().toByteArray();
    }
    byte[] outKey = null;
    if (proto.getOutKey() != null) {
      outKey = proto.getOutKey().toByteArray();
    }
    byte[] outIv = null;
    if (proto.getOutIv() != null) {
      outIv = proto.getOutIv().toByteArray();
    }
    return new CipherOption(suite, inKey, inIv, outKey, outIv);
  }
  return null;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DataTransferSaslUtil.java   
/**
 * Reads a SASL negotiation message and negotiation cipher options. 
 * 
 * @param in stream to read
 * @param cipherOptions list to store negotiation cipher options
 * @return byte[] SASL negotiation message
 * @throws IOException for any error
 */
public static byte[] readSaslMessageAndNegotiationCipherOptions(
    InputStream in, List<CipherOption> cipherOptions) throws IOException {
  DataTransferEncryptorMessageProto proto =
      DataTransferEncryptorMessageProto.parseFrom(vintPrefixed(in));
  if (proto.getStatus() == DataTransferEncryptorStatus.ERROR_UNKNOWN_KEY) {
    throw new InvalidEncryptionKeyException(proto.getMessage());
  } else if (proto.getStatus() == DataTransferEncryptorStatus.ERROR) {
    throw new IOException(proto.getMessage());
  } else {
    List<CipherOptionProto> optionProtos = proto.getCipherOptionList();
    if (optionProtos != null) {
      for (CipherOptionProto optionProto : optionProtos) {
        cipherOptions.add(PBHelper.convert(optionProto));
      }
    }
    return proto.getPayload().toByteArray();
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static CipherOptionProto convert(CipherOption option) {
  if (option != null) {
    CipherOptionProto.Builder builder = CipherOptionProto.
        newBuilder();
    if (option.getCipherSuite() != null) {
      builder.setSuite(convert(option.getCipherSuite()));
    }
    if (option.getInKey() != null) {
      builder.setInKey(ByteString.copyFrom(option.getInKey()));
    }
    if (option.getInIv() != null) {
      builder.setInIv(ByteString.copyFrom(option.getInIv()));
    }
    if (option.getOutKey() != null) {
      builder.setOutKey(ByteString.copyFrom(option.getOutKey()));
    }
    if (option.getOutIv() != null) {
      builder.setOutIv(ByteString.copyFrom(option.getOutIv()));
    }
    return builder.build();
  }
  return null;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static CipherOption convert(CipherOptionProto proto) {
  if (proto != null) {
    CipherSuite suite = null;
    if (proto.getSuite() != null) {
      suite = convert(proto.getSuite());
    }
    byte[] inKey = null;
    if (proto.getInKey() != null) {
      inKey = proto.getInKey().toByteArray();
    }
    byte[] inIv = null;
    if (proto.getInIv() != null) {
      inIv = proto.getInIv().toByteArray();
    }
    byte[] outKey = null;
    if (proto.getOutKey() != null) {
      outKey = proto.getOutKey().toByteArray();
    }
    byte[] outIv = null;
    if (proto.getOutIv() != null) {
      outIv = proto.getOutIv().toByteArray();
    }
    return new CipherOption(suite, inKey, inIv, outKey, outIv);
  }
  return null;
}
项目:FlexMap    文件:DataTransferSaslUtil.java   
/**
 * Reads a SASL negotiation message and negotiation cipher options. 
 * 
 * @param in stream to read
 * @param cipherOptions list to store negotiation cipher options
 * @return byte[] SASL negotiation message
 * @throws IOException for any error
 */
public static byte[] readSaslMessageAndNegotiationCipherOptions(
    InputStream in, List<CipherOption> cipherOptions) throws IOException {
  DataTransferEncryptorMessageProto proto =
      DataTransferEncryptorMessageProto.parseFrom(vintPrefixed(in));
  if (proto.getStatus() == DataTransferEncryptorStatus.ERROR_UNKNOWN_KEY) {
    throw new InvalidEncryptionKeyException(proto.getMessage());
  } else if (proto.getStatus() == DataTransferEncryptorStatus.ERROR) {
    throw new IOException(proto.getMessage());
  } else {
    List<CipherOptionProto> optionProtos = proto.getCipherOptionList();
    if (optionProtos != null) {
      for (CipherOptionProto optionProto : optionProtos) {
        cipherOptions.add(PBHelper.convert(optionProto));
      }
    }
    return proto.getPayload().toByteArray();
  }
}
项目:FlexMap    文件:PBHelper.java   
public static CipherOptionProto convert(CipherOption option) {
  if (option != null) {
    CipherOptionProto.Builder builder = CipherOptionProto.
        newBuilder();
    if (option.getCipherSuite() != null) {
      builder.setSuite(convert(option.getCipherSuite()));
    }
    if (option.getInKey() != null) {
      builder.setInKey(ByteString.copyFrom(option.getInKey()));
    }
    if (option.getInIv() != null) {
      builder.setInIv(ByteString.copyFrom(option.getInIv()));
    }
    if (option.getOutKey() != null) {
      builder.setOutKey(ByteString.copyFrom(option.getOutKey()));
    }
    if (option.getOutIv() != null) {
      builder.setOutIv(ByteString.copyFrom(option.getOutIv()));
    }
    return builder.build();
  }
  return null;
}
项目:FlexMap    文件:PBHelper.java   
public static CipherOption convert(CipherOptionProto proto) {
  if (proto != null) {
    CipherSuite suite = null;
    if (proto.getSuite() != null) {
      suite = convert(proto.getSuite());
    }
    byte[] inKey = null;
    if (proto.getInKey() != null) {
      inKey = proto.getInKey().toByteArray();
    }
    byte[] inIv = null;
    if (proto.getInIv() != null) {
      inIv = proto.getInIv().toByteArray();
    }
    byte[] outKey = null;
    if (proto.getOutKey() != null) {
      outKey = proto.getOutKey().toByteArray();
    }
    byte[] outIv = null;
    if (proto.getOutIv() != null) {
      outIv = proto.getOutIv().toByteArray();
    }
    return new CipherOption(suite, inKey, inIv, outKey, outIv);
  }
  return null;
}
项目:hadoop    文件:PBHelper.java   
public static List<CipherOptionProto> convertCipherOptions(
    List<CipherOption> options) {
  if (options != null) {
    List<CipherOptionProto> protos = 
        Lists.newArrayListWithCapacity(options.size());
    for (CipherOption option : options) {
      protos.add(convert(option));
    }
    return protos;
  }
  return null;
}
项目:hadoop    文件:PBHelper.java   
public static List<CipherOption> convertCipherOptionProtos(
    List<CipherOptionProto> protos) {
  if (protos != null) {
    List<CipherOption> options = 
        Lists.newArrayListWithCapacity(protos.size());
    for (CipherOptionProto proto : protos) {
      options.add(convert(proto));
    }
    return options;
  }
  return null;
}
项目:big-c    文件:PBHelper.java   
public static List<CipherOptionProto> convertCipherOptions(
    List<CipherOption> options) {
  if (options != null) {
    List<CipherOptionProto> protos = 
        Lists.newArrayListWithCapacity(options.size());
    for (CipherOption option : options) {
      protos.add(convert(option));
    }
    return protos;
  }
  return null;
}
项目:big-c    文件:PBHelper.java   
public static List<CipherOption> convertCipherOptionProtos(
    List<CipherOptionProto> protos) {
  if (protos != null) {
    List<CipherOption> options = 
        Lists.newArrayListWithCapacity(protos.size());
    for (CipherOptionProto proto : protos) {
      options.add(convert(proto));
    }
    return options;
  }
  return null;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static List<CipherOptionProto> convertCipherOptions(
    List<CipherOption> options) {
  if (options != null) {
    List<CipherOptionProto> protos = 
        Lists.newArrayListWithCapacity(options.size());
    for (CipherOption option : options) {
      protos.add(convert(option));
    }
    return protos;
  }
  return null;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static List<CipherOption> convertCipherOptionProtos(
    List<CipherOptionProto> protos) {
  if (protos != null) {
    List<CipherOption> options = 
        Lists.newArrayListWithCapacity(protos.size());
    for (CipherOptionProto proto : protos) {
      options.add(convert(proto));
    }
    return options;
  }
  return null;
}
项目:FlexMap    文件:PBHelper.java   
public static List<CipherOptionProto> convertCipherOptions(
    List<CipherOption> options) {
  if (options != null) {
    List<CipherOptionProto> protos = 
        Lists.newArrayListWithCapacity(options.size());
    for (CipherOption option : options) {
      protos.add(convert(option));
    }
    return protos;
  }
  return null;
}
项目:FlexMap    文件:PBHelper.java   
public static List<CipherOption> convertCipherOptionProtos(
    List<CipherOptionProto> protos) {
  if (protos != null) {
    List<CipherOption> options = 
        Lists.newArrayListWithCapacity(protos.size());
    for (CipherOptionProto proto : protos) {
      options.add(convert(proto));
    }
    return options;
  }
  return null;
}
项目:hbase    文件:FanOutOneBlockAsyncDFSOutputSaslHelper.java   
List<CipherOptionProto> convertCipherOptions(List<CipherOption> options);
项目:hbase    文件:FanOutOneBlockAsyncDFSOutputSaslHelper.java   
List<CipherOption> convertCipherOptionProtos(List<CipherOptionProto> options);