JSSL_SocketData *sock; const char *nickname=NULL; CERTCertificate* cert=NULL; SECKEYPrivateKey* privKey=NULL; SECStatus status;  if(nicknameStr == NULL) { goto finish; } if( JSSL_getSockData(env, self, &sock) != PR_SUCCESS) goto finish;  nickname = (*env)->GetStringUTFChars(env, nicknameStr, NULL); if( nickname == NULL ) goto finish;  cert = PK11_FindCertFromNickname((char *)nickname, NULL);    if (cert != NULL) { privKey = PK11_FindKeyByAnyCert(cert, NULL); if (privKey != NULL) { status = SSL_ConfigSecureServer(sock->fd, cert, privKey, kt_rsa); if( status != SECSuccess) { JSS_throwMsgPrErr(env, SOCKET_EXCEPTION, "Failed to configure secure server certificate and key"); goto finish; } } else { JSS_throwMsgPrErr(env, SOCKET_EXCEPTION, "Failed to locate private key"); goto finish; } } else { JSS_throwMsgPrErr(env, SOCKET_EXCEPTION, "Failed to locate private key"); goto finish; }  finish: if(privKey!=NULL) { SECKEY_DestroyPrivateKey(privKey); } if(cert!=NULL) { CERT_DestroyCertificate(cert); } if( nickname != NULL ) { (*env)->ReleaseStringUTFChars(env, nicknameStr, nickname); }
PR_ASSERT(0); JSS_throwMsg(env, SOCKET_EXCEPTION, "JSS JAR/DLL version mismatch");
Java_org_mozilla_jss_ssl_SSLServerSocket_setServerCertNickname(    JNIEnv *env, jobject self, jstring nicknameStr){    JSSL_SocketData *sock;    const char *nickname=NULL;    CERTCertificate* cert=NULL;    SECKEYPrivateKey* privKey=NULL;    SECStatus status;    if(nicknameStr == NULL) {        goto finish;    }    if( JSSL_getSockData(env, self, &sock) != PR_SUCCESS) goto finish;    nickname = (*env)->GetStringUTFChars(env, nicknameStr, NULL);    if( nickname == NULL ) goto finish;    cert = PK11_FindCertFromNickname((char *)nickname, NULL);   /* CONST */    if (cert != NULL) {        privKey = PK11_FindKeyByAnyCert(cert, NULL);        if (privKey != NULL) {            status = SSL_ConfigSecureServer(sock->fd, cert, privKey, kt_rsa);            if( status != SECSuccess) {                JSS_throwMsgPrErr(env, SOCKET_EXCEPTION,                    "Failed to configure secure server certificate and key");                goto finish;            }        } else {            JSS_throwMsgPrErr(env, SOCKET_EXCEPTION, "Failed to locate private key");            goto finish;        }    } else {        JSS_throwMsgPrErr(env, SOCKET_EXCEPTION, "Failed to locate private key");        goto finish;    }finish:    if(privKey!=NULL) {        SECKEY_DestroyPrivateKey(privKey);    }    if(cert!=NULL) {        CERT_DestroyCertificate(cert);    }    if( nickname != NULL ) {        (*env)->ReleaseStringUTFChars(env, nicknameStr, nickname);    }}