本文整理汇总了Java中org.oscm.encrypter.AESEncrypter.generateKey方法的典型用法代码示例。如果您正苦于以下问题:Java AESEncrypter.generateKey方法的具体用法?Java AESEncrypter.generateKey怎么用?Java AESEncrypter.generateKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.oscm.encrypter.AESEncrypter
的用法示例。
在下文中一共展示了AESEncrypter.generateKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Override
public void setup(final TestContainer container) throws Exception {
AESEncrypter.generateKey();
container.login(USER_GUEST);
container.addBean(new ConfigurationServiceStub());
container.addBean(new DataServiceBean());
mgr = container.get(DataService.class);
runTX(new Callable<Void>() {
@Override
public Void call() throws Exception {
createPaymentTypes(mgr);
dataSetup();
return null;
}
});
}
示例2: toObject
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Test
public void toObject() throws Exception {
AESEncrypter.generateKey();
// given
Map<String, String> map = new HashMap<>();
map.put("a", "a1");
map.put("b", "b1");
String xml = XMLSerializer.toXml(map);
// when
Map<String, String> map2 = (Map<String, String>) XMLSerializer
.toObject(xml);
// then
assertEquals(map.size(), map2.size());
assertTrue(map2.containsKey("a"));
assertTrue(map2.containsKey("b"));
assertEquals("a1", map2.get("a"));
assertEquals("b1", map2.get("b"));
}
示例3: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
AESEncrypter.generateKey();
SUT = stubSUT();
connection = mock(Connection.class);
tppStatement = mock(PreparedStatement.class);
paramStatement = mock(PreparedStatement.class);
updateStatement = mock(PreparedStatement.class);
mockStatementBuilder();
SUT.setConnection(connection);
SUT.setStatementBuilder(statementBuilder);
doReturn(tppStatement).when(connection).prepareStatement(
MigrateTriggerProcessParameters.QUERY_ALL_PRODUCT_PARAMETERS);
doReturn(paramStatement).when(connection).prepareStatement(
MigrateTriggerProcessParameters.QUERY_IS_CONFIGURABLE_PARAMETER);
doReturn(updateStatement).when(connection).prepareStatement(
MigrateTriggerProcessParameters.UPDATE_PRODUCT_PARAMETER);
doReturn(Integer.valueOf(0)).when(updateStatement).executeUpdate();
}
示例4: toXml
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Test
public void toXml() throws Exception {
AESEncrypter.generateKey();
// given
Map<String, String> map = new HashMap<>();
map.put("a", "a1");
map.put("b", "b1");
// when
String xml = XMLSerializer.toXml(map);
xml = AESEncrypter.decrypt(xml);
// then
assertTrue(xml.contains("a"));
assertTrue(xml.contains("a1"));
assertTrue(xml.contains("b"));
assertTrue(xml.contains("b1"));
}
示例5: toObjectUnencrypted
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Test
public void toObjectUnencrypted() throws Exception {
AESEncrypter.generateKey();
// given
Map<String, String> map = new HashMap<>();
map.put("a", "a1");
map.put("b", "b1");
String xml = XMLSerializer.toXml(map);
String decrypted = AESEncrypter.decrypt(xml);
// when
Map<String, String> map2 = (Map<String, String>) XMLSerializer
.toObject(decrypted);
// then
assertEquals(map.size(), map2.size());
assertTrue(map2.containsKey("a"));
assertTrue(map2.containsKey("b"));
assertEquals("a1", map2.get("a"));
assertEquals("b1", map2.get("b"));
}
示例6: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Before
public void setup() {
AESEncrypter.generateKey();
tppd = new TriggerProcessParameterData();
tppd.setName(TriggerProcessParameterName.PRODUCT);
svc = new VOService();
}
示例7: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Override
protected void setup(TestContainer container) throws Exception {
AESEncrypter.generateKey();
container.enableInterfaceMocking(true);
triggerQueueServiceLocal = mock(TriggerQueueServiceLocal.class);
cs = Mockito.spy(new ConfigurationServiceStub());
container.addBean(cs);
container.addBean(triggerQueueServiceLocal);
container.addBean(new DataServiceBean());
IdentityServiceLocal identityServiceBean = new IdentityServiceBean();
container.addBean(identityServiceBean);
identityService = container.get(IdentityService.class);
ConfigurationSetting setting = new ConfigurationSetting(
ConfigurationKey.AUTH_MODE, Configuration.GLOBAL_CONTEXT,
"INTERNAL");
doReturn(setting).when(cs).getConfigurationSetting(
any(ConfigurationKey.class), anyString());
ds = container.get(DataService.class);
doAnswer(new Answer<List<TriggerProcessMessageData>>() {
@Override
public List<TriggerProcessMessageData> answer(
InvocationOnMock invocation) throws Throwable {
return Collections.singletonList(triggerProcessData);
}
}).when(triggerQueueServiceLocal)
.sendSuspendingMessages(anyListOf(TriggerMessage.class));
}
示例8: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Override
protected void setup(TestContainer container) throws Exception {
AESEncrypter.generateKey();
addBeansToContainer(container);
mgr = container.get(DataService.class);
subMgmt = container.get(SubscriptionService.class);
localizer = container.get(LocalizerServiceLocal.class);
createOrganizations();
createUsers();
createTechnicalProducts();
createProducts();
}
示例9: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Override
protected void setup(TestContainer container) throws Exception {
AESEncrypter.generateKey();
asb = new AccountServiceBean();
container.addBean(new ConfigurationServiceStub());
asb.dm = mock(DataService.class);
}
示例10: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Override
protected void setup(TestContainer container) throws Exception {
AESEncrypter.generateKey();
container.enableInterfaceMocking(true);
TriggerQueueServiceLocal triggerQueueServiceLocal = mock(
TriggerQueueServiceLocal.class);
container.addBean(triggerQueueServiceLocal);
container.addBean(new ConfigurationServiceStub());
container.addBean(new DataServiceBean());
AccountServiceBean accountServiceBean = spy(new AccountServiceBean());
container.addBean(accountServiceBean);
accountService = container.get(AccountService.class);
ds = container.get(DataService.class);
doAnswer(new Answer<List<TriggerProcessMessageData>>() {
@Override
public List<TriggerProcessMessageData> answer(
InvocationOnMock invocation) throws Throwable {
return Collections.singletonList(triggerProcessData);
}
}).when(triggerQueueServiceLocal)
.sendSuspendingMessages(anyListOf(TriggerMessage.class));
doReturn(null).when(accountServiceBean)
.registerKnownCustomerInt(any(TriggerProcess.class));
doNothing().when(accountServiceBean)
.savePaymentConfigurationInt(any(TriggerProcess.class));
}
示例11: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Override
protected void setup(TestContainer container) throws Exception {
AESEncrypter.generateKey();
container.enableInterfaceMocking(true);
container.login("1");
container.addBean(new DataServiceBean());
container.addBean(new IdentityServiceBean());
ds = container.get(DataService.class);
is = container.get(IdentityService.class);
userKey = runTX(new Callable<Long>() {
@Override
public Long call() throws Exception {
createOrganizationRoles(ds);
createUserRoles(ds);
Organization org = Organizations.createOrganization(ds,
OrganizationRoleType.CUSTOMER,
OrganizationRoleType.SUPPLIER,
OrganizationRoleType.TECHNOLOGY_PROVIDER);
final PlatformUser user = Organizations.createUserForOrg(ds,
org, true, "admin");
return Long.valueOf(user.getKey());
}
}).longValue();
}
示例12: testEncryptSettingsWithPrefix
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Test
public void testEncryptSettingsWithPrefix() throws Exception {
AESEncrypter.generateKey();
byte[] key = AESEncrypter.getKey();
Files.write(file.toPath(), key, StandardOpenOption.CREATE_NEW,
StandardOpenOption.WRITE);
createContorllerConfigSetting("ctrlId", "key_crypt_PWD",
"_crypt:secret");
final Long siKey = createServiceInstanceWithAttributesAndParameters(
"orgId", "subId", "ctrlId", "key",
AESEncrypter.encrypt("secret"), true);
PlatformConfigurationKey[] keys = PlatformConfigurationKey.values();
for (int i = 0; i < keys.length; i++) {
if (keys[i] != PlatformConfigurationKey.APP_KEY_PATH) {
String value = "testValue";
if (keys[i].name().endsWith(PasswordSetup.CRYPT_KEY_SUFFIX)
|| keys[i].name().endsWith(
PasswordSetup.CRYPT_KEY_SUFFIX_PASS)) {
value = AESEncrypter.encrypt(value);
}
createConfigSetting(keys[i].name(), value);
}
}
createContorllerConfigSetting("ctrlId",
ControllerConfigurationKey.BSS_USER_KEY.name(), "key");
createContorllerConfigSetting("ctrlId",
ControllerConfigurationKey.BSS_USER_ID.name(), "name");
createContorllerConfigSetting("ctrlId",
ControllerConfigurationKey.BSS_USER_PWD.name(),
AESEncrypter.encrypt("secret"));
createContorllerConfigSetting("ctrlId",
ControllerConfigurationKey.BSS_ORGANIZATION_ID.name(), "orgId");
ProvisioningSettings settings = runTX(
new Callable<ProvisioningSettings>() {
@Override
public ProvisioningSettings call() throws Exception {
PwdSetup setup = new PwdSetup();
setup.em = em;
setup.config = config;
setup.startUp();
ServiceInstance instance = em
.getReference(ServiceInstance.class, siKey);
return config.getProvisioningSettings(instance, null);
}
});
assertEquals("secret",
settings.getConfigSettings().get("key_crypt_PWD").getValue());
assertEquals("secret", settings.getAttributes().get("key").getValue());
assertEquals("secret", settings.getParameters().get("key").getValue());
}
示例13: setup
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void setup(TestContainer container) throws Exception {
AESEncrypter.generateKey();
container.addBean(configService = Mockito
.mock(APPConfigurationServiceBean.class));
container.addBean(Mockito.mock(ServiceInstanceDAO.class));
container.addBean(Mockito.mock(APPConcurrencyServiceBean.class));
container.addBean(
Mockito.mock(ProductProvisioningServiceFactoryBean.class));
container.addBean(Mockito.mock(APPCommunicationServiceBean.class));
serviceMock = Mockito.mock(Service.class);
besDAO = Mockito.mock(BesDAO.class);
subcriptionService = Mockito.mock(SubscriptionService.class);
identityService = Mockito.mock(EnhancedIdentityService.class);
Mockito.doReturn(Arrays.asList(new VOUserDetails())).when(besDAO)
.getBESTechnologyManagers(any(ServiceInstance.class));
Mockito.doReturn(identityService).when(besDAO).getBESWebService(
Matchers.eq(IdentityService.class),
any(ServiceInstance.class), any(Optional.class));
Mockito.doNothing().when(besDAO).setUserCredentialsInContext(
any(BindingProvider.class), anyString(),
anyString(), Matchers.anyMap());
Mockito.doReturn(subcriptionService).when(besDAO).getBESWebService(
Matchers.eq(SubscriptionService.class),
any(ServiceInstance.class), any(Optional.class));
Mockito.doNothing().when(subcriptionService).completeAsyncSubscription(
anyString(), anyString(),
any(VOInstanceInfo.class));
Mockito.doNothing().when(subcriptionService).abortAsyncSubscription(
anyString(), anyString(),
Matchers.anyListOf(VOLocalizedText.class));
Mockito.doReturn(subcriptionService).when(serviceMock).getPort(
any(QName.class),
Matchers.eq(SubscriptionService.class));
Mockito.doReturn(serviceMock).when(besDAO).createWebService(
any(URL.class), any(QName.class));
Mockito.doReturn(identityService).when(serviceMock).getPort(
any(QName.class), Matchers.eq(IdentityService.class));
container.addBean(besDAO);
container.addBean(Mockito.mock(OperationDAO.class));
container.addBean(Mockito.mock(ServiceInstanceDAO.class));
container.addBean(Mockito.mock(OperationServiceBean.class));
container.addBean(
authService = Mockito.spy(new APPAuthenticationServiceBean()));
container.addBean(Mockito.mock(OperationServiceBean.class));
container.addBean(new APPlatformServiceBean());
controller = Mockito.mock(APPlatformController.class);
InitialContext context = new InitialContext();
context.bind("bss/app/controller/ess.vmware", controller);
container.addBean(controller);
besDAO = container.get(BesDAO.class);
platformService = container.get(APPlatformServiceBean.class);
em = container.getPersistenceUnit("oscm-app");
defaultAuth = new PasswordAuthentication("user", "password");
}
示例14: setUp
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
AESEncrypter.generateKey();
voService = new VOService();
voService.setTechnicalId("techId");
voService.setName("serviceName");
VOOrganization voOrg = new VOOrganization();
voOrg.setOrganizationId("voOrgId");
voOrg.setName("orgName");
paymentConfig = new VOOrganizationPaymentConfiguration();
paymentConfig.setOrganization(voOrg);
Organization organization = new Organization();
organization.setOrganizationId("organizationId");
PlatformUser user = new PlatformUser();
user.setKey(44);
user.setOrganization(organization);
user.setUserId("userId");
user.setStatus(UserAccountStatus.ACTIVE);
triggerProcess = new TriggerProcess();
triggerProcess.setActivationDate(123);
triggerProcess.setKey(11);
triggerProcess.setState(TriggerProcessStatus.APPROVED);
triggerProcess.setUser(user);
TriggerProcessParameter param = new TriggerProcessParameter();
param.setKey(22);
param.setName(TriggerProcessParameterName.OBJECT_ID);
param.setTriggerProcess(triggerProcess);
param.setValue("param1Value");
TriggerProcessParameter param1 = new TriggerProcessParameter();
param1.setKey(55);
param1.setName(TriggerProcessParameterName.PRODUCT);
param1.setTriggerProcess(triggerProcess);
param1.setValue(voService);
List<TriggerProcessParameter> params = new ArrayList<>();
params.add(param);
params.add(param1);
triggerProcess.setTriggerProcessParameters(params);
TriggerDefinition triggerDefinition = new TriggerDefinition();
triggerDefinition.setKey(33);
triggerDefinition.setTarget("target");
triggerDefinition.setTargetType(TriggerTargetType.WEB_SERVICE);
triggerDefinition.setType(TriggerType.ADD_REVOKE_USER);
triggerDefinition.setSuspendProcess(true);
triggerDefinition.setOrganization(organization);
triggerProcess.setTriggerDefinition(triggerDefinition);
localizerFacade = new LocalizerFacade(new LocalizerServiceStub() {
@Override
public String getLocalizedTextFromDatabase(String localeString,
long objectKey, LocalizedObjectTypes objectType) {
return "";
}
}, "en");
}
示例15: setUp
import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
AESEncrypter.generateKey();
tqs = new TriggerQueueServiceBean();
sessionMock = mock(SessionContext.class);
doReturn(tqs).when(sessionMock).getBusinessObject(any(Class.class));
tqs.sessionCtx = sessionMock;
queue = new QueueStub();
connFact = new ConnectionFactoryStub();
tqs.qFactory = connFact;
tqs.queue = queue;
user = new PlatformUser();
organization = new Organization();
user.setOrganization(organization);
organizations.add(organization);
tqs.dm = new DataServiceStub() {
@Override
public void flush() {
}
@Override
public void persist(DomainObject<?> obj)
throws NonUniqueBusinessKeyException {
if (throwsSaasNonUniqueBusinessKeyException) {
throw new NonUniqueBusinessKeyException(ClassEnum.EVENT,
"");
}
storedObjects.add(obj);
}
@Override
public PlatformUser getCurrentUser() {
return user;
}
};
}