Updated Libraries
All checks were successful
Locusworks Team/crypto/pipeline/head This commit looks good
All checks were successful
Locusworks Team/crypto/pipeline/head This commit looks good
This commit is contained in:
49
pom.xml
49
pom.xml
@ -21,7 +21,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<license-maven-plugin.version>3.0</license-maven-plugin.version>
|
<license-maven-plugin.version>4.1</license-maven-plugin.version>
|
||||||
<nexus.repo>https://nexus.locusworks.net</nexus.repo>
|
<nexus.repo>https://nexus.locusworks.net</nexus.repo>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.20.1</version>
|
<version>3.0.0-M5</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkMode>always</forkMode>
|
<forkMode>always</forkMode>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -38,22 +38,20 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${maven.compiler.source}</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>${maven.compiler.target}</target>
|
<target>${maven.compiler.target}</target>
|
||||||
|
<failOnError>true</failOnError>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-Xlint:all</arg>
|
||||||
|
</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.owasp</groupId>
|
<groupId>org.owasp</groupId>
|
||||||
<artifactId>dependency-check-maven</artifactId>
|
<artifactId>dependency-check-maven</artifactId>
|
||||||
<version>5.2.2</version>
|
<version>6.3.1</version>
|
||||||
<configuration>
|
|
||||||
<skipProvidedScope>true</skipProvidedScope>
|
|
||||||
<skipTestScope>true</skipTestScope>
|
|
||||||
<failOnError>false</failOnError>
|
|
||||||
<versionCheckEnabled>true</versionCheckEnabled>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
@ -67,13 +65,14 @@
|
|||||||
<artifactId>license-maven-plugin</artifactId>
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
<version>${license-maven-plugin.version}</version>
|
<version>${license-maven-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<quiet>false</quiet>
|
<licenseSets>
|
||||||
<header>${basedir}/licenses/LICENSE.template</header>
|
<licenseSet>
|
||||||
<strictCheck>true</strictCheck>
|
<header>${project.baseUri}/licenses/LICENSE.template</header>
|
||||||
<useDefaultExcludes>true</useDefaultExcludes>
|
<includes>
|
||||||
<includes>
|
<include>**/*.java</include>
|
||||||
<include>**/*.java</include>
|
</includes>
|
||||||
</includes>
|
</licenseSet>
|
||||||
|
</licenseSets>
|
||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- this dependency allows ${license.git.copyrightLastYear} in the
|
<!-- this dependency allows ${license.git.copyrightLastYear} in the
|
||||||
@ -90,25 +89,27 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>4.12</version>
|
<version>5.8.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.6</version>
|
<version>2.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
|
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
<version>1.14</version>
|
<version>1.15</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
@ -116,14 +117,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>28.1-jre</version>
|
<version>30.1.1-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.9</version>
|
<version>3.12.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: AES.java
|
* Project: Crypto, File: AES.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: AESKey.java
|
* Project: Crypto, File: AESKey.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: AESKeySpec.java
|
* Project: Crypto, File: AESKeySpec.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: EncryptionKeyFactory.java
|
* Project: Crypto, File: EncryptionKeyFactory.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: HashSalt.java
|
* Project: Crypto, File: HashSalt.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: KeyFile.java
|
* Project: Crypto, File: KeyFile.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: RSA.java
|
* Project: Crypto, File: RSA.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: SSHEncodedKeySpec.java
|
* Project: Crypto, File: SSHEncodedKeySpec.java
|
||||||
*
|
*
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Project: Crypto, File: ConfigurationCallback.java
|
||||||
|
*
|
||||||
|
* Copyright 2019 Locusworks LLC.
|
||||||
|
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
||||||
|
* any means and imposes fines up to $25,000 for violation. No part of this material
|
||||||
|
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
||||||
|
* modified, duplicated, adapted or translated into another program language in any
|
||||||
|
* form or by any means, electronic, mechanical, photocopying, recording, or
|
||||||
|
* otherwise, without the prior written permission from Locusworks. Locusworks
|
||||||
|
* affirms that Crypto(R) software and data is subject to United States
|
||||||
|
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
|
||||||
|
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
||||||
|
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
|
||||||
|
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
|
||||||
|
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
|
||||||
|
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
|
||||||
|
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
package net.locusworks.crypto.configuration;
|
package net.locusworks.crypto.configuration;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Project: Crypto, File: ConfigurationManager.java
|
||||||
|
*
|
||||||
|
* Copyright 2019 Locusworks LLC.
|
||||||
|
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
||||||
|
* any means and imposes fines up to $25,000 for violation. No part of this material
|
||||||
|
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
||||||
|
* modified, duplicated, adapted or translated into another program language in any
|
||||||
|
* form or by any means, electronic, mechanical, photocopying, recording, or
|
||||||
|
* otherwise, without the prior written permission from Locusworks. Locusworks
|
||||||
|
* affirms that Crypto(R) software and data is subject to United States
|
||||||
|
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
|
||||||
|
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
||||||
|
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
|
||||||
|
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
|
||||||
|
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
|
||||||
|
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
|
||||||
|
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
package net.locusworks.crypto.configuration;
|
package net.locusworks.crypto.configuration;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Project: Crypto, File: PersistableRequest.java
|
||||||
|
*
|
||||||
|
* Copyright 2019 Locusworks LLC.
|
||||||
|
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
||||||
|
* any means and imposes fines up to $25,000 for violation. No part of this material
|
||||||
|
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
||||||
|
* modified, duplicated, adapted or translated into another program language in any
|
||||||
|
* form or by any means, electronic, mechanical, photocopying, recording, or
|
||||||
|
* otherwise, without the prior written permission from Locusworks. Locusworks
|
||||||
|
* affirms that Crypto(R) software and data is subject to United States
|
||||||
|
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
|
||||||
|
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
||||||
|
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
|
||||||
|
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
|
||||||
|
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
|
||||||
|
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
|
||||||
|
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
package net.locusworks.crypto.configuration;
|
package net.locusworks.crypto.configuration;
|
||||||
|
|
||||||
public interface PersistableRequest {
|
public interface PersistableRequest {
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Project: Crypto, File: PropertiesManager.java
|
||||||
|
*
|
||||||
|
* Copyright 2019 Locusworks LLC.
|
||||||
|
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
||||||
|
* any means and imposes fines up to $25,000 for violation. No part of this material
|
||||||
|
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
||||||
|
* modified, duplicated, adapted or translated into another program language in any
|
||||||
|
* form or by any means, electronic, mechanical, photocopying, recording, or
|
||||||
|
* otherwise, without the prior written permission from Locusworks. Locusworks
|
||||||
|
* affirms that Crypto(R) software and data is subject to United States
|
||||||
|
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
|
||||||
|
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
||||||
|
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
|
||||||
|
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
|
||||||
|
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
|
||||||
|
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
|
||||||
|
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
package net.locusworks.crypto.configuration;
|
package net.locusworks.crypto.configuration;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: package-info.java
|
* Project: Crypto, File: package-info.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: DataOutputStreamHelper.java
|
* Project: Crypto, File: DataOutputStreamHelper.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: HashUtils.java
|
* Project: Crypto, File: HashUtils.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: RandomString.java
|
* Project: Crypto, File: RandomString.java
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: AESEncryptionTest.java
|
* Project: Crypto, File: AESEncryptionTest.java
|
||||||
*
|
*
|
||||||
@ -28,8 +28,8 @@
|
|||||||
package net.locusworks.crypto.tests;
|
package net.locusworks.crypto.tests;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import net.locusworks.crypto.AES;
|
import net.locusworks.crypto.AES;
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ public class AESEncryptionTest {
|
|||||||
public void testEncryption() {
|
public void testEncryption() {
|
||||||
try {
|
try {
|
||||||
String encrypted = AES.createInstance().encrypt("hello world");
|
String encrypted = AES.createInstance().encrypt("hello world");
|
||||||
Assert.assertTrue(String.format("Encrypted String is not blank? :%s", encrypted), !StringUtils.isBlank(encrypted));
|
assertTrue(StringUtils.isNotBlank(encrypted), String.format("Encrypted String is not blank? :%s", encrypted));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace(System.err);
|
ex.printStackTrace(System.err);
|
||||||
Assert.fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,16 +52,18 @@ public class AESEncryptionTest {
|
|||||||
try {
|
try {
|
||||||
AES aes = AES.createInstance();
|
AES aes = AES.createInstance();
|
||||||
String encrypted = aes.encrypt(testString);
|
String encrypted = aes.encrypt(testString);
|
||||||
Assert.assertTrue(String.format("Encrypted String is not blank? :%s", encrypted), !StringUtils.isBlank(encrypted));
|
assertTrue(StringUtils.isNotBlank(encrypted), String.format("Encrypted String is not blank? :%s", encrypted));
|
||||||
|
|
||||||
String decrypted = aes.decrypt(encrypted);
|
String decrypted = aes.decrypt(encrypted);
|
||||||
Assert.assertTrue(String.format("Decrypted String is not blank? :%s", decrypted), !StringUtils.isBlank(encrypted));
|
assertTrue(StringUtils.isNotBlank(encrypted), String.format("Decrypted String is not blank? :%s", decrypted));
|
||||||
|
|
||||||
Assert.assertTrue("Test String and Original String the same? :%s", testString.equals(decrypted));
|
boolean same = testString.equals(decrypted);
|
||||||
|
|
||||||
|
assertTrue(same, String.format("Test String and Original String the same? :%s", same));
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace(System.err);
|
ex.printStackTrace(System.err);
|
||||||
Assert.fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: HashSaltTest.java
|
* Project: Crypto, File: HashSaltTest.java
|
||||||
*
|
*
|
||||||
@ -28,35 +28,35 @@
|
|||||||
package net.locusworks.crypto.tests;
|
package net.locusworks.crypto.tests;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import net.locusworks.crypto.HashSalt;
|
import net.locusworks.crypto.HashSalt;
|
||||||
|
|
||||||
|
|
||||||
public class HashSaltTest {
|
public class HashSaltTest {
|
||||||
|
|
||||||
private static String samplePassword="Hello World";
|
private static String samplePassword="Hello World";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncryption() {
|
public void testEncryption() {
|
||||||
try {
|
try {
|
||||||
String hashSalt = HashSalt.createHash(samplePassword);
|
String hashSalt = HashSalt.createHash(samplePassword);
|
||||||
Assert.assertTrue(String.format("Encrypted String is not blank? :%s", hashSalt), !StringUtils.isBlank(hashSalt));
|
assertTrue(StringUtils.isNotBlank(hashSalt), String.format("Encrypted String is not blank? :%s", hashSalt));
|
||||||
} catch(Exception ex) {
|
} catch(Exception ex) {
|
||||||
Assert.fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDecryption() {
|
public void testDecryption() {
|
||||||
try {
|
try {
|
||||||
String hashSalt = HashSalt.createHash(samplePassword);
|
String hashSalt = HashSalt.createHash(samplePassword);
|
||||||
boolean decrypted = HashSalt.validatePassword(samplePassword, hashSalt);
|
boolean decrypted = HashSalt.validatePassword(samplePassword, hashSalt);
|
||||||
Assert.assertTrue("Test String and Original String the same? :%s", decrypted);
|
assertTrue(decrypted, String.format("Test String and Original String the same? :%s", decrypted));
|
||||||
} catch(Exception ex) {
|
} catch(Exception ex) {
|
||||||
Assert.fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: HashUtilsTest.java
|
* Project: Crypto, File: HashUtilsTest.java
|
||||||
*
|
*
|
||||||
@ -27,10 +27,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.locusworks.crypto.tests;
|
package net.locusworks.crypto.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import net.locusworks.crypto.utils.HashUtils;
|
import net.locusworks.crypto.utils.HashUtils;
|
||||||
|
|
||||||
|
@ -1,6 +1,35 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Project: Crypto, File: PropertiesManagerTest.java
|
||||||
|
*
|
||||||
|
* Copyright 2019 Locusworks LLC.
|
||||||
|
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
||||||
|
* any means and imposes fines up to $25,000 for violation. No part of this material
|
||||||
|
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
||||||
|
* modified, duplicated, adapted or translated into another program language in any
|
||||||
|
* form or by any means, electronic, mechanical, photocopying, recording, or
|
||||||
|
* otherwise, without the prior written permission from Locusworks. Locusworks
|
||||||
|
* affirms that Crypto(R) software and data is subject to United States
|
||||||
|
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
|
||||||
|
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
||||||
|
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
||||||
|
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
|
||||||
|
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
|
||||||
|
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
|
||||||
|
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
|
||||||
|
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||||
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
package net.locusworks.crypto.tests;
|
package net.locusworks.crypto.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -8,8 +37,6 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import net.locusworks.crypto.configuration.PropertiesManager;
|
import net.locusworks.crypto.configuration.PropertiesManager;
|
||||||
|
|
||||||
@ -51,7 +78,7 @@ public class PropertiesManagerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterAll
|
||||||
public static void removeSavedProps() {
|
public static void removeSavedProps() {
|
||||||
File tmp = new File(TMP_PROPS);
|
File tmp = new File(TMP_PROPS);
|
||||||
if (tmp.exists()) {
|
if (tmp.exists()) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/*
|
||||||
*
|
*
|
||||||
* Project: Crypto, File: RandomStringTest.java
|
* Project: Crypto, File: RandomStringTest.java
|
||||||
*
|
*
|
||||||
@ -27,9 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
package net.locusworks.crypto.tests;
|
package net.locusworks.crypto.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import net.locusworks.crypto.utils.RandomString;
|
import net.locusworks.crypto.utils.RandomString;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user