'How to do server side encryption while uploading file in MinIO using Java
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.
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kanagaraj M |