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


Java DSAParameter类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.x509.DSAParameter的典型用法代码示例。如果您正苦于以下问题:Java DSAParameter类的具体用法?Java DSAParameter怎么用?Java DSAParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
public byte[] getEncoded()
{
    try
    {
        if (dsaSpec == null)
        {
            return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa), new DERInteger(y)).getEncoded(ASN1Encoding.DER);
        }

        return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new DERInteger(y)).getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:JDKDSAPublicKey.java

示例2: JDKDSAPublicKey

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
JDKDSAPublicKey(
    SubjectPublicKeyInfo    info)
{

    ASN1Integer              derY;

    try
    {
        derY = (ASN1Integer)info.parsePublicKey();
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("invalid info structure in DSA public key");
    }

    this.y = derY.getValue();

    if (isNotNull(info.getAlgorithm().getParameters()))
    {
        DSAParameter params = DSAParameter.getInstance(info.getAlgorithm().getParameters());
        
        this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:25,代码来源:JDKDSAPublicKey.java

示例3: getEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
public byte[] getEncoded()
{
    try
    {
        if (dsaSpec == null)
        {
            return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa), new ASN1Integer(y)).getEncoded(ASN1Encoding.DER);
        }

        return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new ASN1Integer(y)).getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:17,代码来源:JDKDSAPublicKey.java

示例4: BCDSAPublicKey

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
public BCDSAPublicKey(
    SubjectPublicKeyInfo info)
{

    ASN1Integer              derY;

    try
    {
        derY = (ASN1Integer)info.parsePublicKey();
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("invalid info structure in DSA public key");
    }

    this.y = derY.getValue();

    if (isNotNull(info.getAlgorithm().getParameters()))
    {
        DSAParameter params = DSAParameter.getInstance(info.getAlgorithm().getParameters());
        
        this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:25,代码来源:BCDSAPublicKey.java

示例5: JDKDSAPrivateKey

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
JDKDSAPrivateKey(
    PrivateKeyInfo  info)
    throws IOException
{
    DSAParameter    params = DSAParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters());
    DERInteger      derX = ASN1Integer.getInstance(info.parsePrivateKey());

    this.x = derX.getValue();
    this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:JDKDSAPrivateKey.java

示例6: getEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
/**
 * Return a PKCS8 representation of the key. The sequence returned
 * represents a full PrivateKeyInfo object.
 *
 * @return a PKCS8 representation of the key.
 */
public byte[] getEncoded()
{
    try
    {
        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new DERInteger(getX()));

        return info.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:JDKDSAPrivateKey.java

示例7: getEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
public byte[] getEncoded()
{
    if (dsaSpec == null)
    {
        return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa), new ASN1Integer(y));
    }

    return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG()).toASN1Primitive()), new ASN1Integer(y));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:10,代码来源:BCDSAPublicKey.java

示例8: engineGetEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
/**
 * Return the X.509 ASN.1 structure DSAParameter.
 * <p/>
 * <pre>
 *  DSAParameter ::= SEQUENCE {
 *                   prime INTEGER, -- p
 *                   subprime INTEGER, -- q
 *                   base INTEGER, -- g}
 * </pre>
 */
protected byte[] engineGetEncoded()
{
    DSAParameter dsaP = new DSAParameter(currentSpec.getP(), currentSpec.getQ(), currentSpec.getG());

    try
    {
        return dsaP.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Error encoding DSAParameters");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:AlgorithmParametersSpi.java

示例9: BCDSAPrivateKey

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
public BCDSAPrivateKey(
    PrivateKeyInfo info)
    throws IOException
{
    DSAParameter    params = DSAParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters());
    ASN1Integer      derX = (ASN1Integer)info.parsePrivateKey();

    this.x = derX.getValue();
    this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:BCDSAPrivateKey.java

示例10: JDKDSAPrivateKey

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
JDKDSAPrivateKey(
    PrivateKeyInfo  info)
    throws IOException
{
    DSAParameter    params = DSAParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters());
    ASN1Integer      derX = ASN1Integer.getInstance(info.parsePrivateKey());

    this.x = derX.getValue();
    this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:11,代码来源:JDKDSAPrivateKey.java

示例11: getEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
/**
 * Return a PKCS8 representation of the key. The sequence returned
 * represents a full PrivateKeyInfo object.
 *
 * @return a PKCS8 representation of the key.
 */
public byte[] getEncoded()
{
    try
    {
        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new ASN1Integer(getX()));

        return info.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        return null;
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:20,代码来源:JDKDSAPrivateKey.java

示例12: engineGetEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
/**
 * Return the X.509 ASN.1 structure DSAParameter.
 * <pre>
 *  DSAParameter ::= SEQUENCE {
 *                   prime INTEGER, -- p
 *                   subprime INTEGER, -- q
 *                   base INTEGER, -- g}
 * </pre>
 */
protected byte[] engineGetEncoded()
{
    DSAParameter dsaP = new DSAParameter(currentSpec.getP(), currentSpec.getQ(), currentSpec.getG());

    try
    {
        return dsaP.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Error encoding DSAParameters");
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:23,代码来源:AlgorithmParametersSpi.java

示例13: loadKeyPair

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
private static KeyPair loadKeyPair(PEMKeyPair privatekey)
		throws CertificateException {
	try {
		PEMKeyPair pair = (PEMKeyPair) privatekey;

		byte[] encodedPublicKey = pair.getPublicKeyInfo().getEncoded();
		byte[] encodedPrivateKey = pair.getPrivateKeyInfo().getEncoded();

		// Generate KeyPair.
		KeyFactory keyFactory = KeyFactory
				.getInstance(pair.getPublicKeyInfo().getAlgorithm()
						.getParameters() instanceof DSAParameter ? "DSA"
						: "RSA");

		X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(
				encodedPublicKey);
		PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);

		PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(
				encodedPrivateKey);
		PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);

		return new KeyPair(publicKey, privateKey);
	} catch (Exception e) {
		throw new CertificateException(
				"Failed to convert PEMKeyPair into JCE KeyPair", e);
	}
}
 
开发者ID:ludup,项目名称:hypersocket-framework,代码行数:29,代码来源:X509CertificateUtils.java

示例14: getEncoded

import org.bouncycastle.asn1.x509.DSAParameter; //导入依赖的package包/类
/**
 * Return a PKCS8 representation of the key. The sequence returned
 * represents a full PrivateKeyInfo object.
 *
 * @return a PKCS8 representation of the key.
 */
public byte[] getEncoded()
{
    return KeyUtil.getEncodedPrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG()).toASN1Primitive()), new ASN1Integer(getX()));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:BCDSAPrivateKey.java


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