Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iLab
libpep
Commits
d0fa8ff0
Commit
d0fa8ff0
authored
Jun 01, 2022
by
AA Westerbaan
Browse files
Update src/libpep.cpp
parent
7a3be76d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libpep.cpp
View file @
d0fa8ff0
...
...
@@ -17,20 +17,28 @@ GlobalEncryptedPseudonym pep::GeneratePseudonym(const std::string& identity, con
return
Encrypt
(
p
,
pk
);
}
Scalar
MakeFactor
(
const
std
::
string
&
secret
,
const
std
::
string
&
context
)
{
Scalar
MakePseudonymisationFactor
(
const
std
::
string
&
secret
,
const
std
::
string
&
context
)
{
return
MakeFactor
(
"pseudonym"
,
secret
,
context
);
}
Scalar
MakeDecryptionFactor
(
const
std
::
string
&
secret
,
const
std
::
string
&
context
)
{
return
MakeFactor
(
"decryption"
,
secret
,
context
);
}
Scalar
MakeFactor
(
const
std
::
string
&
type
,
const
std
::
string
&
secret
,
const
std
::
string
&
context
)
{
HashSHA512
uhash
;
SHA512
(
uhash
,
secret
,
"|"
,
context
);
SHA512
(
uhash
,
type
,
"|"
,
secret
,
"|"
,
context
);
return
Scalar
::
FromHash
(
uhash
);
}
LocalEncryptedPseudonym
pep
::
ConvertToLocalPseudonym
(
GlobalEncryptedPseudonym
p
,
const
std
::
string
&
secret
,
const
std
::
string
&
decryptionContext
,
const
std
::
string
&
pseudonimisationContext
)
{
Scalar
u
=
MakeFactor
(
secret
,
pseudonimisationContext
);
Scalar
t
=
MakeFactor
(
secret
,
decryptionContext
);
Scalar
u
=
Make
Pseudonymisation
Factor
(
secret
,
pseudonimisationContext
);
Scalar
t
=
Make
Decryption
Factor
(
secret
,
decryptionContext
);
return
RKS
(
p
,
t
,
u
);
}
LocalDecryptionKey
pep
::
MakeLocalDecryptionKey
(
GlobalSecretKey
k
,
const
std
::
string
&
secret
,
const
std
::
string
&
decryptionContext
)
{
Scalar
t
=
MakeFactor
(
secret
,
decryptionContext
);
Scalar
t
=
Make
Decryption
Factor
(
secret
,
decryptionContext
);
return
t
*
k
;
}
...
...
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