0

I'm try to implement the noVNC APIs to create a custom element to handle the noVNC frames on canvas. When i'm calling new RBF() Object to start the noVNC connection

 // javascript
 this.rbf = new RFB(screen, this.url.href)

 //  fired when the server identity must be confirmed by the user.
 this.rbf.addEventListener(
    'serververification', (event) => {
        console.log('@SERVER-VERIFICATION >> ', event.type)
    }
)

# bash code to run websockify
websockify -v 8888 192.168.1.11:5900

I get the event serververification event with field isTrusted: false. The only info I've found about, it's the sentence in official doc about this event fired when the server identity must be confirmed by the user .... but how i can solve and establish the connection without raise this event ?

cicciosgamino
  • 871
  • 3
  • 10
  • 29
  • One more step .... i get the root of my fault in connecting the RBF to VNC server. I've download and run the vnc.html page of noVNC project... and after setting the host and port on the VNC server target when i click connect i get the message: Server Identity > The server has provided the following identity information > Fingerprint:19-8e ..... and if accept the connection start! So now i'm checking deep on how to handle this Server Identity step in Javascript code ! – cicciosgamino Mar 01 '23 at 10:29

1 Answers1

1

Actually solved digging in the vnc.html > ui.js code in noVNC github.com here the link:

https://github.com/novnc/noVNC/blob/master/app/ui.js

So in the case of RealVNC server, as in the code example i've handled the serverification event just to console the RSA fingerprint received:

 this.rbf.addEventListener('serververification', await this.serverVerify.bind(this))

 // function used as in the noVNC code
 async serverVerify(e) {
    
    const type = e.detail.type
    if (type === 'RSA') {
        const publickey = e.detail.publickey
        let fingerprint = await window.crypto.subtle.digest("SHA-1", publickey)
        // The same fingerprint format as RealVNC
        fingerprint = Array.from(new Uint8Array(fingerprint).slice(0, 8)).map(
            x => x.toString(16).padStart(2, '0')).join('-')

        console.log('@noVNC FINGERPRINT >> ', fingerprint)

        // here to command for approve the server
        this.rbf.approveServer()    
    }
}
cicciosgamino
  • 871
  • 3
  • 10
  • 29