All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.open.jwtdependency.org.bouncycastle.crypto.digests.NonMemoableDigest Maven / Gradle / Ivy

Go to download

This is a drop in replacement for the auth0 java-jwt library (see https://github.com/auth0/java-jwt). This jar makes sure there are no external dependencies (e.g. fasterXml, Apacha Commons) needed. This is useful when deploying to an application server (e.g. tomcat with Alfreso or Pega).

The newest version!
package org.bouncycastle.crypto.digests;

import org.bouncycastle.crypto.ExtendedDigest;

/**
 * Wrapper removes exposure to the Memoable interface on an ExtendedDigest implementation.
 */
public class NonMemoableDigest
    implements ExtendedDigest
{
    private ExtendedDigest baseDigest;

    /**
     * Base constructor.
     *
     * @param baseDigest underlying digest to use.
     * @exception IllegalArgumentException if baseDigest is null
     */
    public NonMemoableDigest(
        ExtendedDigest baseDigest)
    {
        if (baseDigest == null)
        {
            throw new IllegalArgumentException("baseDigest must not be null");
        }

        this.baseDigest = baseDigest;
    }
    
    public String getAlgorithmName()
    {
        return baseDigest.getAlgorithmName();
    }

    public int getDigestSize()
    {
        return baseDigest.getDigestSize();
    }

    public void update(byte in)
    {
        baseDigest.update(in);
    }

    public void update(byte[] in, int inOff, int len)
    {
        baseDigest.update(in, inOff, len);
    }

    public int doFinal(byte[] out, int outOff)
    {
        return baseDigest.doFinal(out, outOff);
    }

    public void reset()
    {
        baseDigest.reset();
    }

    public int getByteLength()
    {
        return baseDigest.getByteLength();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy