Java 8 Signature - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Signature class.

This code example shows how to use the following methods: getAlgorithm, getProvider, setParameter
        DEREncodable params) 
        throws NoSuchAlgorithmException, SignatureException, InvalidKeyException 
    { 
        if (params != null && !derNull.equals(params))
        { 
            AlgorithmParameters  sigParams = AlgorithmParameters.getInstance(signature.getAlgorithm(), signature.getProvider());
             
            try 
            { 
                sigParams.init(params.getDERObject().getDEREncoded());
            } 
            catch (IOException e)
            { 
                throw new SignatureException("IOException decoding parameters: " + e.getMessage());
            } 
             
            if (signature.getAlgorithm().endsWith("MGF1"))
            { 
                try 
                { 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getAlgorithm, getProvider, setParameter
        DEREncodable params) 
        throws NoSuchAlgorithmException, SignatureException, InvalidKeyException 
    { 
        if (params != null && !derNull.equals(params))
        { 
            AlgorithmParameters  sigParams = AlgorithmParameters.getInstance(signature.getAlgorithm(), signature.getProvider());
             
            try 
            { 
                sigParams.init(params.getDERObject().getDEREncoded());
            } 
            catch (IOException e)
            { 
                throw new SignatureException("IOException decoding parameters: " + e.getMessage());
            } 
             
            if (signature.getAlgorithm().endsWith("MGF1"))
            { 
                try 
                { 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: initSign, initVerify, sign, update, verify
KeyFactory          f = KeyFactory.getInstance("ECDSA", "BC");
        PrivateKey          sKey = f.generatePrivate(priKey);
        PublicKey           vKey = f.generatePublic(pubKey);
 
        sgr.initSign(sKey, k);
 
        sgr.update(message);
 
        byte[]  sigBytes = sgr.sign();
 
        sgr.initVerify(vKey);
 
        sgr.update(message);
 
        if (!sgr.verify(sigBytes))
        { 
            fail(size + " bit EC verification failed");
        } 
 
        BigInteger[]  sig = derDecode(sigBytes);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: initSign, sign, update
		KeyPair keyPair = keyPairGen.generateKeyPair();
//		PublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); 
		PrivateKey privateKey = keyPair.getPrivate();
		signature = Signature.getInstance("SHA1withECDSA");
 
		signature.initSign(privateKey);
		 
		signature.update(plainBytes);
		signedBytes = signature.sign();
	} 
	//  
 
	public void execute() throws Exception { 
		signature.update(plainBytes);
		signedBytes = signature.sign();
	} 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: initSign, sign, update
    } 
 
    private void doTestHMACDetECDSA(Signature detSigner, byte[] data, PrivateKey privKey, BigInteger r, BigInteger s)
        throws Exception 
    { 
        detSigner.initSign(privKey);
 
        detSigner.update(data, 0, data.length);
 
        byte[] m = detSigner.sign();
 
        ASN1Sequence seq = ASN1Sequence.getInstance(m);
 
 
        if (!r.equals(ASN1Integer.getInstance(seq.getObjectAt(0)).getValue()))
        { 
            fail("r value wrong"); 
        } 
        if (!s.equals(ASN1Integer.getInstance(seq.getObjectAt(1)).getValue()))
        { 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 Signature Methods: