You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by "necouchman (via GitHub)" <gi...@apache.org> on 2026/01/31 20:00:09 UTC
[PR] GUACAMOLE-2211: Add example JavaScript encryption. [guacamole-client]
necouchman opened a new pull request, #1158:
URL: https://github.com/apache/guacamole-client/pull/1158
(no comment)
--
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: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-2211: Add example JavaScript encryption. [guacamole-client]
Posted by "eugen-keeper (via GitHub)" <gi...@apache.org>.
eugen-keeper commented on code in PR #1158:
URL: https://github.com/apache/guacamole-client/pull/1158#discussion_r3381196088
##########
extensions/guacamole-auth-json/doc/encrypt-json.js:
##########
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * This file provides a sample/reference implementation for
+ * taking plain-text JSON data and signing and encrypting it
+ * for use by the guacamole-auth-json authentication extension.
+ */
+
+// Some connection data
+let json=`{
+ "username" : "test",
+ "connections" : {
+ "My Connection" : {
+ "protocol" : "rdp",
+ "parameters" : {
+ "hostname" : "10.10.209.63",
+ "port":"3389",
+ "ignore-cert":"true",
+ "recording-path":"/recordings",
+ "recording-name":"My-Connection-\${GUAC_USERNAME}-\${GUAC_DATE}-\${GUAC_TIME}"
+ }
+ },
+ "My OTHER Connection" : {
+ "protocol" : "rdp",
+ "parameters" : {
+ "hostname":"10.10.209.64",
+ "port":"3389",
+ "ignore-cert":"true",
+ "recording-path":"/recordings",
+ "recording-name":"My-OTHER-Connection-\${GUAC_USERNAME}-\${GUAC_DATE}-\${GUAC_TIME}"
+ }
+ }
+ }
+}`
+
+// Our signing/encryption key
+let key = '2ab26b6438c580e5281edd6639f22e65';
+
+// This is a null IV
+let zeroiv = new Uint8Array([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]);
+
+/**
+ * Encode the provided string of JSON data into an array that can be
+ * signed and encrypted, returning the resultant array.
+ *
+ * @param json
+ * The string of JSON data to encode.
+ *
+ * @return
+ * An encoded array of data.
+ */
+function encodeConnections(json) {
+ var encoder = new TextEncoder();
+ return encoder.encode(json);
+}
+
+/**
+ * Take the encoded array and generate an HMAC signature for it,
+ * combining the HMAC signature with the data and returning the
+ * resultant array.
+ *
+ * @param key
+ * The 128-bit key used to sign the data, provided as a
+ * 16-character hexadecimal value.
Review Comment:
Probably 16 bytes and 32-character hexadecimal value.
--
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: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org