Package java.security

Examples of java.security.DigestOutputStream


        ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);

        long h = 0;
        try {
            MessageDigest md = MessageDigest.getInstance("SHA");
            DigestOutputStream mdo = new DigestOutputStream(devnull, md);
            DataOutputStream data = new DataOutputStream(mdo);

            if (DEBUG_SVUID)
                msg( "\twriteUTF( \"" + cl.getName() + "\" )" ) ;
            data.writeUTF(cl.getName());
View Full Code Here


            if (java.io.Externalizable.class.isAssignableFrom(cl)) {
                return 1;
            }

            MessageDigest md = MessageDigest.getInstance("SHA");
            DigestOutputStream mdo = new DigestOutputStream(devnull, md);
            DataOutputStream data = new DataOutputStream(mdo);

            // Get SUID of parent
            Class parent = cl.getSuperclass();
            if ((parent != null))
View Full Code Here

            if (java.io.Externalizable.class.isAssignableFrom(cl)) {
                return 1;
            }

            MessageDigest md = MessageDigest.getInstance("SHA");
            DigestOutputStream mdo = new DigestOutputStream(devnull, md);
            DataOutputStream data = new DataOutputStream(mdo);

            // Get SUID of parent
            Class parent = cl.getSuperclass();
            if ((parent != null))
View Full Code Here

        ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);

        long h = 0;
        try {
            MessageDigest md = MessageDigest.getInstance("SHA");
            DigestOutputStream mdo = new DigestOutputStream(devnull, md);
            DataOutputStream data = new DataOutputStream(mdo);


            data.writeUTF(cl.getName());
View Full Code Here

    public byte[] getHash() {
        if (hash == null) {
            try {
                MessageDigest d = MessageDigest.getInstance("SHA-1");
                DigestOutputStream out = new DigestOutputStream(new OutputStream() {
                    @Override
                    public void write(byte[] buff, int off, int length) {
                        // ignore
                    }
                    @Override
View Full Code Here

            usesIdentifier(tempId);
            // Copy the stream to the temporary file and calculate the
            // stream length and the message digest of the stream
            long length = 0;
            MessageDigest digest = MessageDigest.getInstance(DIGEST);
            OutputStream output = new DigestOutputStream(
                    new FileOutputStream(temporary), digest);
            try {
                length = IOUtils.copyLarge(input, output);
            } finally {
                output.close();
            }
            DataIdentifier identifier = new DataIdentifier(digest.digest());
            File file;

            synchronized (this) {
View Full Code Here

      this.key = key;
      this.backupFile = newBackupFile();
      LOG.info("OutputStream for key '" + key + "' writing to tempfile '" + this.backupFile + "'");
      try {
        this.digest = MessageDigest.getInstance("MD5");
        this.backupStream = new BufferedOutputStream(new DigestOutputStream(
            new FileOutputStream(backupFile), this.digest));
      } catch (NoSuchAlgorithmException e) {
        LOG.warn("Cannot load MD5 digest algorithm," +
            "skipping message integrity check.", e);
        this.backupStream = new BufferedOutputStream(
View Full Code Here

      //
      // Write out data
      //
      MessageDigest digester = MD5Hash.getDigester();
      FileOutputStream fout = new FileOutputStream(newFile);
      DigestOutputStream fos = new DigestOutputStream(fout, digester);
      DataOutputStream out = new DataOutputStream(fos);
      try {
        out.writeInt(HdfsConstants.LAYOUT_VERSION);
        // We use the non-locked version of getNamespaceInfo here since
        // the coordinating thread of saveNamespace already has read-locked
View Full Code Here

        assert path != null : "Expect SWF path";

        final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(new File(directory, path)));
        ISWFWriter swfWriter = swfWriterFactory.createSWFWriter(swf,
                getLibrarySWFCompression(), enableDebug);
        final DigestOutputStream digestStream = getDigestOutputStream(library, outputStream);
       
        swfWriter.writeTo(digestStream != null ? digestStream : outputStream);
        swfWriter.close();
        outputStream.close();
View Full Code Here

     *
     * @return a digest stream if a digest is needed, null otherwise.
     */
    protected DigestOutputStream getDigestOutputStream(ISWCLibrary library, OutputStream outputStream)
    {
        DigestOutputStream digestStream = null;
        MessageDigest messageDigest = null;
        if (!hasUnsignedDigest(library))
        {
            try
            {
                messageDigest = MessageDigest.getInstance(SWCDigest.SHA_256);
                digestStream = new DigestOutputStream(outputStream, messageDigest);
            }
            catch (NoSuchAlgorithmException e)
            {
                // Eat the exception, this should never happen in a
                // production environment.
View Full Code Here

TOP

Related Classes of java.security.DigestOutputStream

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.