"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "examples/java_src/gcs/GcsEnvelopeAeadExample.java" between
tink-1.6.0.tar.gz and tink-1.6.1.tar.gz

About: Tink is a cryptographic library that provides a safe, simple and agile API for common cryptographic tasks, like symmetric encryption, message authentication, digital signatures, and hybrid encryption.

GcsEnvelopeAeadExample.java  (tink-1.6.0):GcsEnvelopeAeadExample.java  (tink-1.6.1)
skipping to change at line 127 skipping to change at line 127
.build() .build()
.getService(); .getService();
// Use the primitive to encrypt/decrypt files. // Use the primitive to encrypt/decrypt files.
if (MODE_ENCRYPT.equals(mode)) { if (MODE_ENCRYPT.equals(mode)) {
// Encrypt the local file // Encrypt the local file
byte[] input = Files.readAllBytes(Paths.get(args[4])); byte[] input = Files.readAllBytes(Paths.get(args[4]));
String gcsBlobPath = args[5]; String gcsBlobPath = args[5];
// This will bind the encryption to the location of the GCS blob. That if, if you rename or // This will bind the encryption to the location of the GCS blob. That if, if you rename or
// move the blob to a different bucket, decryption will fail. // move the blob to a different bucket, decryption will fail.
// See https://developers.google.com/tink/AEAD#associated_data. // See https://developers.google.com/tink/aead#associated_data.
byte[] associatedData = gcsBlobPath.getBytes(UTF_8); byte[] associatedData = gcsBlobPath.getBytes(UTF_8);
byte[] ciphertext = aead.encrypt(input, associatedData); byte[] ciphertext = aead.encrypt(input, associatedData);
// Upload to GCS // Upload to GCS
String bucketName = getBucketName(gcsBlobPath); String bucketName = getBucketName(gcsBlobPath);
String objectName = getObjectName(gcsBlobPath); String objectName = getObjectName(gcsBlobPath);
BlobId blobId = BlobId.of(bucketName, objectName); BlobId blobId = BlobId.of(bucketName, objectName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
storage.create(blobInfo, ciphertext); storage.create(blobInfo, ciphertext);
} else if (MODE_DECRYPT.equals(mode)) { } else if (MODE_DECRYPT.equals(mode)) {
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)