Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
f403d392
Commit
f403d392
authored
2 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
attempt to lookup legacy keys when loading portable user info
parent
b37953be
No related branches found
No related tags found
3 merge requests
!510
Release
,
!267
Make BuildReceptionIdentity public, and make backup restore function return a...
,
!263
Hotfix/refactor cmd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
storage/user/info.go
+33
-4
33 additions, 4 deletions
storage/user/info.go
with
33 additions
and
4 deletions
storage/user/info.go
+
33
−
4
View file @
f403d392
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
package
user
package
user
import
(
import
(
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/crypto/backup"
"gitlab.com/elixxir/crypto/backup"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/crypto/signature/rsa"
...
@@ -85,6 +87,7 @@ func NewUserFromBackup(backup *backup.Backup) Info {
...
@@ -85,6 +87,7 @@ func NewUserFromBackup(backup *backup.Backup) Info {
func
(
u
*
User
)
PortableUserInfo
()
Info
{
func
(
u
*
User
)
PortableUserInfo
()
Info
{
ci
:=
u
.
CryptographicIdentity
ci
:=
u
.
CryptographicIdentity
pub
,
priv
:=
u
.
loadLegacyDHKeys
()
return
Info
{
return
Info
{
TransmissionID
:
ci
.
GetTransmissionID
()
.
DeepCopy
(),
TransmissionID
:
ci
.
GetTransmissionID
()
.
DeepCopy
(),
TransmissionSalt
:
copySlice
(
ci
.
GetTransmissionSalt
()),
TransmissionSalt
:
copySlice
(
ci
.
GetTransmissionSalt
()),
...
@@ -94,14 +97,40 @@ func (u *User) PortableUserInfo() Info {
...
@@ -94,14 +97,40 @@ func (u *User) PortableUserInfo() Info {
ReceptionSalt
:
copySlice
(
ci
.
GetReceptionSalt
()),
ReceptionSalt
:
copySlice
(
ci
.
GetReceptionSalt
()),
ReceptionRSA
:
ci
.
GetReceptionRSA
(),
ReceptionRSA
:
ci
.
GetReceptionRSA
(),
Precanned
:
ci
.
IsPrecanned
(),
Precanned
:
ci
.
IsPrecanned
(),
//fixme: set these in the e2e layer, the command line layer
E2eDhPrivateKey
:
priv
,
//needs more logical separation so this can be removed
E2eDhPublicKey
:
pub
,
E2eDhPrivateKey
:
nil
,
E2eDhPublicKey
:
nil
,
}
}
}
}
// loadLegacyDHKeys attempts to load DH Keys from legacy storage. It
// prints a warning to the log as users should be using ReceptionIdentity
// instead of PortableUserInfo
func
(
u
*
User
)
loadLegacyDHKeys
()
(
pub
,
priv
*
cyclic
.
Int
)
{
jww
.
WARN
.
Printf
(
"loading legacy e2e keys in cmix layer, please "
+
"update your code to use xxdk.ReceptionIdentity"
)
// Legacy package prefixes and keys, see e2e/ratchet/storage.go
packagePrefix
:=
"e2eSession"
pubKeyKey
:=
"DhPubKey"
privKeyKey
:=
"DhPrivKey"
kv
:=
u
.
kv
.
Prefix
(
packagePrefix
)
privKey
,
err
:=
utility
.
LoadCyclicKey
(
kv
,
privKeyKey
)
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"Failed to load e2e DH private key: %v"
,
err
)
return
nil
,
nil
}
pubKey
,
err
:=
utility
.
LoadCyclicKey
(
kv
,
pubKeyKey
)
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"Failed to load e2e DH public key: %v"
,
err
)
return
nil
,
nil
}
return
pubKey
,
privKey
}
func
copySlice
(
s
[]
byte
)
[]
byte
{
func
copySlice
(
s
[]
byte
)
[]
byte
{
n
:=
make
([]
byte
,
len
(
s
))
n
:=
make
([]
byte
,
len
(
s
))
copy
(
n
,
s
)
copy
(
n
,
s
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment