Examples of NtruEncryptKey


Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case GPB-2.
    @Test(expected=ObjectClosedException.class)
    public void test_getPubKey_closed()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPubKeyBlob(test));
            k.close();
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        k.getPubKey();
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    {
        for (OID oid : OID.values())
        {
            NtruEncryptTestVector test  = findTest(oid);
            byte blob[]      = getPubKeyBlob(test);
            NtruEncryptKey k = new NtruEncryptKey(blob);
            byte blob2[] = k.getPubKey();
            assertArrayEquals(blob2, blob);
            if (oid == OID.ees401ep1)
              assertEquals(blob.length, 556);
            else if (oid == OID.ees449ep1)
              assertEquals(blob.length, 622);
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case GPR-3.
    @Test(expected=ObjectClosedException.class)
    public void test_getPrivKey_closed()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPrivKeyBlob(test));
            k.close();
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        k.getPrivKey();
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case GPR-2.
    @Test(expected=NoPrivateKeyException.class)
    public void test_getPrivKey_noPrivKey()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPubKeyBlob(test));
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        k.getPrivKey();
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    {
        for (OID oid : OID.values())
        {
            NtruEncryptTestVector test  = findTest(oid);
            byte blob[]      = getPrivKeyBlob(test);
            NtruEncryptKey k = new NtruEncryptKey(blob);
            byte blob2[] = k.getPrivKey();
            assertArrayEquals(blob2, blob);
        }
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case NEP-4.
    @Test(expected=ObjectClosedException.class)
    public void test_encrypt_closed()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPubKeyBlob(test));
            k.close();
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        k.encrypt(defaultSeed, defaultPrng);
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case NEP-2.
    @Test(expected=NullPointerException.class)
    public void test_encrypt_nullPlaintext()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPubKeyBlob(test));
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        k.encrypt(null, defaultPrng);
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case NEP-5.
    @Test(expected=NullPointerException.class)
    public void test_encrypt_nullPrng()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPubKeyBlob(test));
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        k.encrypt(defaultSeed, (Random)null);
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

    // Implements test case NEP-3.
    @Test(expected=PlaintextBadLengthException.class)
    public void test_encrypt_messageTooLong()
        throws NtruException
    {
        NtruEncryptKey k = null;
        try
        {
            NtruEncryptTestVector test    = findTest(OID.ees401ep1);
            k = new NtruEncryptKey(getPubKeyBlob(test));
        }
        catch (Throwable t)
        {
            fail("Unexpected exception " + t);
        }
        byte b[] = new byte[2*1024];
        k.encrypt(b, defaultPrng);
    }
View Full Code Here

Examples of com.securityinnovation.jNeo.ntruencrypt.NtruEncryptKey

                               oidBytes[2]);

            byte seed[] = makeSeed(oid, "keygen");
            TVDump.dumpHex("keygenSeed", seed);
            Random r = new Random(seed);
            NtruEncryptKey key = NtruEncryptKey.genKey(oid, r);

            seed = makeSeed(oid, "encrypt");
            TVDump.dumpHex("encryptSeed", seed);
            r.seed(seed);
            byte ct[] = key.encrypt(m, r);
            key.decrypt(ct);

            System.out.println("\n\n");
        }
    }
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.