Examples of initSign()


Examples of java.security.Signature.initSign()

        p = g.generateKeyPair();

        sKey = p.getPrivate();
        vKey = p.getPublic();

        s.initSign(sKey);

        s.update(data);

        sigBytes = s.sign();
View Full Code Here

Examples of java.security.Signature.initSign()

        PublicKey   vKey = p.getPublic();

        Signature           s = Signature.getInstance("GOST3410", "BC");
        byte[]              data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };

        s.initSign(sKey);

        s.update(data);

        byte[]  sigBytes = s.sign();
View Full Code Here

Examples of java.security.Signature.initSign()

        // 512 test -with zero salt length
        //
        s = Signature.getInstance("SHA512withRSAandMGF1", "BC");
       
        s.setParameter(new PSSParameterSpec("SHA-512", "MGF1", new MGF1ParameterSpec("SHA-512"), 0, 1));
        s.initSign(privKey);

        s.update(msg1a);
        sig = s.sign();

        pss = s.getParameters();
View Full Code Here

Examples of java.security.Signature.initSign()

        // Make sure we generate the same 'random' salt for both normal and raw signers
        int saltLen = spec.getSaltLength();
        byte[] fixedRandomBytes = new byte[saltLen];
        random.nextBytes(fixedRandomBytes);

        normalSig.initSign(privKey, new FixedSecureRandom(fixedRandomBytes));
        normalSig.update(sampleMessage);
        byte[] normalResult = normalSig.sign();

        MessageDigest digest = MessageDigest.getInstance(digestOID.getId(), "BC");
        byte[] hash = digest.digest(sampleMessage);
View Full Code Here

Examples of java.security.Signature.initSign()

        Signature rawSig = Signature.getInstance("RAWRSASSA-PSS", "BC");

        // Need to init the params explicitly to avoid having a 'raw' variety of every PSS algorithm
        rawSig.setParameter(spec);

        rawSig.initSign(privKey, new FixedSecureRandom(fixedRandomBytes));
        rawSig.update(hash);
        byte[] rawResult = rawSig.sign();

        if (!Arrays.areEqual(normalResult, rawResult))
        {
View Full Code Here

Examples of java.security.Signature.initSign()

        Signature           sgr = Signature.getInstance("ECDSA", "BC");
        KeyFactory          f = KeyFactory.getInstance("ECDSA", "BC");
        PrivateKey          sKey = f.generatePrivate(priKey);
        PublicKey           vKey = f.generatePublic(pubKey);

        sgr.initSign(sKey, k);

        byte[] message = new byte[] { (byte)'a', (byte)'b', (byte)'c' };

        sgr.update(message);
View Full Code Here

Examples of java.security.Signature.initSign()

        KeyFactory  f = KeyFactory.getInstance("ECDSA", "BC");
        PrivateKey  sKey = f.generatePrivate(priKeySpec);
        PublicKey   vKey = f.generatePublic(pubKeySpec);
        byte[]      message = new byte[] { (byte)'a', (byte)'b', (byte)'c' };
      
        sgr.initSign(sKey, k);

        sgr.update(message);
       
        byte[]  sigBytes = sgr.sign();
View Full Code Here

Examples of java.security.Signature.initSign()

        KeyPair p = g.generateKeyPair();

        PrivateKey sKey = p.getPrivate();
        PublicKey  vKey = p.getPublic();

        s.initSign(sKey);

        s.update(data);

        byte[] sigBytes = s.sign();
View Full Code Here

Examples of java.security.Signature.initSign()

        final PublicKey  pubKey = pair.getPublic();

        Signature s = Signature.getInstance("ECDSA", "BC");

        // raw interface tests
        s.initSign(new PrivateKey()
        {
            public String getAlgorithm()
            {
                return privKey.getAlgorithm();
            }
View Full Code Here

Examples of java.security.Signature.initSign()

                return pubKey.getEncoded();
            }
        });


        s.initSign(new ECPrivateKey()
        {
            public String getAlgorithm()
            {
                return privKey.getAlgorithm();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.