Socket.hx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package sys.ssl;
  2. /**
  3. A TLS socket class : allow you to both connect to a given server and exchange messages or start your own server and wait for connections.
  4. **/
  5. extern class Socket extends sys.net.Socket {
  6. static var DEFAULT_VERIFY_CERT : Null<Bool>;
  7. static var DEFAULT_CA : Null<sys.ssl.Certificate>;
  8. /**
  9. Define if peer certificate is verified during SSL handshake.
  10. **/
  11. var verifyCert : Null<Bool>;
  12. function new() : Void;
  13. /**
  14. Perform the SSL handshake.
  15. **/
  16. function handshake() : Void;
  17. /**
  18. Configure the certificate chain for peer certificate verification.
  19. **/
  20. function setCA( cert : sys.ssl.Certificate ) : Void;
  21. /**
  22. Configure the hostname for Server Name Indication TLS extension.
  23. **/
  24. function setHostname( name : String ) : Void;
  25. /**
  26. Configure own certificate and private key.
  27. **/
  28. function setCertificate( cert : Certificate, key : Key ) : Void;
  29. /**
  30. Configure additionals certificates and private keys for Server Name Indication extension.
  31. The callback may be called during handshake to determine the certificate to use.
  32. **/
  33. function addSNICertificate( cbServernameMatch : String->Bool, cert : Certificate, key : Key ) : Void;
  34. /**
  35. Return the certificate received from the other side of a connection.
  36. **/
  37. function peerCertificate() : sys.ssl.Certificate;
  38. }