Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3491048
D5947.id19785.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5947.id19785.diff
View Options
diff --git a/services/tunnelbroker/src/server/mod.rs b/services/tunnelbroker/src/server/mod.rs
--- a/services/tunnelbroker/src/server/mod.rs
+++ b/services/tunnelbroker/src/server/mod.rs
@@ -3,8 +3,8 @@
use super::constants;
use super::cxx_bridge::ffi::{
ackMessageFromAMQP, eraseMessagesFromAMQP, getMessagesFromDatabase,
- getSessionItem, newSessionHandler, removeMessages, sendMessages,
- sessionSignatureHandler, updateSessionItemDeviceToken,
+ getSessionItem, getStringToSign, newSessionHandler, removeMessages,
+ sendMessages, sessionSignatureHandler, updateSessionItemDeviceToken,
updateSessionItemIsOnline, waitMessageFromDeliveryBroker, GRPCStatusCodes,
};
use anyhow::Result;
@@ -61,6 +61,37 @@
));
};
+ let string_to_be_signed: String;
+ match getStringToSign(&inner_request.device_id) {
+ Ok(string_from_database) => string_to_be_signed = string_from_database,
+ Err(err) => {
+ return Err(tools::create_tonic_status(
+ GRPCStatusCodes::Internal,
+ &err.what(),
+ ))
+ }
+ }
+ match tools::verify_signed_string(
+ &inner_request.public_key,
+ &string_to_be_signed,
+ &inner_request.signature,
+ ) {
+ Ok(verifying_result) => {
+ if !verifying_result {
+ return Err(tools::create_tonic_status(
+ GRPCStatusCodes::PermissionDenied,
+ "Signature for the verification message is not valid",
+ ));
+ }
+ }
+ Err(_) => {
+ return Err(tools::create_tonic_status(
+ GRPCStatusCodes::Internal,
+ "Error while verifying the signature",
+ ))
+ }
+ }
+
let result = newSessionHandler(
&inner_request.device_id,
&inner_request.public_key,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 6:16 PM (17 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678317
Default Alt Text
D5947.id19785.diff (1 KB)
Attached To
Mode
D5947: [services] Tunnelbroker - Modify server handler to use Rust signature verification
Attached
Detach File
Event Timeline
Log In to Comment