Examples of initVerify()


Examples of java.security.Signature.initVerify()

                signature = bar.readBinaryString();
            }

            Signature s = Signature.getInstance("SHA1withRSA");
            s.initVerify(pubKey);
            s.update(data);

            return s.verify(signature);
        } catch (NoSuchAlgorithmException nsae) {
            throw new InvalidSignatureException();
View Full Code Here

Examples of java.security.Signature.initVerify()

                         int soffset = (((signature[20] & 0x80) == 0x80) ? 1 : 0);
                         System.arraycopy(signature, 20, encoded,
                asn1r.length + roffset + 20 + asn1s.length + soffset, 20);
             */
            Signature sig = Signature.getInstance("SHA1withDSA");
            sig.initVerify(pubkey);
            sig.update(data);

            return sig.verify(encoded);
        } catch (NoSuchAlgorithmException nsae) {
            throw new InvalidSignatureException();
View Full Code Here

Examples of java.security.Signature.initVerify()

      Signature verifier = null;
      try
      {
         verifier = Signature.getInstance(SigningAlgorithm.SHA256withRSA.getJavaSecNotation());
         verifier.initVerify(key);
      }
      catch (Exception e)
      {
         throw new SignatureException(e);
      }
View Full Code Here

Examples of java.security.Signature.initVerify()

            /*
             * Signature Objekt erzeugen mit mit public key verify
             */
            Signature sig = Signature.getInstance(SOSSignature.hashAlgorithm
                    + "With" + pubKey.getAlgorithm(), SOSSignature.provider);
            sig.initVerify(pubKey);

            /* lesen from file data update() */
            FileInputStream datafis = new FileInputStream(dataFile);
            BufferedInputStream bufin = new BufferedInputStream(datafis);
            byte[] buffer = new byte[1024];
View Full Code Here

Examples of java.security.Signature.initVerify()

      return false;
    }
    try {

      Signature sig = Signature.getInstance("SHA1withRSA");
      sig.initVerify(ks.getCertificate(ClientGameConfiguration.get("UPDATE_CERT_NAME")).getPublicKey());

      FileInputStream datafis = new FileInputStream(filename);
      InputStream buf = new BufferedInputStream(datafis);

      byte[] temp = new byte[1024];
View Full Code Here

Examples of java.security.Signature.initVerify()

        // Verify the signature on SPKAC
        String signAlgString = PKCSObjectIdentifiers.md5WithRSAEncryption.equals(alg0) ? "MD5withRSA" :
                               PKCSObjectIdentifiers.md2WithRSAEncryption.equals(alg0) ? "MD2withRSA" :
                               PKCSObjectIdentifiers.sha1WithRSAEncryption.equals(alg0) ? "SHA1withRSA" : null;
        Signature signObj = Signature.getInstance(signAlgString);
        signObj.initVerify(pubKey);
        signObj.update(pkacSeq.getEncoded());
        boolean verified = signObj.verify(signature);
        if(!verified) throw new Exception("SignedPublicKeyAndChallenge verification failed.");
        map.put(CERT_REQ_PUBLICKEY, pkInfo);
        map.put(CERT_REQ_PUBLICKEY_OBJ, pubKey);
View Full Code Here

Examples of java.security.Signature.initVerify()

                    sig = Signature.getInstance(signatureAlgorithm, provider);
                }
            }
        }

        sig.initVerify(this.getPublicKey(provider));

        try
        {
            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            DEROutputStream         dOut = new DEROutputStream(bOut);
View Full Code Here

Examples of java.security.Signature.initVerify()

    private boolean validate(byte[] signedContent, byte[] signatureValue, PublicKey validatingKey) throws GeneralSecurityException {
        String algo = validatingKey.getAlgorithm();
        Signature sig = getSignature(algo);

        sig.initVerify(validatingKey);
        sig.update(signedContent);
        return sig.verify(signatureValue);
    }

    private Signature getSignature(String algo) throws GeneralSecurityException {
View Full Code Here

Examples of java.security.Signature.initVerify()

            String serverKeyAlgorithm = readUTF();
            PublicKey spk = KeyFactory.getInstance(serverKeyAlgorithm).generatePublic(readKey());

            // verify the identity of the server
            Signature sig = Signature.getInstance("SHA1with"+serverKeyAlgorithm);
            sig.initVerify(spk);
            sig.update(spk.getEncoded());
            sig.update(sharedSecret);
            sig.verify((byte[]) readObject());

            return spk;
View Full Code Here

Examples of java.security.Signature.initVerify()

        if(key == null || curve == null || signature == null || data == null)
            return false;
        boolean result = false;
        try {
            Signature sig = Signature.getInstance(curve.defaultHashAlgorithm, curve.sigProvider);
            sig.initVerify(key);
      for(byte[] d: data)
        sig.update(d);
            result = sig.verify(signature, sigoffset, siglen);
        } catch (NoSuchAlgorithmException e) {
            Logger.error(ECDSA.class, "NoSuchAlgorithmException : "+e.getMessage(),e);
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.