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


Java SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo方法代码示例

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


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

示例1: fetchPartialPublicKey

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
@Override
public PartialPublicKeyInfo fetchPartialPublicKey(String keyID)
    throws IOException
{
    if (sharedPrivateKeyMap.containsKey(keyID))
    {
        ECDomainParameters params = paramsMap.get(keyID);
        Share<BigInteger> share = sharedPrivateKeyMap.getShare(keyID, TIME_OUT, TimeUnit.SECONDS);
        BigInteger d = share.getValue();
        ECPoint Q = params.getG().multiply(d);

        return new PartialPublicKeyInfo(share.getSequenceNo(), SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(new ECPublicKeyParameters(Q, params)));
    }

    return null;
}
 
开发者ID:cwgit,项目名称:ximix,代码行数:17,代码来源:ECKeyManager.java

示例2: getRSAPublicKey

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
public static PublicKey getRSAPublicKey(byte[] encodedPubKey) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
	RSAPublicKey pubKey8 = RSAPublicKey.getInstance(encodedPubKey);
	SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(new RSAKeyParameters(false, pubKey8.getModulus(), pubKey8.getPublicExponent()));
	X509EncodedKeySpec spec = new X509EncodedKeySpec(info.getEncoded());
	KeyFactory keyFactory = KeyFactory.getInstance("RSA");
	return keyFactory.generatePublic(spec);
}
 
开发者ID:zsavvas,项目名称:ReCRED_FIDO_UAF_OIDC,代码行数:8,代码来源:KeyCodec.java

示例3: convertToJca

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
public static KeyPair convertToJca(AsymmetricCipherKeyPair keyPair) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
	SubjectPublicKeyInfo publicKey = SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(keyPair.getPublic());
	PrivateKeyInfo privateKey = PrivateKeyInfoFactory.createPrivateKeyInfo(keyPair.getPrivate());

	KeyFactory keyFactory = new DefaultJcaJceHelper().createKeyFactory("RSA"); // TODO should we really assume RSA?
	return new KeyPair(
		keyFactory.generatePublic(new X509EncodedKeySpec(publicKey.getEncoded())),
		keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey.getEncoded()))
	);
}
 
开发者ID:grahamedgecombe,项目名称:android-ssl,代码行数:11,代码来源:KeyUtils.java

示例4: generateCertificationRequest

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
private PKCS10CertificationRequest generateCertificationRequest(String dn, KeyPair kp)
		throws Exception{
	X500Name subject=new X500Name(dn);
	PublicKey pubKey=kp.getPublic();
	PrivateKey privKey=kp.getPrivate();
	AsymmetricKeyParameter pubkeyParam = PublicKeyFactory.createKey(pubKey.getEncoded());
	SubjectPublicKeyInfo publicKeyInfo=SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(pubkeyParam);
	PKCS10CertificationRequestBuilder builder=new PKCS10CertificationRequestBuilder(subject, publicKeyInfo);
	AlgorithmIdentifier signatureAi = new AlgorithmIdentifier(OIWObjectIdentifiers.sha1WithRSA);
	BcRSAContentSignerBuilder signerBuilder=new BcRSAContentSignerBuilder(
			signatureAi, AlgorithmIdentifier.getInstance(OIWObjectIdentifiers.idSHA1));
	AsymmetricKeyParameter pkParam = PrivateKeyFactory.createKey(privKey.getEncoded());
	ContentSigner signer=signerBuilder.build(pkParam);
	return builder.build(signer);
}
 
开发者ID:apache,项目名称:airavata,代码行数:16,代码来源:MyProxyLogon.java

