【问题标题】:tomcat 7 : SecureRandomAlgorithmtomcat 7:安全随机算法
【发布时间】:2014-03-31 12:20:23
【问题描述】:

在 Tomcat 7.0.30 代码中:

org.apache.catalina.session.ManagerBase 类:代码 sn-p

/**
 * The name of the algorithm to use to create instances of
 * {@link java.security.SecureRandom} which are used to generate session IDs.
 * If no algorithm is specified, SHA1PRNG is used. To use the platform
 * default (which may be SHA1PRNG), specify the empty string. If an invalid
 * algorithm and/or provider is specified the SecureRandom instances will be
 * created using the defaults. If that fails, the SecureRandom instances
 * will be created using platform defaults.
 */
protected String secureRandomAlgorithm = "SHA1PRNG";

    /**
 * Return the secure random number generator algorithm name.
 */
public String getSecureRandomAlgorithm() {
    return secureRandomAlgorithm;
}


/**
 * Set the secure random number generator algorithm name.
 *
 * @param secureRandomAlgorithm The new secure random number generator
 *                              algorithm name
 */
public void setSecureRandomAlgorithm(String secureRandomAlgorithm) {
    this.secureRandomAlgorithm = secureRandomAlgorithm;
}

这里默认使用SHA1PRNG。我可以在这里使用所有可能的算法。有没有可用的列表。

我见过link 。这里只有SHA1PRNGSecureRandomAlgorithm 部分给出。

【问题讨论】:

    标签: java tomcat tomcat7 java-7


    【解决方案1】:

    似乎只实现了 SHA1PRNG。也许试试Security.getAlgorithms(String serviceName) 看看,如果还有其他的?见这里:http://docs.oracle.com/javase/7/docs/api/java/security/Security.html#getAlgorithms%28java.lang.String%29 和这里:http://docs.oracle.com/javase/7/docs/api/java/security/SecureRandom.html#SecureRandom%28%29

    【讨论】:

    • 是的。好像只是这样,但我只是想确认一下。
    猜你喜欢
    • 2019-05-25
    • 1970-01-01
    • 1970-01-01
    • 2016-09-07
    • 2011-11-25
    • 2019-08-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多