mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Just Keep RSA and AES
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.alibaba.druid.bvt.support.security;
|
||||
|
||||
import com.alibaba.druid.support.security.decryptor.AesDecrypterTest;
|
||||
import com.alibaba.druid.support.security.decryptor.BlowfishDecrypterTest;
|
||||
import com.alibaba.druid.support.security.decryptor.DesDecrypterTest;
|
||||
import com.alibaba.druid.support.security.decryptor.RsaDecrypterTest;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
@@ -13,9 +11,7 @@ import org.junit.runners.Suite;
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
AesDecrypterTest.class,
|
||||
DesDecrypterTest.class,
|
||||
RsaDecrypterTest.class,
|
||||
BlowfishDecrypterTest.class
|
||||
RsaDecrypterTest.class
|
||||
})
|
||||
public class DecrypterTestSuite {
|
||||
}
|
||||
|
||||
@@ -18,4 +18,12 @@ public class AesDecrypterTest {
|
||||
|
||||
Assert.assertEquals("It is not same.", "xiaoyu", parameters.getPassword());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecryptWithEmptyKey() throws DecryptException {
|
||||
AesDecrypter decrypter = new AesDecrypter();
|
||||
SensitiveParameters parameters = decrypter.decrypt(new SensitiveParameters("", "", "AzgdbVU3SIK6A8+0qg+Btg=="));
|
||||
|
||||
Assert.assertEquals("It is not same.", "xiaoyu", parameters.getPassword());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.alibaba.druid.support.security.decryptor;
|
||||
|
||||
import com.alibaba.druid.pool.DecryptException;
|
||||
import com.alibaba.druid.pool.SensitiveParameters;
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jonas Yang
|
||||
*/
|
||||
public class BlowfishDecrypterTest {
|
||||
|
||||
@Test
|
||||
public void testDecrypt() throws DecryptException {
|
||||
BlowfishDecrypter decrypter = new BlowfishDecrypter();
|
||||
SensitiveParameters parameters = decrypter.decrypt(new SensitiveParameters("", "", "64c5fd2979a86168"));
|
||||
|
||||
Assert.assertEquals("It is not same.", "123456", parameters.getPassword());
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.alibaba.druid.support.security.decryptor;
|
||||
|
||||
import com.alibaba.druid.pool.DecryptException;
|
||||
import com.alibaba.druid.pool.SensitiveParameters;
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Jonas Yang
|
||||
*/
|
||||
public class DesDecrypterTest {
|
||||
|
||||
@Test
|
||||
public void testDecrypt() throws DecryptException {
|
||||
DesDecrypter decrypter = new DesDecrypter();
|
||||
decrypter.setKey("123456");
|
||||
SensitiveParameters parameters = decrypter.decrypt(new SensitiveParameters("", "", "rIsr38vJDyQ="));
|
||||
|
||||
Assert.assertEquals("It is not same", parameters.getPassword(), "xiaoyu");
|
||||
}
|
||||
}
|
||||
@@ -61,4 +61,12 @@ public class RsaDecrypterTest {
|
||||
Assert.assertEquals("It is not same.", "xiaoyu", parameters.getPassword());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecryptWithEmptyKey() throws DecryptException {
|
||||
RsaDecrypter decrypter = new RsaDecrypter();
|
||||
SensitiveParameters parameters = decrypter.decrypt(new SensitiveParameters("", "", "OJfUm6WCHi7EuXqE6aEc+Po2xFrAGBeSNy8O2jWhV2FTG8/5kbRRr2rjNKhptlevm/03Y0048P7h88gdUOXAYg=="));
|
||||
|
||||
Assert.assertEquals("It is not same.", "xiaoyu", parameters.getPassword());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user