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


Java RSAPublicKeySpec.getModulus方法代码示例

本文整理汇总了Java中java.security.spec.RSAPublicKeySpec.getModulus方法的典型用法代码示例。如果您正苦于以下问题:Java RSAPublicKeySpec.getModulus方法的具体用法?Java RSAPublicKeySpec.getModulus怎么用?Java RSAPublicKeySpec.getModulus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.spec.RSAPublicKeySpec的用法示例。


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

示例1: BCRSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
BCRSAPublicKey(
    RSAPublicKeySpec spec)
{
    this.algorithmIdentifier = DEFAULT_ALGORITHM_IDENTIFIER;
    this.modulus = spec.getModulus();
    this.publicExponent = spec.getPublicExponent();
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:8,代码来源:BCRSAPublicKey.java

示例2: decodeRSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
/**
 * @param spec an instance of {@link RSAPublicKeySpec} to decode.
 * @return an instance of {@link GnuRSAPublicKey} constructed from the
 *         information in the designated key-specification.
 */
private GnuRSAPublicKey decodeRSAPublicKey(RSAPublicKeySpec spec)
{
  BigInteger n = spec.getModulus();
  BigInteger e = spec.getPublicExponent();
  return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e);
}
 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:EncodedKeyFactory.java

示例3: testRSA

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
@Test
public void testRSA() throws Exception {
	KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
	assertNotNull(keyPairGenerator);
	keyPairGenerator.initialize(1024);
	KeyPair keyPair = keyPairGenerator.genKeyPair();
	assertNotNull(keyPair);
	PublicKey publicKey = keyPair.getPublic();
	assertNotNull(publicKey);
	PrivateKey privateKey = keyPair.getPrivate();
	assertNotNull(privateKey);

	KeyFactory keyFactory = KeyFactory.getInstance("RSA");
	assertNotNull(keyFactory);
	RSAPrivateKeySpec privateKeySpec = keyFactory.getKeySpec(privateKey,
			RSAPrivateKeySpec.class);
	assertNotNull(privateKeySpec);
	RSAPublicKeySpec publicKeySpec = keyFactory.getKeySpec(publicKey,
			RSAPublicKeySpec.class);
	assertNotNull(publicKeySpec);

	BigInteger privateModulus = privateKeySpec.getModulus();
	assertNotNull(privateModulus);
	BigInteger privateExponent = privateKeySpec.getPrivateExponent();
	assertNotNull(privateExponent);

	BigInteger publicModulus = publicKeySpec.getModulus();
	assertNotNull(publicModulus);
	BigInteger publicExponent = publicKeySpec.getPublicExponent();
	assertNotNull(publicExponent);

	System.out.println("privateModulus: " + privateModulus);
	System.out.println("privateExponent: " + privateExponent);
	System.out.println("publicModulus: " + publicModulus);
	System.out.println("publicExponent: " + publicExponent);
}
 
开发者ID:PureSolTechnologies,项目名称:Purifinity,代码行数:37,代码来源:CryptographyTest.java

示例4: getRSAKeyLength

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
static int getRSAKeyLength(PublicKey key) {
    BigInteger modulus;
    if (key instanceof RSAPublicKey) {
        modulus = ((RSAPublicKey)key).getModulus();
    } else {
        RSAPublicKeySpec spec = getRSAPublicKeySpec(key);
        modulus = spec.getModulus();
    }
    return modulus.bitLength();
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:11,代码来源:JsseJce.java

示例5: JCERSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
JCERSAPublicKey(
    RSAPublicKeySpec spec)
{
    this.modulus = spec.getModulus();
    this.publicExponent = spec.getPublicExponent();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:7,代码来源:JCERSAPublicKey.java

示例6: BCRSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
BCRSAPublicKey(
    RSAPublicKeySpec spec)
{
    this.modulus = spec.getModulus();
    this.publicExponent = spec.getPublicExponent();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:7,代码来源:BCRSAPublicKey.java

示例7: TempJCERSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
TempJCERSAPublicKey(
    RSAPublicKeySpec spec)
{
    this.modulus = spec.getModulus();
    this.publicExponent = spec.getPublicExponent();
}
 
开发者ID:B4dT0bi,项目名称:silvertunnel-ng,代码行数:7,代码来源:TempJCERSAPublicKey.java

示例8: toRSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
public static RSAPublicKey toRSAPublicKey(RSAPublicKeySpec k)
{
	return new RSAPublicKey(k.getModulus(), k.getPublicExponent());
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:5,代码来源:Crypto.java

示例9: IosRSAPublicKey

import java.security.spec.RSAPublicKeySpec; //导入方法依赖的package包/类
public IosRSAPublicKey(RSAPublicKeySpec spec) {
  super(spec.getModulus());
  this.publicExponent = spec.getPublicExponent();
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:5,代码来源:IosRSAKey.java


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