parent
17329dfe02
commit
dc5a3ce852
|
@ -8,10 +8,7 @@ import org.junit.Test;
|
|||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
|
@ -99,30 +96,30 @@ public class CryptoHelperTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void t5_aes256EncryptionTest() throws IOException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException {
|
||||
public void t5_aes256EncryptionTest() throws IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException {
|
||||
InputStream is = ClassLoader.getSystemResourceAsStream("git.properties");
|
||||
assert is != null;
|
||||
String password = "";
|
||||
String password;
|
||||
String testEncValue = "hkoUV5ZWh0q1jSxMnpjovVn19Qg99HY6DD40";
|
||||
String testEncValue1 = "P3mq9iSIvQcvfyfdWR8sAnfAadO";
|
||||
String testEncValue2 = "h0K0_8u";
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
log.info("Version Information:");
|
||||
while (true) {
|
||||
String val = reader.readLine();
|
||||
log.info("{}", val);
|
||||
// BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
// log.info("Version Information:");
|
||||
// while (true) {
|
||||
// String val = reader.readLine();
|
||||
// log.info("{}", val);
|
||||
//
|
||||
// if (val == null) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if (val.startsWith("git.commit.id=")) {
|
||||
// password = val.substring("git.commit.id=".length());
|
||||
// }
|
||||
// }
|
||||
|
||||
if (val == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (val.startsWith("git.commit.id=")) {
|
||||
password = val.substring("git.commit.id=".length());
|
||||
}
|
||||
}
|
||||
|
||||
password = password + "cmcc@10086!";
|
||||
password = "63debfca1d2dc72af38014a7bb6f567202cc1345" + "cmcc@10086!";
|
||||
|
||||
byte[] encode = CryptoHelper.aes256Encryption(testEncValue.getBytes(StandardCharsets.UTF_8), password);
|
||||
Assert.assertEquals(CryptoHelper.base64Encryption(encode), "Trf2LEETes3oKnY1CF7LINcm2KlJbJxHIyvERz2174CTzQEhJtuo+PnO+fR3eDf+");
|
||||
|
|
Loading…
Reference in New Issue