• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CryptoUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: decryptIfEncrypted

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String decryptIfEncrypted(String nonEncryptedString, String encryptedString, String encryptionKey) {

        Map<String, String> map = new HashMap<String, String>();

        if (nonEncryptedString != null) {
            logger.debug("Using the provided non encrypted value");
            map.put(TaskInputArgs.PASSWORD, nonEncryptedString);
        }

        if (encryptedString != null) {
            logger.debug("Decrypting the value...");
            map.put(TaskInputArgs.PASSWORD_ENCRYPTED, encryptedString);
            map.put(TaskInputArgs.ENCRYPTION_KEY, encryptionKey);
        }

        String decryptedValue = CryptoUtil.getPassword(map);

        return decryptedValue;
    }
 
开发者ID:Appdynamics,项目名称:azure-servicebus-monitoring-extension,代码行数:20,代码来源:AzureServiceBusMonitoringTask.java


示例2: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword(String password, String encryptedPassword, String encryptionKey) {

        if (!Strings.isNullOrEmpty(password)) {
            return password;
        }

        try {
            Map<String, String> args = Maps.newHashMap();
            args.put(TaskInputArgs.PASSWORD_ENCRYPTED, encryptedPassword);
            args.put(TaskInputArgs.ENCRYPTION_KEY, encryptionKey);
            return CryptoUtil.getPassword(args);
        } catch (IllegalArgumentException e) {
            String msg = "Encryption Key not specified. Please set the value in config.yaml.";
            logger.error(msg);
            throw new IllegalArgumentException(msg);
        }
    }
 
开发者ID:Appdynamics,项目名称:postgresql-monitoring-extension,代码行数:18,代码来源:PostgreTask.java


示例3: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword(Map<String, String> server){
    String password = server.get("password");
    String encryptedPassword = server.get("encryptedPassword");
    Map<String, ?> configMap = configuration.getConfigYml();
    String encryptionKey = configMap.get("encryptionKey").toString();
    if(!Strings.isNullOrEmpty(password)){
        return password;
    }
    if(!Strings.isNullOrEmpty(encryptedPassword) && !Strings.isNullOrEmpty(encryptionKey)){
        Map<String,String> cryptoMap = Maps.newHashMap();
        cryptoMap.put("password-encrypted", encryptedPassword);
        cryptoMap.put("encryption-key", encryptionKey);
        logger.debug("Decrypting the ecncrypted password........");
        return CryptoUtil.getPassword(cryptoMap);
    }
    return "";
}
 
开发者ID:Appdynamics,项目名称:redis-monitoring-extension,代码行数:18,代码来源:RedisMonitorTask.java


示例4: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword(String password, String passwordEncrypted) {

        Map<String, String> map = new HashMap<String, String>();

        if (password != null) {
            logger.debug("Using provided password");
            map.put(TaskInputArgs.PASSWORD, password);
        }

        if (passwordEncrypted != null) {
            logger.debug("Using provided passwordEncrypted");
            map.put(TaskInputArgs.PASSWORD_ENCRYPTED, passwordEncrypted);
            map.put(TaskInputArgs.ENCRYPTION_KEY, config.getEncryptionKey());
        }

        String plainPassword = CryptoUtil.getPassword(map);

        return plainPassword;
    }
 
开发者ID:Appdynamics,项目名称:jira-alerting-extension,代码行数:20,代码来源:HttpHandler.java


示例5: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword(Map<String, ?> config) {
    String password = null;

    if (!Strings.isNullOrEmpty((String) config.get("password"))) {
        password = (String) config.get("password");

    } else {
        try {
            Map<String, String> args = Maps.newHashMap();
            args.put(TaskInputArgs.PASSWORD_ENCRYPTED, (String) config.get("encryptedPassword"));
            args.put(TaskInputArgs.ENCRYPTION_KEY, (String) config.get("encryptionKey"));
            password = CryptoUtil.getPassword(args);

        } catch (IllegalArgumentException e) {
            String msg = "Encryption Key not specified. Please set the value in config.yaml.";
            logger.error(msg);
            throw new IllegalArgumentException(msg);
        }
    }

    return password;
}
 
开发者ID:Appdynamics,项目名称:vmware-vsphere-monitoring-extension,代码行数:23,代码来源:VMWareMonitor.java


示例6: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword() {
    String password = null;

    if (StringUtils.isNotBlank(varnish.getPassword())) {
        password = varnish.getPassword();

    } else {
        try {
            Map<String, String> args = Maps.newHashMap();
            args.put(TaskInputArgs.PASSWORD_ENCRYPTED, varnish.getPasswordEncrypted());
            args.put(TaskInputArgs.ENCRYPTION_KEY, varnish.getEncryptionKey());
            password = CryptoUtil.getPassword(args);

        } catch (IllegalArgumentException e) {
            String msg = "Encryption Key not specified. Please set the value in config.yaml.";
            logger.error(msg);
            throw new IllegalArgumentException(msg);
        }
    }
    return password;
}
 
开发者ID:Appdynamics,项目名称:varnish-monitoring-extension,代码行数:22,代码来源:VarnishWrapper.java


