Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jason Rhinelander
ricochet-refresh
Commits
d1fafed2
Commit
d1fafed2
authored
Jan 23, 2020
by
Marco Simonelli
Committed by
MarcoSi1214
Jan 23, 2020
Browse files
Merge branch 'dev-update-onion-v3' of github.com:Arufu/ricochet-refresh-v3 into dev-update-onion-v3
resolved conflicts
parents
26de8c4d
accab653
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/core/ContactIDValidator.cpp
View file @
d1fafed2
...
...
@@ -33,7 +33,11 @@
#include "ContactIDValidator.h"
// 2-7, not 0-9, as base32 only contains A-Z 2-7
<<<<<<<
HEAD
static
QRegularExpression
regex
(
QStringLiteral
(
"(torsion|ricochet):(([a-z2-7]{56})|([a-z2-7]{16}))"
));
=======
static
QRegularExpression
regex
(
QStringLiteral
(
"(torsion|ricochet):([a-z2-7]{56}|[a-z2-7]{16})"
));
>>>>>>>
accab653a2435d2fc15de6b62fe09667bab437c4
ContactIDValidator
::
ContactIDValidator
(
QObject
*
parent
)
:
QRegularExpressionValidator
(
parent
),
m_uniqueIdentity
(
0
)
...
...
@@ -83,7 +87,11 @@ void ContactIDValidator::fixup(QString &text) const
bool
ContactIDValidator
::
isValidID
(
const
QString
&
text
)
{
<<<<<<<
HEAD
return
regex
.
match
(
text
).
hasMatch
();
=======
return
(
regex
.
match
(
text
).
hasMatch
());
>>>>>>>
accab653a2435d2fc15de6b62fe09667bab437c4
}
QString
ContactIDValidator
::
hostnameFromID
(
const
QString
&
ID
)
...
...
src/core/ContactUser.cpp
View file @
d1fafed2
...
...
@@ -159,6 +159,7 @@ void ContactUser::updateOutgoingSocket()
if
(
!
m_outgoingSocket
)
{
m_outgoingSocket
=
new
Protocol
::
OutboundConnector
(
this
);
//todo auth change here: if v3: pass both private and public key
m_outgoingSocket
->
setAuthPrivateKey
(
identity
->
hiddenService
()
->
privateKey
());
connect
(
m_outgoingSocket
,
&
Protocol
::
OutboundConnector
::
ready
,
this
,
[
this
]()
{
...
...
src/protocol/AuthHiddenServiceChannel.cpp
View file @
d1fafed2
...
...
@@ -89,6 +89,7 @@ void AuthHiddenServiceChannel::setPrivateKey(const CryptoKey &key)
return
;
}
//todo auth change condition to add V3 support
if
(
!
key
.
isLoaded
()
||
!
key
.
isPrivate
())
{
BUG
()
<<
"AuthHiddenServiceChannel cannot authenticate without a valid private key"
;
return
;
...
...
@@ -148,6 +149,7 @@ bool AuthHiddenServiceChannel::allowOutboundChannelRequest(Data::Control::OpenCh
{
Q_D
(
AuthHiddenServiceChannel
);
//todo auth change condition to add V3 support
if
(
!
d
->
privateKey
.
isLoaded
())
{
BUG
()
<<
"AuthHiddenServiceChannel can't be opened without a private key"
;
return
false
;
...
...
@@ -164,6 +166,7 @@ bool AuthHiddenServiceChannel::processChannelOpenResult(const Data::Control::Cha
{
Q_D
(
AuthHiddenServiceChannel
);
// cookies are randomly generated with length 16
if
(
result
->
opened
())
{
std
::
string
cookie
=
result
->
GetExtension
(
Data
::
AuthHiddenService
::
server_cookie
);
if
(
cookie
.
size
()
!=
16
)
{
...
...
@@ -194,6 +197,7 @@ void AuthHiddenServiceChannel::sendAuthMessage()
if
(
!
isOpened
())
return
;
// cookie length is 16 for both v2 and v3
if
(
d
->
clientCookie
.
size
()
!=
16
||
d
->
serverCookie
.
size
()
!=
16
)
{
BUG
()
<<
"AuthHiddenServiceChannel can't create a proof without valid cookies"
;
closeChannel
();
...
...
@@ -201,7 +205,11 @@ void AuthHiddenServiceChannel::sendAuthMessage()
}
// get the public key
<<<<<<<
HEAD
// TODO: check if V3 public key is empty, if it isn't then we are using v3
=======
//todo auth check here to see if the key is a v3 service id, to get the v3 public key
>>>>>>>
accab653a2435d2fc15de6b62fe09667bab437c4
QByteArray
publicKey
=
d
->
privateKey
.
encodedPublicKey
(
CryptoKey
::
DER
);
if
(
publicKey
.
size
()
>
150
)
{
BUG
()
<<
"Unexpected size for encoded public key"
;
...
...
@@ -218,6 +226,7 @@ void AuthHiddenServiceChannel::sendAuthMessage()
// message: proof data
QByteArray
signature
;
//FIXME: d->privateKey is a CryptoKey instance with v3serviceID=""
//todo auth check here to see if the key is a v3 service id, to get the v3 public key
QByteArray
proofData
=
d
->
getProofData
(
d
->
privateKey
.
torServiceID
());
if
(
!
proofData
.
isEmpty
())
{
// make a HMAC of the proof data
...
...
@@ -261,7 +270,11 @@ QByteArray AuthHiddenServiceChannelPrivate::getProofData(const QString &client)
QByteArray
serverHostname
=
connection
->
serverHostname
().
replace
(
QLatin1String
(
".onion"
),
QLatin1String
(
""
)).
toLatin1
();
QByteArray
clientHostname
=
client
.
toLatin1
();
<<<<<<<
HEAD
if
((
clientHostname
.
size
()
!=
16
||
serverHostname
.
size
()
!=
16
)
||
=======
if
((
clientHostname
.
size
()
!=
16
||
serverHostname
.
size
()
!=
16
)
||
>>>>>>>
accab653a2435d2fc15de6b62fe09667bab437c4
(
clientHostname
.
size
()
!=
56
||
serverHostname
.
size
()
!=
56
))
{
BUG
()
<<
"AuthHiddenServiceChannel can't figure out the client and server hostnames"
;
return
QByteArray
();
...
...
src/protocol/OutboundConnector.cpp
View file @
d1fafed2
...
...
@@ -92,6 +92,7 @@ OutboundConnector::~OutboundConnector()
void
OutboundConnector
::
setAuthPrivateKey
(
const
CryptoKey
&
key
)
{
//todo auth change condition to add V3 support
if
(
!
key
.
isLoaded
()
||
!
key
.
isPrivate
())
{
BUG
()
<<
"Cannot make outbound connection without a valid private key"
;
return
;
...
...
src/ui/qml/AddContactDialog.qml
View file @
d1fafed2
...
...
@@ -4,7 +4,11 @@ import QtQuick.Layouts 1.0
ApplicationWindow
{
id
:
addContactWindow
<<<<<<<
HEAD
width
:
620
=======
width
:
640
>>>>>>>
accab653a2435d2fc15de6b62fe09667bab437c4
height
:
300
minimumWidth
:
width
maximumWidth
:
width
...
...
src/ui/qml/ContactIDField.qml
View file @
d1fafed2
...
...
@@ -29,6 +29,7 @@ FocusScope {
placeholderText
:
"
ricochet:
"
focus
:
true
onTextChanged
:
errorBubble
.
clear
()
ContactIDValidator
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment