本文整理汇总了Java中javax.crypto.spec.DHGenParameterSpec.getExponentSize方法的典型用法代码示例。如果您正苦于以下问题:Java DHGenParameterSpec.getExponentSize方法的具体用法?Java DHGenParameterSpec.getExponentSize怎么用?Java DHGenParameterSpec.getExponentSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.crypto.spec.DHGenParameterSpec
的用法示例。
在下文中一共展示了DHGenParameterSpec.getExponentSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
@Override
protected void engineInit(
AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException
{
if (!(genParamSpec instanceof DHGenParameterSpec))
{
throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation");
}
DHGenParameterSpec spec = (DHGenParameterSpec)genParamSpec;
this.strength = spec.getPrimeSize();
this.l = spec.getExponentSize();
this.random = random;
}
示例2: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
protected void engineInit(
AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException
{
if (!(genParamSpec instanceof DHGenParameterSpec))
{
throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation");
}
DHGenParameterSpec spec = (DHGenParameterSpec)genParamSpec;
this.strength = spec.getPrimeSize();
this.l = spec.getExponentSize();
this.random = random;
}
示例3: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
/**
* Initializes this parameter generator with a set of parameter
* generation values, which specify the size of the prime modulus and
* the size of the random exponent, both in bits.
*
* @param params the set of parameter generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter
* generation values are inappropriate for this parameter generator
*/
protected void engineInit(AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException {
if (!(genParamSpec instanceof DHGenParameterSpec)) {
throw new InvalidAlgorithmParameterException
("Inappropriate parameter type");
}
DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
primeSize = dhParamSpec.getPrimeSize();
// Re-uses DSA parameters and thus have the same range
checkKeySize(primeSize);
exponentSize = dhParamSpec.getExponentSize();
if (exponentSize <= 0) {
throw new InvalidAlgorithmParameterException
("Exponent size must be greater than zero");
}
// Require exponentSize < primeSize
if (exponentSize >= primeSize) {
throw new InvalidAlgorithmParameterException
("Exponent size must be less than modulus size");
}
}
示例4: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
/**
* Initializes this parameter generator with a set of parameter
* generation values, which specify the size of the prime modulus and
* the size of the random exponent, both in bits.
*
* @param params the set of parameter generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter
* generation values are inappropriate for this parameter generator
*/
protected void engineInit(AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException {
if (!(genParamSpec instanceof DHGenParameterSpec)) {
throw new InvalidAlgorithmParameterException
("Inappropriate parameter type");
}
DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
primeSize = dhParamSpec.getPrimeSize();
// Re-uses DSA parameters and thus have the same range
try {
checkKeySize(primeSize);
} catch (InvalidParameterException ipe) {
throw new InvalidAlgorithmParameterException(ipe.getMessage());
}
exponentSize = dhParamSpec.getExponentSize();
if (exponentSize <= 0) {
throw new InvalidAlgorithmParameterException
("Exponent size must be greater than zero");
}
// Require exponentSize < primeSize
if (exponentSize >= primeSize) {
throw new InvalidAlgorithmParameterException
("Exponent size must be less than modulus size");
}
}
示例5: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
/**
* Initializes this parameter generator with a set of parameter
* generation values, which specify the size of the prime modulus and
* the size of the random exponent, both in bits.
*
* @param genParamSpec the set of parameter generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter
* generation values are inappropriate for this parameter generator
*/
@Override
protected void engineInit(AlgorithmParameterSpec genParamSpec,
SecureRandom random) throws InvalidAlgorithmParameterException {
if (!(genParamSpec instanceof DHGenParameterSpec)) {
throw new InvalidAlgorithmParameterException
("Inappropriate parameter type");
}
DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
primeSize = dhParamSpec.getPrimeSize();
exponentSize = dhParamSpec.getExponentSize();
if ((exponentSize <= 0) || (exponentSize >= primeSize)) {
throw new InvalidAlgorithmParameterException(
"Exponent size (" + exponentSize +
") must be positive and less than modulus size (" +
primeSize + ")");
}
try {
checkKeySize(primeSize);
} catch (InvalidParameterException ipe) {
throw new InvalidAlgorithmParameterException(ipe.getMessage());
}
this.random = random;
}
示例6: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
protected void engineInit(
AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException
{
if (!(genParamSpec instanceof DHGenParameterSpec))
{
throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation");
}
DHGenParameterSpec spec = (DHGenParameterSpec)genParamSpec;
this.strength = spec.getPrimeSize();
this.l = spec.getExponentSize();
this.random = random;
}
示例7: engineInit
import javax.crypto.spec.DHGenParameterSpec; //导入方法依赖的package包/类
/**
* Initializes this parameter generator with a set of parameter
* generation values, which specify the size of the prime modulus and
* the size of the random exponent, both in bits.
*
* @param params the set of parameter generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter
* generation values are inappropriate for this parameter generator
*/
protected void engineInit(AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException {
if (!(genParamSpec instanceof DHGenParameterSpec)) {
throw new InvalidAlgorithmParameterException
("Inappropriate parameter type");
}
DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
primeSize = dhParamSpec.getPrimeSize();
if ((primeSize<512) || (primeSize>1024) || (primeSize%64 != 0)) {
throw new InvalidAlgorithmParameterException
("Modulus size must be multiple of 64, and can only range "
+ "from 512 to 1024 (inclusive)");
}
exponentSize = dhParamSpec.getExponentSize();
if (exponentSize <= 0) {
throw new InvalidAlgorithmParameterException
("Exponent size must be greater than zero");
}
// Require exponentSize < primeSize
if (exponentSize >= primeSize) {
throw new InvalidAlgorithmParameterException
("Exponent size must be less than modulus size");
}
}