Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17295#discussion_r107323085
  
    --- Diff: 
core/src/main/scala/org/apache/spark/security/CryptoStreamUtils.scala ---
    @@ -48,12 +51,30 @@ private[spark] object CryptoStreamUtils extends Logging 
{
           os: OutputStream,
           sparkConf: SparkConf,
           key: Array[Byte]): OutputStream = {
    -    val properties = toCryptoConf(sparkConf)
    -    val iv = createInitializationVector(properties)
    +    val params = new CryptoParams(key, sparkConf)
    +    val iv = createInitializationVector(params.conf)
         os.write(iv)
    -    val transformationStr = sparkConf.get(IO_CRYPTO_CIPHER_TRANSFORMATION)
    -    new CryptoOutputStream(transformationStr, properties, os,
    -      new SecretKeySpec(key, "AES"), new IvParameterSpec(iv))
    +    new CryptoOutputStream(params.transformation, params.conf, os, 
params.keySpec,
    +      new IvParameterSpec(iv))
    +  }
    +
    +  /**
    +   * Wrap a `WritableByteChannel` for encryption.
    +   */
    +  def createWritableChannel(
    +      channel: WritableByteChannel,
    +      sparkConf: SparkConf,
    +      key: Array[Byte]): WritableByteChannel = {
    +    val params = new CryptoParams(key, sparkConf)
    +    val iv = createInitializationVector(params.conf)
    +    val buf = ByteBuffer.wrap(iv)
    +    while (buf.hasRemaining()) {
    --- End diff --
    
    is there any possibility this may be an infinite loop?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to