mengna-lin commented on code in PR #18210: URL: https://github.com/apache/iceberg/pull/18210#discussion_r4118481590
########## aliyun/src/main/java/org/apache/iceberg/aliyun/AliyunKeyManagementClient.java: ########## @@ -0,0 +1,212 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.aliyun; + +import com.aliyun.kms20160120.Client; +import com.aliyun.kms20160120.models.DecryptRequest; +import com.aliyun.kms20160120.models.DecryptResponse; +import com.aliyun.kms20160120.models.EncryptRequest; +import com.aliyun.kms20160120.models.EncryptResponse; +import com.aliyun.kms20160120.models.GenerateDataKeyRequest; +import com.aliyun.kms20160120.models.GenerateDataKeyResponse; +import com.aliyun.kms20160120.models.GenerateDataKeyResponseBody; +import com.aliyun.teautil.models.RuntimeOptions; +import java.nio.ByteBuffer; +import java.util.Base64; +import java.util.Map; +import org.apache.iceberg.encryption.KeyManagementClient; +import org.apache.iceberg.relocated.com.google.common.base.Preconditions; +import org.apache.iceberg.util.ByteBuffers; +import org.apache.iceberg.util.PropertyUtil; +import org.apache.iceberg.util.SerializableMap; + +/** + * Key management client implementation that uses Alibaba Cloud KMS. Encrypts/decrypts keys with a + * KMS-managed master key (referenced by its key id) and generates new data keys. + */ +public class AliyunKeyManagementClient implements KeyManagementClient { + + /** + * Enables server-side data key generation. When enabled (the default), Iceberg calls {@link + * #generateKey(String)}; set to {@code false} to have Iceberg generate keys locally and {@link Review Comment: With https://github.com/apache/iceberg/pull/18210/changes/29567a57b69dde559b7d836ab1de1ac2c833333f now it calls generateKey. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
