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


Java AESEncrypter类代码示例

本文整理汇总了Java中org.oscm.encrypter.AESEncrypter的典型用法代码示例。如果您正苦于以下问题:Java AESEncrypter类的具体用法?Java AESEncrypter怎么用?Java AESEncrypter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AESEncrypter类属于org.oscm.encrypter包,在下文中一共展示了AESEncrypter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createServiceInstance

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
/**
 * Creates and persists a service instance object.
 * 
 * @param status
 *            the status to be set for the service instance
 * @param parameters
 *            the keys for the parameters to be created
 */
private ServiceInstance createServiceInstance(
        final ProvisioningStatus status, final String... parameter)
        throws Exception {

    // Use linked hash map to keep order of entries (for asserts)
    Map<String, Setting> parameters = new LinkedHashMap<>();
    for (String parameterKey : parameter) {
        if (InstanceParameter.PUBLIC_IP.equals(parameterKey)) {
            parameters.put(InstanceParameter.PUBLIC_IP,
                    new Setting(InstanceParameter.PUBLIC_IP, "4.3.2.1"));
        } else {
            String pValue = parameterKey + "Value";
            Setting setting = new Setting(parameterKey, pValue);
            if (parameterKey.endsWith("_PWD")) {
                pValue = AESEncrypter.encrypt(pValue);
                setting.setEncrypted(true);
            }
            parameters.put(parameterKey, setting);
        }
    }
    return createServiceInstance(status, parameters);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:31,代码来源:APPTimerServiceBeanIT.java

示例2: 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

示例3: 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

示例4: getVOServiceFromTrigger

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
private VOService getVOServiceFromTrigger(TriggerProcess triggerProcess,
    DocumentBuilder builder, XPathExpression serviceIdXpath) {
    TriggerProcessParameter triggerProcessParameter = triggerProcess
        .getParamValueForName(TriggerProcessParameterName.PRODUCT);
    String product;
    try {
        product = AESEncrypter
            .decrypt(triggerProcessParameter.getSerializedValue());
    } catch (GeneralSecurityException e) {
        product = triggerProcessParameter.getSerializedValue();
    }
    String serviceId = retrieveValueByXpath(product, builder,
        serviceIdXpath);
    if (serviceId == null) {
        return null;
    }
    VOService voService = new VOService();
    voService.setServiceId(serviceId);
    return voService;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:TriggerServiceBean.java

示例5: getVOSubscriptionFromTrigger

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
private VOSubscription getVOSubscriptionFromTrigger(
    TriggerProcess triggerProcess, DocumentBuilder builder,
    XPathExpression subscriptionXpath) {
    TriggerProcessParameter triggerProcessParameter = triggerProcess
        .getParamValueForName(
            org.oscm.types.enumtypes.TriggerProcessParameterName.SUBSCRIPTION);
    String subscription;
    try {
        subscription = AESEncrypter
            .decrypt(triggerProcessParameter.getSerializedValue());
    } catch (GeneralSecurityException e) {
        subscription = triggerProcessParameter.getSerializedValue();
    }
    String subsId = retrieveValueByXpath(subscription, builder,
        subscriptionXpath);
    if (subsId == null) {
        return null;
    }
    VOSubscription voSubscription = new VOSubscription();
    voSubscription.setSubscriptionId(subsId);
    return voSubscription;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:TriggerServiceBean.java

示例6: 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

示例7: 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

示例8: 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,项目名称:oscm,代码行数:25,代码来源:XMLSerializerTest.java

示例9: toObject

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public static Object toObject(String xml) {
    Object result = null;
    XMLDecoder decoder = null;
    try {
        byte[] bytes;
        if (xml.contains("<")) {
            bytes = xml.getBytes();
        } else {
            String decrypted = AESEncrypter.decrypt(xml);
            bytes = decrypted.getBytes();
        }
        decoder = new XMLDecoder(new ByteArrayInputStream(bytes));
        result = decoder.readObject();
    } catch (Exception e) {
        LOGGER.logError(Log4jLogger.SYSTEM_LOG, e,
                LogMessageIdentifier.ERROR);
    } finally {
        if (decoder != null) {
            decoder.close();
        }
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:24,代码来源:XMLSerializer.java

示例10: getDecryptedValue

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public String getDecryptedValue() throws BadResultException {
    try {
        return isEncrypted() ? AESEncrypter.decrypt(attributeValue)
                : attributeValue;
    } catch (GeneralSecurityException e) {
        throw new BadResultException(String.format(
                "Attribute for key '%s' could not be decrypted",
                getAttributeKey()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:11,代码来源:InstanceAttribute.java

示例11: setDecryptedValue

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public void setDecryptedValue(String parameterValue)
        throws BadResultException {
    try {
        this.attributeValue = isEncrypted()
                ? AESEncrypter.encrypt(parameterValue) : parameterValue;
    } catch (GeneralSecurityException e) {
        throw new BadResultException(String.format(
                "Attribute for key '%s' could not be encrypted",
                getAttributeKey()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:12,代码来源:InstanceAttribute.java

示例12: getDecryptedValue

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public String getDecryptedValue() throws BadResultException {
    try {
        return isEncrypted() ? AESEncrypter.decrypt(parameterValue)
                : parameterValue;
    } catch (GeneralSecurityException e) {
        throw new BadResultException(String.format(
                "Parameter for key '%s' could not be decrypted",
                getParameterKey()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:11,代码来源:InstanceParameter.java

示例13: setDecryptedValue

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public void setDecryptedValue(String parameterValue)
        throws BadResultException {
    try {
        this.parameterValue = isEncrypted()
                ? AESEncrypter.encrypt(parameterValue) : parameterValue;
    } catch (GeneralSecurityException e) {
        throw new BadResultException(String.format(
                "Parameter for key '%s' could not be encrypted",
                getParameterKey()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:12,代码来源:InstanceParameter.java

示例14: setDecryptedValue

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public void setDecryptedValue(String settingValue)
        throws ConfigurationException {
    try {
        this.settingValue = isEncrypted()
                ? AESEncrypter.encrypt(settingValue) : settingValue;
    } catch (GeneralSecurityException e) {
        throw new ConfigurationException(
                String.format("Setting for key '%s' could not be encrypted",
                        getSettingKey()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:12,代码来源:ConfigurationSetting.java

示例15: getDecryptedValue

import org.oscm.encrypter.AESEncrypter; //导入依赖的package包/类
public String getDecryptedValue() throws ConfigurationException {
    try {
        return isEncrypted() ? AESEncrypter.decrypt(settingValue)
                : settingValue;
    } catch (GeneralSecurityException e) {
        throw new ConfigurationException(
                String.format("Setting for key '%s' could not be decrypted",
                        getSettingKey()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:11,代码来源:ConfigurationSetting.java


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