Passing RC4 key data into HTML via UVNCS_KeyData


Author
Message
Bonji
Bonji
Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)
Group: Forum Members
Posts: 10, Visits: 21
I am trying to use the new security property KeyData to pass the RC4 key to the client without the need of an external file, but I can't seem to get the syntax correct.  I have truncated the HEX version of the key because obviously I don't want that to show up in a forum post.

Am I entering the key properly?  Should there be a space in between every HEX char?  I was also struggling on how to convert the key generated by VNC to a format usable by this ActiveX.  I found an online converter that changed the text string from the file into a HEX format.  Should this work?  Is there a better to get a HEX string out of that file?

Can someone show me the correct syntax to define this property in HTML?

<HTML>
 <HEAD>
  <TITLE>VNC Viewer Website</TITLE>
  <script language="Javascript">;
   function OnConnect() {
    window.ViewerX.Disconnect()
    window.ViewerX.HostIP = document.VNCViewer.Address.value
    window.ViewerX.Port = document.VNCViewer.Port.value
    window.ViewerX.Connect()
   }
   function OnDisconnect() {
    window.ViewerX.Disconnect()
   }
   function OnCAD() {
    window.ViewerX.SendCAD()
   }
   function OnRefresh() {
    window.ViewerX.RequestRefresh()
   }
   function OnFit() {
    window.ViewerX.StretchMode = 1
   }
   function OnNormal() {
    window.ViewerX.StretchMode = 0
   }
   function OnFullColor() {
    window.ViewerX.RestrictPixel = 0
   }
   function On8Bit() {
    window.ViewerX.RestrictPixel = 1
   }
  </script>
 </HEAD>
 <BODY>
  <h2 align="center">VNC Viewer Control</h2>
  <hr>
  <form name="VNCViewer">
   IP address:&nbsp<input id="Address" type="text" size="15" value="HOSTNAME">
   Port:&nbsp<input id="Port" type="text" size="6" value="5900">
   &nbsp&nbsp&nbsp
   <input onclick="OnConnect()" type="button" value="Connect"> &nbsp; <input onclick="OnDisconnect()" type="button" value="Disconnect">
  </p>
  </form>
  <hr>
  <p><input onclick="OnCAD()" type="button" value="Ctl+Alt+Del">
  <input onclick="OnRefresh()" type="button" value="Refresh">
  <input onclick="OnFit()" type="button" value="Size to Screen">
  <input onclick="OnNormal()" type="button" value="Size to 100%">
  <input onclick="OnFullColor()" type="button" value="Full Color">
  <input onclick="On8Bit()" type="button" value="8bit Color"></p>
  <p>
   <OBJECT id="ViewerX" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
    width="800" height="600" classid="CLSID:62FA83F7-20EC-4D62-AC86-BAB705EE1CCD" VIEWASTEXT CodeBase="viewerx.cab">
    <PARAM NAME="HostIP" VALUE="">
    <PARAM NAME="Port" VALUE="5900">
    <PARAM NAME="Password" VALUE="">
    <PARAM NAME="CustomCompression" VALUE="1">
    <PARAM NAME="CustomCompressionLevel" VALUE="5">
    <PARAM NAME="JPEGCompression" VALUE="1">
    <PARAM NAME="JPEGCompressionLevel" VALUE="5">
    <PARAM NAME="CopyRect" VALUE="1">
    <PARAM NAME="EmulateThreeButton" VALUE="1">
    <PARAM NAME="SwapMouseButtons" VALUE="0">
    <PARAM NAME="Encoding" VALUE="7">
    <PARAM NAME="ViewOnly" VALUE="0">
    <PARAM NAME="RestrictPixel" VALUE="0">
    <PARAM NAME="ScaleNum" VALUE="1">
    <PARAM NAME="ScaleDen" VALUE="1">
    <PARAM NAME="ScaleEnable" VALUE="0">
    <PARAM NAME="FullScreen" VALUE="0">
    <PARAM NAME="LocalCursor" VALUE="1">
    <PARAM NAME="MessageBoxes" VALUE="1">
    <PARAM NAME="DisableClipboard" VALUE="0">
    <PARAM NAME="ThumbnailMode" VALUE="0">
    <PARAM NAME="LoginType" VALUE="1">
    <PARAM NAME="MsUser" VALUE="">
    <PARAM NAME="MsDomain" VALUE="">
    <PARAM NAME="MsPassword" VALUE="">
    <PARAM NAME="ProxyIP" VALUE="">
    <PARAM NAME="ProxyPort" VALUE="-1">
    <PARAM NAME="ProxyUser" VALUE="">
    <PARAM NAME="ProxyPassword" VALUE="">
    <PARAM NAME="ProxyType" VALUE="0">
    <PARAM NAME="ConnectionBar" VALUE="1">
    <PARAM NAME="StretchMode" VALUE="0">
    <PARAM NAME="UVNCS_EnableSecurity" VALUE="1">
    <PARAM NAME="UVNCS_KeyStorage" VALUE="1">
    <PARAM NAME="UVNCS_KeyData" VALUE="31 32 38 20 62 69 74 ...">
   </OBJECT>
  </p>
 </BODY>
</HTML>


Yury Averkiev (s-code)
Yury Averkiev (s-code)
Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)
Group: Administrators
Posts: 1.9K, Visits: 3.6K
UVNCS_KeyData expects SAFEARRAY of bytes and in your code your are passing a string to it. There is a VBscript function that allows to convert sting to SAFEARRAY of bytes. Sorry I'm not so good at VBscript so I cannot tell you exactly which method you should use, but if you google for it you sure will be able to find it.



Otherwise you might want to use UVNCS_KeyDataAsHexStr property instead. It accepts RC4 key if form of string of HEX values.

http://www.s-code.com/App_Themes/Default/images/blue_line.gif
Regards,
Yury Averkiev, SmartCode

Bonji
Bonji
Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)Supreme Being (1K reputation)
Group: Forum Members
Posts: 10, Visits: 21
Can I see a code example showing the syntax on passing a HEX value into the UVNCS_KeyDataAsHexStr property?  Nothing I have tried is working.
Yury Averkiev (s-code)
Yury Averkiev (s-code)
Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)Supreme Being (213K reputation)
Group: Administrators
Posts: 1.9K, Visits: 3.6K
Sure, I'll post sample C# project tomorrow.

http://www.s-code.com/App_Themes/Default/images/blue_line.gif
Regards,
Yury Averkiev, SmartCode

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Explore
Messages
Mentions
Search