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


Java DSAPublicKey.getParams方法代码示例

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


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

示例1: marshalPublicKey

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
@Override
void marshalPublicKey(XmlWriter xwriter, DSAPublicKey publicKey, String dsPrefix,
        XMLCryptoContext context)
    throws MarshalException
{
    DSAParams params = publicKey.getParams();

    xwriter.writeStartElement(dsPrefix, "DSAKeyValue", XMLSignature.XMLNS);

    // parameters J, Seed & PgenCounter are not included
    writeBase64BigIntegerElement(xwriter, dsPrefix, "P", XMLSignature.XMLNS, params.getP());
    writeBase64BigIntegerElement(xwriter, dsPrefix, "Q", XMLSignature.XMLNS, params.getQ());
    writeBase64BigIntegerElement(xwriter, dsPrefix, "G", XMLSignature.XMLNS, params.getG());
    writeBase64BigIntegerElement(xwriter, dsPrefix, "Y", XMLSignature.XMLNS, publicKey.getY() );

    xwriter.writeEndElement(); // "DSAKeyValue"
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:18,代码来源:DOMKeyValue.java

示例2: writePublicKey

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
public void writePublicKey(PublicKey pubKey) throws IOException {
	if (!(pubKey instanceof DSAPublicKey))
		throw new UnsupportedOperationException(
			"Key types other than DSA are not supported at the moment.");

	DSAPublicKey dsaKey = (DSAPublicKey) pubKey;

	writeShort(0);

	DSAParams dsaParams = dsaKey.getParams();
	writeBigInt(dsaParams.getP());
	writeBigInt(dsaParams.getQ());
	writeBigInt(dsaParams.getG());
	writeBigInt(dsaKey.getY());

}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:17,代码来源:SMPOutputStream.java

示例3: writePublicKey

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
public void writePublicKey(PublicKey pubKey) throws IOException {
    if (!(pubKey instanceof DSAPublicKey))
        throw new UnsupportedOperationException(
                "Key types other than DSA are not supported at the moment.");

    DSAPublicKey dsaKey = (DSAPublicKey) pubKey;

    writeShort(0);

    DSAParams dsaParams = dsaKey.getParams();
    writeBigInt(dsaParams.getP());
    writeBigInt(dsaParams.getQ());
    writeBigInt(dsaParams.getG());
    writeBigInt(dsaKey.getY());

}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:17,代码来源:OtrOutputStream.java

示例4: test_initializeLjava_security_spec_AlgorithmParameterSpec

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
/**
 * @tests java.security.KeyPairGenerator#initialize(java.security.spec.AlgorithmParameterSpec)
 */
@TestTargetNew(
    level = TestLevel.PARTIAL,
    notes = "InvalidAlgorithmParameterException checking missed",
    method = "initialize",
    args = {java.security.spec.AlgorithmParameterSpec.class}
)
public void test_initializeLjava_security_spec_AlgorithmParameterSpec()
        throws Exception {
    // create DSAParams
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
    keyPairGenerator.initialize(1024);
    DSAPublicKey key = (DSAPublicKey) keyPairGenerator.genKeyPair()
            .getPublic();
    DSAParams params = key.getParams();

    KeyPairGenerator keyPair = KeyPairGenerator.getInstance("DSA");
    keyPair.initialize(new DSAParameterSpec(params.getP(), params.getQ(),
            params.getG()));
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:KeyPairGenerator4Test.java

示例5: test_initializeLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
/**
 * @tests java.security.KeyPairGenerator#initialize(java.security.spec.AlgorithmParameterSpec,
 *        java.security.SecureRandom)
 */
@TestTargetNew(
    level = TestLevel.PARTIAL,
    notes = "InvalidAlgorithmParameterException checking missed",
    method = "initialize",
    args = {java.security.spec.AlgorithmParameterSpec.class, java.security.SecureRandom.class}
)
public void test_initializeLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom()
        throws Exception {
    // create DSAParams
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
    keyPairGenerator.initialize(1024);
    DSAPublicKey key = (DSAPublicKey) keyPairGenerator.genKeyPair()
            .getPublic();
    DSAParams params = key.getParams();

    KeyPairGenerator keyPair = KeyPairGenerator.getInstance("DSA");
    keyPair.initialize(new DSAParameterSpec(params.getP(), params.getQ(),
            params.getG()), new SecureRandom());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:24,代码来源:KeyPairGenerator4Test.java

示例6: DOMKeyValue

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
public DOMKeyValue(PublicKey key)  throws KeyException {
    if (key == null) {
        throw new NullPointerException("key cannot be null");
    }
    this.publicKey = key;
    if (key instanceof DSAPublicKey) {
        DSAPublicKey dkey = (DSAPublicKey) key;
        DSAParams params = dkey.getParams();
        p = new DOMCryptoBinary(params.getP());
        q = new DOMCryptoBinary(params.getQ());
        g = new DOMCryptoBinary(params.getG());
        y = new DOMCryptoBinary(dkey.getY());
    } else if (key instanceof RSAPublicKey) {
        RSAPublicKey rkey = (RSAPublicKey) key;
        exponent = new DOMCryptoBinary(rkey.getPublicExponent());
        modulus = new DOMCryptoBinary(rkey.getModulus());
    } else {
        throw new KeyException("unsupported key algorithm: " +
            key.getAlgorithm());
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:22,代码来源:DOMKeyValue.java

示例7: recoverKeyPair_Dsa

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
@Test
public void recoverKeyPair_Dsa() throws Exception {
	KeyPair kp = PubkeyUtils.recoverKeyPair(DSA_KEY_PKCS8);

	DSAPublicKey pubKey = (DSAPublicKey) kp.getPublic();

	assertEquals(DSA_KEY_pub, pubKey.getY());

	DSAParams params = pubKey.getParams();
	assertEquals(params.getG(), DSA_KEY_G);
	assertEquals(params.getP(), DSA_KEY_P);
	assertEquals(params.getQ(), DSA_KEY_Q);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:PubkeyUtilsTest.java

示例8: DSA

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
DSA(PublicKey key) throws KeyException {
    super(key);
    DSAPublicKey dkey = (DSAPublicKey) key;
    DSAParams params = dkey.getParams();
    p = new DOMCryptoBinary(params.getP());
    q = new DOMCryptoBinary(params.getQ());
    g = new DOMCryptoBinary(params.getG());
    y = new DOMCryptoBinary(dkey.getY());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:DOMKeyValue.java

示例9: encodeSSHDSAPublicKey

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
public static byte[] encodeSSHDSAPublicKey(DSAPublicKey pk) throws IOException
{
	TypesWriter tw = new TypesWriter();

	tw.writeString("ssh-dss");

	DSAParams params = pk.getParams();
	tw.writeMPInt(params.getP());
	tw.writeMPInt(params.getQ());
	tw.writeMPInt(params.getG());
	tw.writeMPInt(pk.getY());

	return tw.getBytes();
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:15,代码来源:DSASHA1Verify.java

示例10: testRecoverKeyPair_Dsa

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
public void testRecoverKeyPair_Dsa() throws Exception {
	KeyPair kp = PubkeyUtils.recoverKeyPair(DSA_KEY_PKCS8);

	DSAPublicKey pubKey = (DSAPublicKey) kp.getPublic();

	assertEquals(DSA_KEY_pub, pubKey.getY());

	DSAParams params = pubKey.getParams();
	assertEquals(params.getG(), DSA_KEY_G);
	assertEquals(params.getP(), DSA_KEY_P);
	assertEquals(params.getQ(), DSA_KEY_Q);
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:13,代码来源:PubkeyUtilsTest.java

示例11: areEqual

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
private boolean areEqual(DSAPublicKey pk1, DSAPublicKey pk2)
{
  if (pk1.getY().compareTo(pk2.getY()) != 0)
    return false;

  DSAParams p1 = pk1.getParams();
  DSAParams p2 = pk2.getParams();
  if (p1.getG().compareTo(p2.getG()) != 0)
    return false;

  if (p1.getP().compareTo(p2.getP()) != 0)
    return false;

  return p1.getQ().compareTo(p2.getQ()) == 0;
}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:ImportCmd.java

示例12: readSignature

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
public byte[] readSignature(PublicKey pubKey) throws IOException {
    if (!pubKey.getAlgorithm().equals("DSA"))
        throw new UnsupportedOperationException();

    DSAPublicKey dsaPubKey = (DSAPublicKey) pubKey;
    DSAParams dsaParams = dsaPubKey.getParams();
    byte[] sig = new byte[dsaParams.getQ().bitLength() / 4];
    read(sig);
    return sig;
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:11,代码来源:OtrInputStream.java

示例13: initVerify

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void initVerify() {
	if (verifyKey == null) {
		throw new IllegalStateException(
				"Verify key must be set prior to initialization.");
	}

	final DSAPublicKey pubKey = (DSAPublicKey) verifyKey;
	final DSAParams params = pubKey.getParams();
	final DSAPublicKeyParameters bcParams = new DSAPublicKeyParameters(
			pubKey.getY(), new DSAParameters(params.getP(), params.getQ(),
					params.getG()));
	init(false, bcParams);
}
 
开发者ID:shivam091,项目名称:Java-Security,代码行数:15,代码来源:DSASignature.java

示例14: test_initializeLjava_security_spec_AlgorithmParameterSpec

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
/**
 * @tests java.security.KeyPairGenerator#initialize(java.security.spec.AlgorithmParameterSpec)
 */
public void test_initializeLjava_security_spec_AlgorithmParameterSpec()
        throws Exception {
    // create DSAParams
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
    keyPairGenerator.initialize(1024);
    DSAPublicKey key = (DSAPublicKey) keyPairGenerator.genKeyPair()
            .getPublic();
    DSAParams params = key.getParams();

    KeyPairGenerator keyPair = KeyPairGenerator.getInstance("DSA");
    keyPair.initialize(new DSAParameterSpec(params.getP(), params.getQ(),
            params.getG()));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:KeyPairGenerator4Test.java

示例15: test_initializeLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom

import java.security.interfaces.DSAPublicKey; //导入方法依赖的package包/类
/**
 * @tests java.security.KeyPairGenerator#initialize(java.security.spec.AlgorithmParameterSpec,
 *        java.security.SecureRandom)
 */
public void test_initializeLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom()
        throws Exception {
    // create DSAParams
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
    keyPairGenerator.initialize(1024);
    DSAPublicKey key = (DSAPublicKey) keyPairGenerator.genKeyPair()
            .getPublic();
    DSAParams params = key.getParams();

    KeyPairGenerator keyPair = KeyPairGenerator.getInstance("DSA");
    keyPair.initialize(new DSAParameterSpec(params.getP(), params.getQ(),
            params.getG()), new SecureRandom());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:KeyPairGenerator4Test.java


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