當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。