当前位置: 首页>>代码示例>>Java>>正文


Java AESEncrypter.generateKey方法代码示例

本文整理汇总了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;
        }
    });
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:20,代码来源:DomainObjectTestBase.java

示例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"));
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:XMLSerializerTest.java

示例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();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:MigrateTriggerProcessParametersTest.java

示例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"));
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:XMLSerializerTest.java

示例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"));
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:25,代码来源:XMLSerializerTest.java

示例6: setup

import org.oscm.encrypter.AESEncrypter; //导入方法依赖的package包/类
@Before
public void setup() {
    AESEncrypter.generateKey();
    tppd = new TriggerProcessParameterData();
    tppd.setName(TriggerProcessParameterName.PRODUCT);

    svc = new VOService();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:9,代码来源:TriggerProcessParameterDataTest.java

示例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));

}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:32,代码来源:IdentityServiceBeanTriggerIdIT.java

示例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();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:SubscriptionServiceBeanCutOffIT.java

示例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);
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:9,代码来源:AccountServiceBeanOrganizationReferenceIT.java

示例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));
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:29,代码来源:AccountServiceBeanTriggerIdIT.java

示例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();
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:29,代码来源:IdentityServiceBeanPerformanceIT.java

示例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());

}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:60,代码来源:PasswordSetupIT.java

示例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");
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:74,代码来源:APPAuthenticationServiceBeanIT.java

示例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");
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:63,代码来源:TriggerProcessAssemblerTest.java

示例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;
        }
    };
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:43,代码来源:TriggerQueueServiceLocalTest.java


注:本文中的org.oscm.encrypter.AESEncrypter.generateKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。