Comments (24)
@slreddy1137 you need to create the server using:
+ (instancetype)serverWithHost:(NSString *)host port:(NSUInteger)port SSLCertificates:(NSArray *)SSLCertificates;
And that NSArray should be an array of SecIdentityRef
objects. SecIdentityRef
objects are not the easiest to obtain, you have to have the certificate and private key pair in keychain and use the Security framework to pull them.
from pocketsocket.
You may find this Apple article useful for getting a SecIdentityRef from a .p12 file:
from pocketsocket.
@slreddy1137 have the same issue. Did you try to install certificate in your certificate chain?
from pocketsocket.
i was trying to create an app where it acts as a web socket server, and one more app acts as a web socket client, this is working fine, now if i have to ensure the security, i m trying to put a certificate in the app bundle of both apps and trying to authenticate when the connection request has been initiated, but no luck, i m not able to go ahead , is my approach right ?
from pocketsocket.
is my approach right ?
I dunno. I was not able to find any meaningful and comprehensive documentation how to use TLS\SSL
How you have created certificate and how you are loading it? Are you using:
+[PSWebSocketServer serverWithHost:port:SSLCertificates:]
to create server?
I am trying to do the same, but with embedded WebView. As I know, to achieve this I need to install my certificate to os x certificate chain.
from pocketsocket.
i m trying to use that method for server initiation, but even i m doubtful of the approach, shall we ask someone
from pocketsocket.
Hi All,
Can someone guide me what to pass in the "SSLCertificates:" attribute for initiating the socket server, i do have a verisign certificate but not aware of how to pass it.
from pocketsocket.
@robertjpayne can you please suggest me on achieving the TLS connection.
from pocketsocket.
Personally I added the SSL support just as a nice to have, unfortunately I can't make the API any easier because SecureTransport only works in this fashion unless I use OpenSSL or some other crypto library for the SSL handshake.
The unfortunate part is that SecureTransport doesn't let you have a SecIdentityRef that isn't attached to a persistent keychain somewhere on disk.
If you're on OS X I recommend just using nginx or apache to terminate the SSL and locally forward the requests to PocketSocket!
from pocketsocket.
@robertjpayne Thanks Robert for your suggestions, I m new to this TLS implementation.
I am having verisign.key and verisign.cer certificate, if i try getting "SecIdentityRef" and pass while creating server, will this enable the secure authentication ? do i need to pass any certificate while creating client socket ?
sorry, if my question is basic, can you please tell some steps to get it done.
from pocketsocket.
@robertjpayne This i using for iOS app, where one phone is acting as web socket server and other as web socket client, now i have to put TLS between their connection.
from pocketsocket.
@slreddy1137 sorry I really can't assist you more than that document, you need to get your certificates into a .p12 file, best way to do that is via Keychain on your mac, just import them both there, then export as a .p12 with a password.
Once you have a .p12 try following the documentation on that Apple article.
from pocketsocket.
@robertjpayne sure, i ll convert it to .p12 and get the SecIdentityRef as you suggested to create server, with this is it going to work or do i need to pass anything while creating client socket ? please suggest.
Thanks in advance.
from pocketsocket.
@robertjpayne We are not passing any certificate for client socket creation, i was thinking do we need to pass for authentication challenge to take place .
from pocketsocket.
@slreddy1137 you probably will need to, if you're going device to device I assume you are using bonjour and connecting directly over an IP address.
Because of that the client wont be able to verify the validity of the SSL certificate by domain name like browsers do. There is a delegate method (in develop only) to accept the SecTrustRef
from pocketsocket.
i m trying to build a communication with an Access Point only without internet, yes i m connecting directly with IP address.
I m unable to find the method which accepts SecTrustRef in the "PSWebSocket" class, do i need to find else where ? sorry for asking more , need your help badly, i have almost integrated your API for all my basic functionalities, only TLS is pending.
from pocketsocket.
@slreddy1137 - (BOOL)webSocket:(PSWebSocket *)webSocket evaluateServerTrust:(SecTrustRef)trust;
again this is only available via the develop
branch at the moment.
from pocketsocket.
ok, can i use it , any precautions to be taken, to make this to Prod ?
from pocketsocket.
@slreddy1137 nope, develop is pretty stable it's well tested again the autobahn test suite. Probably the server code is most fragile as it's not tested as much.
from pocketsocket.
@robertjpayne Thanks a lot for your support, this really helps me, i ll try all these possibilities and get back to you.
Thanks a Ton.
from pocketsocket.
Closing this because I don't believe it's a bug, please re-open if you think otherwise.
from pocketsocket.
Sure Robert, i have been trying to get this working on my project, will
contact you if any help required.
Thanks for your support.
On Tue, Apr 19, 2016 at 8:51 PM, Robert Payne [email protected]
wrote:
Closing this because I don't believe it's a bug, please re-open if you
think otherwise.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#41 (comment)
from pocketsocket.
I have created the server using
+ (instancetype)serverWithHost:(NSString *)host port:(NSUInteger)port SSLCertificates:(NSArray *)SSLCertificates {
where host is host is 127.0.0.1
and certificates is NSArray
with one SecIdentityRef
from .p12
How I then can access it from webpage using wss://
? It is still accessible on ws://
.
from pocketsocket.
Hi Robert,
I was trying to initiate a connection but the below code snippet in “PumpInput” method in “PSWebSocketServer” class is blocking to add the socket.
if(connection.inputBuffer.bytesAvailable > 4) {
void* boundary = memmem(connection.inputBuffer.bytes,
connection.inputBuffer.bytesAvailable,
"\r\n\r\n", 4);
if (boundary == NULL) {
// Haven't reached end of HTTP headers yet
if(connection.inputBuffer.bytesAvailable >= 16384) {
[self disconnectConnection:connection];
}
continue;
}
i m getting boundary as “NULL” and its continuing, can you please help me how to connect.
If i check on Terminal, it shows that connection is established on “NETSTAT”.
Thanks & Regards,
Laxmikanth Samala
269 861 8832
On 20-Apr-2016, at 8:31 AM, lakshmi reddy [email protected] wrote:
Sure Robert, i have been trying to get this working on my project, will contact you if any help required.
Thanks for your support.
On Tue, Apr 19, 2016 at 8:51 PM, Robert Payne <[email protected] mailto:[email protected]> wrote:
Closing this because I don't believe it's a bug, please re-open if you think otherwise.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #41 (comment)
from pocketsocket.
Related Issues (20)
- Deadlock or crash in -[PSWebSocket dealloc] HOT 3
- 'Server mode should have already opened streams.' HOT 1
- Constant "Output stream end encountered" on server HOT 15
- How to do with this error? HOT 2
- WS Secure server: CFNetwork SSLHandshake failed (-9806) HOT 5
- App Crashes on No Internet Connection
- Can't access websockets server on device HOT 3
- Not working? HOT 4
- PocketSocket Delegate is not calling when app is in background HOT 1
- Get IP address from PSWebSocket HOT 3
- support connection timeout?
- Capitalize the 'Connection'='upgrade' header in request
- Server limited to ~0.5MB/s per socket HOT 1
- Capitalize system library in podspec
- How to check socket connection is closed in client?
- tvOS Support
- Block implicitly retains 'self' warnings on Xcode 9
- PocketSocket does not link on Xcode 10.1
- Socket not opening(evaluateServerTrust method won't return anything)
- 我想问一下,是否支持HTTPS ? 使用WSS?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pocketsocket.