From 66cb41c4f502f84c1f3b30d6fd8b4771d4af15b0 Mon Sep 17 00:00:00 2001 From: SendSafely Date: Wed, 9 Dec 2020 15:14:09 -0500 Subject: [PATCH] v3.1.7 - Remove JDK8 dependency - Fix filename bug in DownloadAndDecryptFileHander --- SendSafelyAPI/README.md | 4 ++-- SendSafelyAPI/pom.xml | 2 +- SendSafelyAPI/src/com/sendsafely/BasePackage.java | 9 +++++++++ SendSafelyAPI/src/com/sendsafely/File.java | 9 +++++++++ .../com/sendsafely/handlers/CreatePackageHandler.java | 7 ------- .../handlers/DownloadAndDecryptFileHandler.java | 6 +++--- SendSafelyAPI/src/com/sendsafely/utils/CryptoUtil.java | 4 ++-- 7 files changed, 26 insertions(+), 15 deletions(-) diff --git a/SendSafelyAPI/README.md b/SendSafelyAPI/README.md index 8130544..bd06142 100644 --- a/SendSafelyAPI/README.md +++ b/SendSafelyAPI/README.md @@ -6,8 +6,8 @@ Use the following dependency in your project to grab via Maven: com.sendsafely sendsafely-java-api - 3.1.6 + 3.1.7 ``` -Refer to the SendSafely [Java-Client-API/SampleApplication](https://github.com/SendSafely/Java-Client-API/tree/master/SampleApplication) for a quick start with using the Java Client API. +Refer to the SendSafely [Java-Client-API/SampleApplication](https://github.com/SendSafely/Java-Client-API/tree/master/SampleApplication) for a quick start with using the Java Client API. \ No newline at end of file diff --git a/SendSafelyAPI/pom.xml b/SendSafelyAPI/pom.xml index e2559a9..302ae8d 100644 --- a/SendSafelyAPI/pom.xml +++ b/SendSafelyAPI/pom.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma com.sendsafely sendsafely-java-api - 3.1.6 + 3.1.7 jar SendSafely Java Client API diff --git a/SendSafelyAPI/src/com/sendsafely/BasePackage.java b/SendSafelyAPI/src/com/sendsafely/BasePackage.java index 58911e4..594d0ee 100644 --- a/SendSafelyAPI/src/com/sendsafely/BasePackage.java +++ b/SendSafelyAPI/src/com/sendsafely/BasePackage.java @@ -274,10 +274,19 @@ public void setPackageParentId(String packageParentId) { this.packageParentId = packageParentId; } + /** + * @description Returns boolean flag if the allowReplyAll flag is set on the package. + * @returnType boolean + * @return Flag representing the value of allow reply all. + */ public boolean isAllowReplyAll() { return allowReplyAll; } + /** + * @description Set internally by the API. + * @param allowReplyAll + */ public void setAllowReplyAll(boolean allowReplyAll) { this.allowReplyAll = allowReplyAll; } diff --git a/SendSafelyAPI/src/com/sendsafely/File.java b/SendSafelyAPI/src/com/sendsafely/File.java index 8a8bdea..5051c93 100644 --- a/SendSafelyAPI/src/com/sendsafely/File.java +++ b/SendSafelyAPI/src/com/sendsafely/File.java @@ -105,10 +105,19 @@ public void setParts(int parts) { this.parts = parts; } + /** + * @description Returns the Date object representing when the file was uploaded + * @returnType Date + * @return A Date representing when the file was upload + */ public Date getFileUploaded() { return fileUploaded; } + /** + * @description Set internally by the API. + * @param fileUploaded + */ public void setFileUploaded(Date fileUploaded) { this.fileUploaded = fileUploaded; } diff --git a/SendSafelyAPI/src/com/sendsafely/handlers/CreatePackageHandler.java b/SendSafelyAPI/src/com/sendsafely/handlers/CreatePackageHandler.java index e310b9b..b5ab404 100644 --- a/SendSafelyAPI/src/com/sendsafely/handlers/CreatePackageHandler.java +++ b/SendSafelyAPI/src/com/sendsafely/handlers/CreatePackageHandler.java @@ -3,12 +3,6 @@ import java.io.IOException; import java.util.ArrayList; -import javax.xml.bind.DatatypeConverter; - -import org.bouncycastle.util.encoders.Base64Encoder; -import org.bouncycastle.util.encoders.UrlBase64; -import org.bouncycastle.util.encoders.UrlBase64Encoder; - import com.sendsafely.ContactGroup; import com.sendsafely.File; import com.sendsafely.Package; @@ -17,7 +11,6 @@ import com.sendsafely.dto.response.CreatePackageResponse; import com.sendsafely.enums.APIResponse; import com.sendsafely.enums.Endpoint; -import com.sendsafely.enums.HTTPMethod; import com.sendsafely.exceptions.CreatePackageFailedException; import com.sendsafely.exceptions.LimitExceededException; import com.sendsafely.exceptions.PackageInformationFailedException; diff --git a/SendSafelyAPI/src/com/sendsafely/handlers/DownloadAndDecryptFileHandler.java b/SendSafelyAPI/src/com/sendsafely/handlers/DownloadAndDecryptFileHandler.java index 7a307d7..aa980a5 100644 --- a/SendSafelyAPI/src/com/sendsafely/handlers/DownloadAndDecryptFileHandler.java +++ b/SendSafelyAPI/src/com/sendsafely/handlers/DownloadAndDecryptFileHandler.java @@ -348,10 +348,10 @@ private OutputStream getOutputStream(java.io.File newFile) throws DownloadFileEx } } - private java.io.File createTempFile(File file) throws DownloadFileException - { + private java.io.File createTempFile(File file) throws DownloadFileException { + String filename = file.getFileName().replaceAll("[<>:\"/\\\\|?*]", "_"); try { - return java.io.File.createTempFile(file.getFileName(), ""); + return java.io.File.createTempFile(filename, ""); } catch (IOException e) { throw new DownloadFileException(e); } diff --git a/SendSafelyAPI/src/com/sendsafely/utils/CryptoUtil.java b/SendSafelyAPI/src/com/sendsafely/utils/CryptoUtil.java index a0750a5..6d4c8b9 100644 --- a/SendSafelyAPI/src/com/sendsafely/utils/CryptoUtil.java +++ b/SendSafelyAPI/src/com/sendsafely/utils/CryptoUtil.java @@ -18,7 +18,6 @@ import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import javax.xml.bind.DatatypeConverter; import org.bouncycastle.bcpg.ArmoredOutputStream; import org.bouncycastle.crypto.AsymmetricCipherKeyPair; @@ -101,7 +100,8 @@ public static String Sign(String key, String dataToSign) throws SignatureCreatio byte[] rawHmac = mac.doFinal(dataToSign.getBytes()); // Hex encode and return - return DatatypeConverter.printHexBinary(rawHmac); + + return Hex.toHexString(rawHmac); } public static String GenerateKeyCode() throws TokenGenerationFailedException