示例5: generateCertificationRequest

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
private org.bouncycastle.pkcs.PKCS10CertificationRequest generateCertificationRequest(String dn, KeyPair kp)
		throws Exception{
	X500Name subject=new X500Name(dn);
	PublicKey pubKey=kp.getPublic();
	PrivateKey privKey=kp.getPrivate();
	AsymmetricKeyParameter pubkeyParam = PublicKeyFactory.createKey(pubKey.getEncoded());
	SubjectPublicKeyInfo publicKeyInfo=SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(pubkeyParam);
	PKCS10CertificationRequestBuilder builder=new PKCS10CertificationRequestBuilder(subject, publicKeyInfo);
	AlgorithmIdentifier signatureAi = new AlgorithmIdentifier(OIWObjectIdentifiers.sha1WithRSA);
	BcRSAContentSignerBuilder signerBuilder=new BcRSAContentSignerBuilder(
			signatureAi, AlgorithmIdentifier.getInstance(OIWObjectIdentifiers.idSHA1));
	AsymmetricKeyParameter pkParam = PrivateKeyFactory.createKey(privKey.getEncoded());
	ContentSigner signer=signerBuilder.build(pkParam);
	return builder.build(signer);
}
 
开发者ID:apache,项目名称:airavata,代码行数:16,代码来源:MyProxyLogon.java

示例6: createAuthorityKeyIdentifier

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
public AuthorityKeyIdentifier createAuthorityKeyIdentifier(
    AsymmetricKeyParameter publicKey)
    throws IOException
{
    return super.createAuthorityKeyIdentifier(SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(publicKey));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:7,代码来源:BcX509ExtensionUtils.java

示例7: createSubjectKeyIdentifier

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
/**
 * Return a RFC 3280 type 1 key identifier. As in:
 * <pre>
 * (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the
 * value of the BIT STRING subjectPublicKey (excluding the tag,
 * length, and number of unused bits).
 * </pre>
 * @param publicKey the key object containing the key identifier is to be based on.
 * @return the key identifier.
 */
public SubjectKeyIdentifier createSubjectKeyIdentifier(
    AsymmetricKeyParameter publicKey)
    throws IOException
{
    return super.createSubjectKeyIdentifier(SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(publicKey));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:BcX509ExtensionUtils.java

示例8: BcX509v1CertificateBuilder

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
/**
 * Initialise the builder using an AsymmetricKeyParameter.
 *
 * @param issuer X500Name representing the issuer of this certificate.
 * @param serial the serial number for the certificate.
 * @param notBefore date before which the certificate is not valid.
 * @param notAfter date after which the certificate is not valid.
 * @param subject X500Name representing the subject of this certificate.
 * @param publicKey the public key to be associated with the certificate.
 */
public BcX509v1CertificateBuilder(X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, X500Name subject, AsymmetricKeyParameter publicKey)
    throws IOException
{
    super(issuer, serial, notBefore, notAfter, subject, SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(publicKey));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:BcX509v1CertificateBuilder.java

示例9: BcX509v3CertificateBuilder

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
/**
 * Initialise the builder using a PublicKey.
 *
 * @param issuer X500Name representing the issuer of this certificate.
 * @param serial the serial number for the certificate.
 * @param notBefore date before which the certificate is not valid.
 * @param notAfter date after which the certificate is not valid.
 * @param subject X500Name representing the subject of this certificate.
 * @param publicKey the public key to be associated with the certificate.
 */
public BcX509v3CertificateBuilder(X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, X500Name subject, AsymmetricKeyParameter publicKey)
    throws IOException
{
    super(issuer, serial, notBefore, notAfter, subject, SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(publicKey));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:BcX509v3CertificateBuilder.java

示例10: BcPKCS10CertificationRequestBuilder

import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory; //导入方法依赖的package包/类
/**
 * Create a PKCS#10 builder for the passed in subject and JCA public key.
 *
 * @param subject an X500Name containing the subject associated with the request we are building.
 * @param publicKey a JCA public key that is to be associated with the request we are building.
 * @throws IOException if there is a problem encoding the public key.
 */
public BcPKCS10CertificationRequestBuilder(X500Name subject, AsymmetricKeyParameter publicKey)
    throws IOException
{
    super(subject, SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(publicKey));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:BcPKCS10CertificationRequestBuilder.java


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