nvazquez commented on code in PR #7015:
URL: https://github.com/apache/cloudstack/pull/7015#discussion_r1068559924
##########
services/console-proxy/server/src/main/java/com/cloud/consoleproxy/vnc/NoVncClient.java:
##########
@@ -235,8 +262,61 @@ public byte[] encodePassword(byte[] challenge, String
password) throws Exception
Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
- byte[] response = cipher.doFinal(challenge);
- return response;
+ return cipher.doFinal(challenge);
+ }
+
+ private void agreeVEncryptVersion() throws IOException {
+ int majorVEncryptVersion = nioSocketConnection.readUnsignedInteger(8);
+ int minorVEncryptVersion = nioSocketConnection.readUnsignedInteger(8);
+ int vEncryptVersion = (majorVEncryptVersion << 8) |
minorVEncryptVersion;
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("VEncrypt version offered by the server: " +
vEncryptVersion);
+ }
+ nioSocketConnection.writeUnsignedInteger(8, majorVEncryptVersion);
+ if (vEncryptVersion >= 0x0002) {
+ nioSocketConnection.writeUnsignedInteger(8, 2);
+ nioSocketConnection.flushWriteBuffer();
+ } else {
+ nioSocketConnection.writeUnsignedInteger(8, 0);
+ nioSocketConnection.flushWriteBuffer();
+ throw new CloudRuntimeException("Server reported an unsupported
VeNCrypt version");
+ }
+ int ack = nioSocketConnection.readUnsignedInteger(8);
+ if (ack != 0) {
+ throw new IOException("The VNC server did not agree on the
VEncrypt version");
+ }
+ }
+
+ private int selectVEncryptSubtype() {
+ int numberOfSubtypes = nioSocketConnection.readUnsignedInteger(8);
+ if (numberOfSubtypes <= 0) {
+ throw new CloudRuntimeException("The server reported no VeNCrypt
sub-types");
+ }
+ for (int i = 0; i < numberOfSubtypes; i++) {
+ nioSocketConnection.waitForBytesAvailableForReading(4);
+ int subtype = nioSocketConnection.readUnsignedInteger(32);
+ if (subtype == RfbConstants.V_ENCRYPT_X509_VNC) {
+ if (s_logger.isDebugEnabled()) {
+ s_logger.info("Selected VEncrypt subtype " + subtype);
+ }
Review Comment:
Thanks, typo here :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]