Search in sources :

Example 1 with PRFDProxy

use of org.mozilla.jss.nss.PRFDProxy in project jss by dogtagpki.

the class TestPRFD method TestPROpenWriteClose.

public static void TestPROpenWriteClose() {
    PRFDProxy fd = PR.Open("results/prfd_open_write_close", 0x04 | 0x08, 00644);
    assert (fd != null);
    byte[] data = { 0x2a, 0x20, 0x2a, 0x20 };
    assert (PR.Write(fd, data) == 4);
    assert (PR.Close(fd) == PR.SUCCESS);
}
Also used : PRFDProxy(org.mozilla.jss.nss.PRFDProxy)

Example 2 with PRFDProxy

use of org.mozilla.jss.nss.PRFDProxy in project jss by dogtagpki.

the class TestPRFD method TestPREmptyRead.

public static void TestPREmptyRead() {
    PRFDProxy fd = PR.Open("results/prfd_open_close", 0x04, 00644);
    assert (fd != null);
    byte[] read_data = PR.Read(fd, 10);
    assert (read_data == null || read_data.length == 0);
    assert (PR.Close(fd) == PR.SUCCESS);
}
Also used : PRFDProxy(org.mozilla.jss.nss.PRFDProxy)

Example 3 with PRFDProxy

use of org.mozilla.jss.nss.PRFDProxy in project jss by dogtagpki.

the class TestPRFD method TestShutdown.

public static void TestShutdown() {
    PRFDProxy fd = PR.NewTCPSocket();
    assert (fd != null);
    PR.Shutdown(fd, PR.SHUTDOWN_RCV);
    PR.Shutdown(fd, PR.SHUTDOWN_SEND);
    PR.Shutdown(fd, PR.SHUTDOWN_BOTH);
    assert (PR.Close(fd) == PR.SUCCESS);
}
Also used : PRFDProxy(org.mozilla.jss.nss.PRFDProxy)

Example 4 with PRFDProxy

use of org.mozilla.jss.nss.PRFDProxy in project jss by dogtagpki.

the class TestRawSSL method TestSSLImportFD.

public static void TestSSLImportFD() throws Exception {
    PRFDProxy fd = PR.NewTCPSocket();
    assert (fd != null);
    SSLFDProxy ssl_fd = SSL.ImportFD(null, fd);
    assert (ssl_fd != null);
    assert (PR.Close(ssl_fd) == PR.SUCCESS);
}
Also used : PRFDProxy(org.mozilla.jss.nss.PRFDProxy) SSLFDProxy(org.mozilla.jss.nss.SSLFDProxy)

Example 5 with PRFDProxy

use of org.mozilla.jss.nss.PRFDProxy in project jss by dogtagpki.

the class TestRawSSL method TestSSLSecurityStatus.

public static void TestSSLSecurityStatus() throws Exception {
    PRFDProxy fd = PR.NewTCPSocket();
    assert (fd != null);
    SSLFDProxy ssl_fd = SSL.ImportFD(null, fd);
    assert (ssl_fd != null);
    SecurityStatusResult r = SSL.SecurityStatus(ssl_fd);
    assert (r != null);
    assert (r.on == 0);
    // Validate toString works
    System.out.println(r.toString());
    assert (PR.Close(ssl_fd) == PR.SUCCESS);
}
Also used : PRFDProxy(org.mozilla.jss.nss.PRFDProxy) SSLFDProxy(org.mozilla.jss.nss.SSLFDProxy) SecurityStatusResult(org.mozilla.jss.nss.SecurityStatusResult)

Aggregations

PRFDProxy (org.mozilla.jss.nss.PRFDProxy)17 SSLFDProxy (org.mozilla.jss.nss.SSLFDProxy)11 BufferProxy (org.mozilla.jss.nss.BufferProxy)2 SSLException (javax.net.ssl.SSLException)1 CryptoManager (org.mozilla.jss.CryptoManager)1 SSLChannelInfo (org.mozilla.jss.nss.SSLChannelInfo)1 SSLPreliminaryChannelInfo (org.mozilla.jss.nss.SSLPreliminaryChannelInfo)1 SecurityStatusResult (org.mozilla.jss.nss.SecurityStatusResult)1 PK11Cert (org.mozilla.jss.pkcs11.PK11Cert)1 PK11PrivKey (org.mozilla.jss.pkcs11.PK11PrivKey)1 SSLAlertEvent (org.mozilla.jss.ssl.SSLAlertEvent)1