Package gnu.java.security.sig.dss

Examples of gnu.java.security.sig.dss.DSSSignature


    harness.checkPoint("TestOfDSSSignature");

    DSAPublicKey publicK = new DSSPublicKey(Registry.ASN1_ENCODING_ID, p, q, g, y);
    DSAPrivateKey privateK = new DSSPrivateKey(Registry.ASN1_ENCODING_ID, p, q, g, x);

    DSSSignature alice = new DSSSignature();
    DSSSignature bob = (DSSSignature) alice.clone();

    byte[] message = "1 if by land, 2 if by sea...".getBytes();

    HashMap map = new HashMap();
    map.put(BaseSignature.SIGNER_KEY, privateK);
    alice.setupSign(map);
    alice.update(message, 0, message.length);
    Object signature = alice.sign();

    map.put(BaseSignature.VERIFIER_KEY, publicK);
    bob.setupVerify(map);
    bob.update(message, 0, message.length);

    harness.check(bob.verify(signature), "instance methods");

    IMessageDigest sha = new Sha160();
    sha.update(message, 0, message.length);
    byte[] hash = sha.digest();
    BigInteger[] rs = DSSSignature.sign(privateK, hash);
View Full Code Here

TOP

Related Classes of gnu.java.security.sig.dss.DSSSignature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.