示例7: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword(Map server) {
    String password = convertToString(server.get(PASSWORD), "");
    if (!Strings.isNullOrEmpty(password)) {
        return password;
    }
    String encryptionKey = convertToString(configuration.getConfigYml().get(ConfigConstants.ENCRYPTION_KEY), "");
    String encryptedPassword = convertToString(server.get(ENCRYPTED_PASSWORD), "");
    if (!Strings.isNullOrEmpty(encryptionKey) && !Strings.isNullOrEmpty(encryptedPassword)) {
        Map<String, String> cryptoMap = Maps.newHashMap();
        cryptoMap.put(PASSWORD_ENCRYPTED, encryptedPassword);
        cryptoMap.put(TaskInputArgs.ENCRYPTION_KEY, encryptionKey);
        return CryptoUtil.getPassword(cryptoMap);
    }
    return null;
}
 
开发者ID:Appdynamics,项目名称:kafka-monitoring-extension,代码行数:16,代码来源:KafkaMonitor.java


示例8: execute

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
public TaskOutput execute(Map<String, String> taskArguments, TaskExecutionContext arg1) throws TaskExecutionException {
    if (taskArguments != null) {
        logger.info("Starting the HAProxy Monitoring Task");
        try {
            taskArguments = ArgumentsValidator.validateArguments(taskArguments, DEFAULT_ARGS);
            String password = CryptoUtil.getPassword(taskArguments);
            if (Strings.isNullOrEmpty(password)) {
                taskArguments.put("password", password);
            }
            SimpleHttpClient httpClient = SimpleHttpClient.builder(taskArguments).build();

            String csvPath = taskArguments.get(CSV_EXPORT_URI);
            String responseString = httpClient.target().path(csvPath).get().string();

            // reads the csv output and writes the response to a spreadsheet
            // which is used inturn to get the metrics
            writeResponseToWorkbook(responseString);

            Map<Integer, String> allProxies = getAllProxyAndTypes(dictionary.get("# pxname"));
            Map<Integer, String> proxyTypes = getAllProxyAndTypes(dictionary.get("svname"));

            Map<Integer, String> proxiesToBeMonitored = filterProxies(taskArguments, allProxies);
            printStats(taskArguments, proxiesToBeMonitored, proxyTypes);

            logger.info("HAProxy Monitoring Task completed successfully");
            return new TaskOutput("HAProxy Monitoring Task completed successfully");
        } catch (Exception e) {
            logger.error("HAProxy Metrics collection failed", e);
        }
    }
    throw new TaskExecutionException("HAProxy Monitor task completed with failures");
}
 
开发者ID:Appdynamics,项目名称:haproxy-monitoring-extension,代码行数:33,代码来源:HAProxyMonitor.java


示例9: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword (Map server) {
    String password = convertToString(server.get("password"), "");
    if (!Strings.isNullOrEmpty(password)) {
        return password;
    }
    String encryptionKey = convertToString(configuration.getConfigYml().get("encryptionKey"), "");
    String encryptedPassword = convertToString(server.get("encryptedPassword"), "");
    if (!Strings.isNullOrEmpty(encryptionKey) && !Strings.isNullOrEmpty(encryptedPassword)) {
        java.util.Map<String, String> cryptoMap = Maps.newHashMap();
        cryptoMap.put(PASSWORD_ENCRYPTED, encryptedPassword);
        cryptoMap.put(TaskInputArgs.ENCRYPTION_KEY, encryptionKey);
        return CryptoUtil.getPassword(cryptoMap);
    }
    return null;
}
 
开发者ID:Appdynamics,项目名称:cassandra-monitoring-extension,代码行数:16,代码来源:CassandraMonitor.java


示例10: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getPassword(Map server) {
    String password = convertToString(server.get("password"), "");
    if (!Strings.isNullOrEmpty(password)) {
        return password;
    }
    String encryptionKey = convertToString(configuration.getConfigYml().get("encryptionKey"), "");
    String encryptedPassword = convertToString(server.get("encryptedPassword"), "");
    if (!Strings.isNullOrEmpty(encryptionKey) && !Strings.isNullOrEmpty(encryptedPassword)) {
        java.util.Map<String, String> cryptoMap = Maps.newHashMap();
        cryptoMap.put(PASSWORD_ENCRYPTED, encryptedPassword);
        cryptoMap.put(TaskInputArgs.ENCRYPTION_KEY, encryptionKey);
        return CryptoUtil.getPassword(cryptoMap);
    }
    return null;
}
 
开发者ID:Appdynamics,项目名称:activemq-monitoring-extension,代码行数:16,代码来源:ActiveMQMonitor.java


示例11: getPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
public String getPassword() {
    if(encryptionKey != null){
        Map cryptoMap = Maps.newHashMap();
        cryptoMap.put(PASSWORD_ENCRYPTED,encryptedPassword);
        cryptoMap.put(ENCRYPTION_KEY,encryptionKey);
        password = CryptoUtil.getPassword(cryptoMap);
    }
    return password;
}
 
开发者ID:Appdynamics,项目名称:oracle-monitoring-extension,代码行数:10,代码来源:Configuration.java


示例12: getDecryptedPassword

import com.appdynamics.extensions.crypto.CryptoUtil; //导入依赖的package包/类
private String getDecryptedPassword(String encryptionKey, String encryptedPassword) {
    Map<String, String> argsForDecryption = new HashMap<String, String>();
    argsForDecryption.put(PASSWORD_ENCRYPTED, encryptedPassword);
    argsForDecryption.put(ENCRYPTION_KEY, encryptionKey);
    return CryptoUtil.getPassword(argsForDecryption);
}
 
开发者ID:Appdynamics,项目名称:mongo-monitoring-extension,代码行数:7,代码来源:MongoDBMonitor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NbModuleSuite类代码示例发布时间:2022-05-22
下一篇:
Java PBHelper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap