more tests, initial RSA and ECC test stubs
parent
d8afacd8d1
commit
18582e10c4
|
|
@ -0,0 +1,50 @@
|
|||
/* WolfCryptECCTest.java
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CyaSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
package com.wolfssl;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import com.wolfssl.wolfcrypt.ECC;
|
||||
|
||||
public class WolfCryptECCTest {
|
||||
|
||||
ECC ecc;
|
||||
|
||||
@Test
|
||||
public void testECC() throws WolfSSLException {
|
||||
|
||||
System.out.println("ECC Class");
|
||||
|
||||
test_ECC_new();
|
||||
}
|
||||
|
||||
public void test_ECC_new() {
|
||||
|
||||
System.out.print("\tECC()");
|
||||
ecc = new ECC();
|
||||
System.out.println("\t\t\t... passed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/* WolfCryptRSATest.java
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CyaSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
package com.wolfssl;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import com.wolfssl.wolfcrypt.RSA;
|
||||
|
||||
public class WolfCryptRSATest {
|
||||
|
||||
RSA rsa;
|
||||
|
||||
@Test
|
||||
public void testRSA() throws WolfSSLException {
|
||||
|
||||
System.out.println("RSA Class");
|
||||
|
||||
test_RSA_new();
|
||||
}
|
||||
|
||||
public void test_RSA_new() {
|
||||
|
||||
System.out.print("\tRSA()");
|
||||
rsa = new RSA();
|
||||
System.out.println("\t\t\t... passed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* WolfSSLTest.java
|
||||
/* WolfSSLContextTest.java
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
|
|
@ -30,20 +30,15 @@ import com.wolfssl.WolfSSL;
|
|||
|
||||
public class WolfSSLContextTest {
|
||||
|
||||
WolfSSLContext ctx;
|
||||
|
||||
@Test
|
||||
public void testWolfSSLContext() throws WolfSSLException {
|
||||
|
||||
WolfSSL lib = null;
|
||||
|
||||
try {
|
||||
lib = new WolfSSL();
|
||||
} catch (WolfSSLException e) {
|
||||
fail("failed to create WolfSSL object");
|
||||
}
|
||||
|
||||
System.out.println("WolfSSLContext Class");
|
||||
|
||||
test_WolfSSLContext_new(lib.SSLv23_ServerMethod());
|
||||
test_WolfSSLContext_new(WolfSSL.SSLv23_ServerMethod());
|
||||
test_WolfSSLContext_free();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -52,18 +47,17 @@ public class WolfSSLContextTest {
|
|||
if (method != 0)
|
||||
{
|
||||
System.out.print("\tWolfSSLContext()");
|
||||
WolfSSLContext wc = null;
|
||||
|
||||
/* test failure case */
|
||||
try {
|
||||
|
||||
wc = new WolfSSLContext(0);
|
||||
ctx = new WolfSSLContext(0);
|
||||
|
||||
} catch (WolfSSLException e) {
|
||||
|
||||
/* now test success case */
|
||||
try {
|
||||
wc = new WolfSSLContext(method);
|
||||
ctx = new WolfSSLContext(method);
|
||||
} catch (WolfSSLException we) {
|
||||
System.out.println("\t... failed");
|
||||
fail("failed to create WolfSSLContext object");
|
||||
|
|
@ -77,5 +71,12 @@ public class WolfSSLContextTest {
|
|||
fail("failure case improperly succeeded, WolfSSLContext()");
|
||||
}
|
||||
}
|
||||
|
||||
public void test_WolfSSLContext_free() {
|
||||
|
||||
System.out.print("\tfree()");
|
||||
ctx.free();
|
||||
System.out.println("\t\t\t... passed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* WolfSSLTest.java
|
||||
/* WolfSSLSessionTest.java
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
|
|
@ -30,22 +30,22 @@ import com.wolfssl.WolfSSL;
|
|||
|
||||
public class WolfSSLSessionTest {
|
||||
|
||||
WolfSSLContext ctx;
|
||||
WolfSSLSession ssl;
|
||||
|
||||
@Test
|
||||
public void testWolfSSLSession() throws WolfSSLException {
|
||||
|
||||
WolfSSLContext ctx = null;
|
||||
WolfSSLSession ssl = null;
|
||||
|
||||
ctx = new WolfSSLContext(WolfSSL.SSLv23_ClientMethod());
|
||||
|
||||
System.out.println("WolfSSLSession Class");
|
||||
|
||||
test_WolfSSLSession_new(ssl, ctx);
|
||||
test_WolfSSLSession_new();
|
||||
test_WolfSSLSession_freeSSL();
|
||||
|
||||
}
|
||||
|
||||
public void test_WolfSSLSession_new(WolfSSLSession ssl,
|
||||
WolfSSLContext ctx) {
|
||||
public void test_WolfSSLSession_new() {
|
||||
|
||||
try {
|
||||
System.out.print("\tWolfSSLSession()");
|
||||
|
|
@ -57,5 +57,12 @@ public class WolfSSLSessionTest {
|
|||
|
||||
System.out.println("\t... passed");
|
||||
}
|
||||
|
||||
public void test_WolfSSLSession_freeSSL() {
|
||||
|
||||
System.out.print("\tfreeSSL()");
|
||||
ssl.freeSSL();
|
||||
System.out.println("\t\t... passed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* WolfSSLTest.java
|
||||
/* WolfSSLTestSuite.java
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
|
|
@ -28,7 +28,9 @@ import org.junit.runners.Suite;
|
|||
@Suite.SuiteClasses({
|
||||
WolfSSLTest.class,
|
||||
WolfSSLContextTest.class,
|
||||
WolfSSLSessionTest.class
|
||||
WolfSSLSessionTest.class,
|
||||
WolfCryptRSATest.class,
|
||||
WolfCryptECCTest.class
|
||||
})
|
||||
|
||||
public class WolfSSLTestSuite {
|
||||
|
|
|
|||
Loading…
Reference in New Issue