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

cn.hyperchain.sdk.crypto.jce.ECSignatureFactory Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package cn.hyperchain.sdk.crypto.jce;

import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.Signature;

public final class ECSignatureFactory {

    public static final String RAW_ALGORITHM = "NONEwithECDSA";

    private static final String rawAlgorithmAssertionMsg =
            "Assumed the JRE supports NONEwithECDSA signatures";

    private ECSignatureFactory() {
    }

    public static Signature getRawInstance() {
        try {
            return Signature.getInstance(RAW_ALGORITHM);
        } catch (NoSuchAlgorithmException ex) {
            throw new AssertionError(rawAlgorithmAssertionMsg);
        }
    }

    public static Signature getRawInstance(final String provider) throws NoSuchProviderException {
        try {
            return Signature.getInstance(RAW_ALGORITHM, provider);
        } catch (NoSuchAlgorithmException ex) {
            throw new AssertionError(rawAlgorithmAssertionMsg);
        }
    }

    public static Signature getRawInstance(final Provider provider) {
        try {
            return Signature.getInstance(RAW_ALGORITHM, provider);
        } catch (NoSuchAlgorithmException ex) {
            throw new AssertionError(rawAlgorithmAssertionMsg);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy