Examples of SHA256Digest


Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class dsa256
        extends JDKDSASigner
    {
        public dsa256()
        {
            super(new SHA256Digest(), new DSASigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class ecDSA256
        extends JDKDSASigner
    {
        public ecDSA256()
        {
            super(new SHA256Digest(), new ECDSASigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class ecNR256
        extends JDKDSASigner
    {
        public ecNR256()
        {
            super(new SHA256Digest(), new ECNRSigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

        {
            hashAlg = new SHA512Digest();
        }
        else if ("SHA-256".equals(alg))
        {
            hashAlg = new SHA256Digest();
        }
        init();
    }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class McEliecePointcheval256
        extends McEliecePointchevalCipherSpi
    {
        public McEliecePointcheval256()
        {
            super(new SHA256Digest(), new McEliecePointchevalCipher());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class McElieceKobaraImai256
        extends McElieceKobaraImaiCipherSpi
    {
        public McElieceKobaraImai256()
        {
            super(new SHA256Digest(), new McElieceKobaraImaiCipher());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    public static String pbeEncryptStringWithSha256Aes192(final String in) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
      if (CryptoProviderTools.isUsingExportableCryptography()) {
        log.warn("Obfuscation not possible due to weak crypto policy.");
        return in;
      }
        final Digest digest = new SHA256Digest();
       
        final PKCS12ParametersGenerator   pGen = new PKCS12ParametersGenerator(digest);
        pGen.init(
                PBEParametersGenerator.PKCS12PasswordToBytes(p),
                getSalt(),
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

        return "SHA256";
    }

    public TestResult perform()
    {
        Digest  digest = new SHA256Digest();
        byte[]  resBuf = new byte[digest.getDigestSize()];
        String  resStr;

        //
        // test 1
        //
        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec1.equals(resStr))
        {
            return new SimpleTestResult(false,
                "SHA-256 failing standard vector test 1"
                + System.getProperty("line.separator")
                + "    expected: " + resVec1
                + System.getProperty("line.separator")
                + "    got     : " + resStr);
        }

        //
        // test 2
        //
        byte[]  bytes = Hex.decode(testVec2);

        digest.update(bytes, 0, bytes.length);

        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec2.equals(resStr))
        {
            return new SimpleTestResult(false,
                "SHA-256 failing standard vector test 2"
                + System.getProperty("line.separator")
                + "    expected: " + resVec2
                + System.getProperty("line.separator")
                + "    got     : " + resStr);
        }

        //
        // test 3
        //
        bytes = Hex.decode(testVec3);

        digest.update(bytes, 0, bytes.length);

        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec3.equals(resStr))
        {
            return new SimpleTestResult(false,
                "SHA-256 failing standard vector test 3"
                + System.getProperty("line.separator")
                + "    expected: " + resVec3
                + System.getProperty("line.separator")
                + "    got     : " + resStr);
        }

        //
        // test 4
        //
        bytes = Hex.decode(testVec4);

        digest.update(bytes, 0, bytes.length);

        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec4.equals(resStr))
        {
            return new SimpleTestResult(false,
                "SHA-256 failing standard vector test 4"
                + System.getProperty("line.separator")
                + "    expected: " + resVec4
                + System.getProperty("line.separator")
                + "    got     : " + resStr);
        }

        //
        // test 5
        //
        bytes = Hex.decode(testVec4);

        digest.update(bytes, 0, bytes.length/2);

        // clone the Digest
        Digest d = new SHA256Digest((SHA256Digest)digest);

        digest.update(bytes, bytes.length/2, bytes.length - bytes.length/2);
        digest.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec4.equals(resStr))
        {
            return new SimpleTestResult(false,
                "SHA256 failing standard vector test 5"
                + System.getProperty("line.separator")
                + "    expected: " + resVec4
                + System.getProperty("line.separator")
                + "    got     : " + resStr);
        }

        d.update(bytes, bytes.length/2, bytes.length - bytes.length/2);
        d.doFinal(resBuf, 0);

        resStr = new String(Hex.encode(resBuf));
        if (!resVec4.equals(resStr))
        {
            return new SimpleTestResult(false,
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class dsa256
        extends JDKDSASigner
    {
        public dsa256()
        {
            super(new SHA256Digest(), new DSASigner());
        }
View Full Code Here

Examples of org.bouncycastle.crypto.digests.SHA256Digest

    static public class ecDSA256
        extends Signature
    {
        public ecDSA256()
        {
            super(new SHA256Digest(), new ECDSASigner(), new StdDSAEncoder());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.