0

I am able to upload the file on MinIO Server using Java and facing absolutely no problem in it. But my Requirement is to encrypt the file (Object) before storing in MinIO Server (SSE-C). Basically I am looking for a sample code to do so which is mentioned here: https://docs.min.io/docs/minio-security-overview.html#sse.

I did get the code for same but there is some compilation error which I am not able to resolve:

 KeyGenerator keyGen = KeyGenerator.getInstance("AES");
      keyGen.init(256);
       
      // To test SSE-C
      ServerSideEncryption sse = ServerSideEncryption.withCustomerKey(keyGen.generateKey());

The error is **can not find symbol withCustomerKey(SecretKey) in class ServerSideEncryption ** I am using latest jar i.e. minio-8.2.1-all.jar but could not make it work.

  • I think that the code that you found is not compatible with recent versions of MinIO. It looks like it is compatible with MinIO version 5-ish. – Stephen C May 21 '21 at 09:58

1 Answers1

0

ServerSideEncryption.withCustomerKey is moved to a new class ServerSideEncryptionCustomerKey.

An example code

        KeyGenerator keyGen = KeyGenerator.getInstance("AES");
        keyGen.init(256);
        ServerSideEncryptionCustomerKey ssec =
            new ServerSideEncryptionCustomerKey(keyGen.generateKey());

More details can be found here https://github.com/minio/minio-java/blob/master/examples/DownloadObject.java

Kanagaraj M
  • 639
  • 5
  • 16