예제 #1
0
    public virtual IDigest ForkPrfHash()
    {
        CheckStopBuffering();
        byte b = (byte)mPrfHashAlgorithm;

        if (mBuf != null)
        {
            IDigest digest = TlsUtilities.CreateHash(b);
            mBuf.UpdateDigest(digest);
            return(digest);
        }
        return(TlsUtilities.CloneHash(b, (IDigest)mHashes[b]));
    }
예제 #2
0
        public virtual TlsHandshakeHash StopTracking()
        {
            byte    prfHashAlgorithm = (byte)mPrfHashAlgorithm;
            IDigest prfHash          = TlsUtilities.CloneHash(prfHashAlgorithm, (IDigest)mHashes[prfHashAlgorithm]);

            if (mBuf != null)
            {
                mBuf.UpdateDigest(prfHash);
            }
            DeferredHash result = new DeferredHash(prfHashAlgorithm, prfHash);

            result.Init(mContext);
            return(result);
        }
예제 #3
0
    public virtual TlsHandshakeHash StopTracking()
    {
        byte    b      = (byte)mPrfHashAlgorithm;
        IDigest digest = TlsUtilities.CloneHash(b, (IDigest)mHashes[b]);

        if (mBuf != null)
        {
            mBuf.UpdateDigest(digest);
        }
        DeferredHash deferredHash = new DeferredHash(b, digest);

        deferredHash.Init(mContext);
        return(deferredHash);
    }
예제 #4
0
        public virtual IDigest ForkPrfHash()
        {
            CheckStopBuffering();

            byte prfHashAlgorithm = (byte)mPrfHashAlgorithm;

            if (mBuf != null)
            {
                IDigest prfHash = TlsUtilities.CreateHash(prfHashAlgorithm);
                mBuf.UpdateDigest(prfHash);
                return(prfHash);
            }

            return(TlsUtilities.CloneHash(prfHashAlgorithm, (IDigest)mHashes[prfHashAlgorithm]));
        }
예제 #5
0
    public virtual byte[] GetFinalHash(byte hashAlgorithm)
    {
        IDigest digest = (IDigest)mHashes[hashAlgorithm];

        if (digest == null)
        {
            throw new InvalidOperationException("HashAlgorithm." + HashAlgorithm.GetText(hashAlgorithm) + " is not being tracked");
        }
        digest = TlsUtilities.CloneHash(hashAlgorithm, digest);
        if (mBuf != null)
        {
            mBuf.UpdateDigest(digest);
        }
        return(DigestUtilities.DoFinal(digest));
    }
예제 #6
0
 internal CombinedHash(CombinedHash t)
 {
     this.mContext = t.mContext;
     this.mMd5     = TlsUtilities.CloneHash(HashAlgorithm.md5, t.mMd5);
     this.mSha1    = TlsUtilities.CloneHash(HashAlgorithm.sha1, t.mSha1);
 }
예제 #7
0
 internal CombinedHash(CombinedHash t)
 {
     mContext = t.mContext;
     mMd5     = TlsUtilities.CloneHash(1, t.mMd5);
     mSha1    = TlsUtilities.CloneHash(2, t.mSha1);
 }