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

org.bouncycastle.operator.jcajce.OutputStreamFactory Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified.

There is a newer version: 2.0.7
Show newest version
package org.bouncycastle.operator.jcajce;

import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.Signature;

import javax.crypto.Mac;

/**
 * Utility class for creating OutputStreams from different JCA/JCE operators.
 */
class OutputStreamFactory
{
    /**
     * Create an OutputStream that wraps a signature.
     *
     * @param signature the signature to be updated as the stream is written to.
     * @return an OutputStream.
     */
    public static OutputStream createStream(Signature signature)
    {
        return new SignatureUpdatingOutputStream(signature);
    }

    /**
     * Create an OutputStream that wraps a digest.
     *
     * @param digest the digest to be updated as the stream is written to.
     * @return an OutputStream.
     */
    public static OutputStream createStream(MessageDigest digest)
    {
        return new DigestUpdatingOutputStream(digest);
    }

    /**
     * Create an OutputStream that wraps a mac.
     *
     * @param mac the signature to be updated as the stream is written to.
     * @return an OutputStream.
     */
    public static OutputStream createStream(Mac mac)
    {
        return new MacUpdatingOutputStream(mac);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy