Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
27b82674
Commit
27b82674
authored
1 year ago
by
Amna Snene
Browse files
Options
Downloads
Patches
Plain Diff
test: fix certstore tests
Change-Id: I7d6099ceeb031f3edd7d393c67cbf57957832d92
parent
e853f505
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/certstore.cpp
+63
-67
63 additions, 67 deletions
tests/certstore.cpp
with
63 additions
and
67 deletions
tests/certstore.cpp
+
63
−
67
View file @
27b82674
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include
<cppunit/TestAssert.h>
#include
<cppunit/TestAssert.h>
#include
<cppunit/TestFixture.h>
#include
<cppunit/TestFixture.h>
#include
<cppunit/extensions/HelperMacros.h>
#include
<cppunit/extensions/HelperMacros.h>
#include
<filesystem>
#include
"test_runner.h"
#include
"test_runner.h"
#include
"certstore.h"
#include
"certstore.h"
...
@@ -35,9 +36,8 @@ public:
...
@@ -35,9 +36,8 @@ public:
void
setUp
();
void
setUp
();
void
tearDown
();
void
tearDown
();
std
::
string
aliceId
;
std
::
shared_ptr
<
tls
::
CertificateStore
>
aliceCertStore
;
std
::
string
bobId
;
std
::
shared_ptr
<
tls
::
TrustStore
>
aliceTrustStore
;
private
:
private
:
void
trustStoreTest
();
void
trustStoreTest
();
void
getCertificateWithSplitted
();
void
getCertificateWithSplitted
();
...
@@ -55,122 +55,121 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CertStoreTest, CertStoreTest::name());
...
@@ -55,122 +55,121 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CertStoreTest, CertStoreTest::name());
void
void
CertStoreTest
::
setUp
()
CertStoreTest
::
setUp
()
{
{
/*auto actors = load_actors_and_wait_for_announcement("actors/alice-bob.yml");
aliceCertStore
=
std
::
make_shared
<
tls
::
CertificateStore
>
(
"aliceCertStore"
,
nullptr
);
aliceId = actors["alice"];
aliceTrustStore
=
std
::
make_shared
<
tls
::
TrustStore
>
(
*
aliceCertStore
);
bobId = actors["bob"];*/
}
}
void
void
CertStoreTest
::
tearDown
()
CertStoreTest
::
tearDown
()
{
{
//wait_for_removal_of({aliceId, bobId});
std
::
filesystem
::
remove_all
(
"aliceCertStore"
);
aliceCertStore
.
reset
();
aliceTrustStore
.
reset
();
}
}
void
void
CertStoreTest
::
trustStoreTest
()
CertStoreTest
::
trustStoreTest
()
{
{
//auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId);
auto
ca
=
dht
::
crypto
::
generateIdentity
(
"test CA"
);
auto
ca
=
dht
::
crypto
::
generateIdentity
(
"test CA"
);
auto
account
=
dht
::
crypto
::
generateIdentity
(
"test account"
,
ca
,
4096
,
true
);
auto
account
=
dht
::
crypto
::
generateIdentity
(
"test account"
,
ca
,
4096
,
true
);
auto
device
=
dht
::
crypto
::
generateIdentity
(
"test device"
,
account
);
auto
device
=
dht
::
crypto
::
generateIdentity
(
"test device"
,
account
);
auto
device2
=
dht
::
crypto
::
generateIdentity
(
"test device 2"
,
account
);
auto
device2
=
dht
::
crypto
::
generateIdentity
(
"test device 2"
,
account
);
/*
auto storeSize = alice
Account->c
ertStore
().
getPinnedCertificates().size();
auto
storeSize
=
alice
C
ertStore
->
getPinnedCertificates
().
size
();
auto
id
=
ca
.
second
->
getId
().
toString
();
auto
id
=
ca
.
second
->
getId
().
toString
();
auto pinned = alice
Account->c
ertStore
().
getPinnedCertificates();
auto
pinned
=
alice
C
ertStore
->
getPinnedCertificates
();
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
==
pinned
.
end
());
==
pinned
.
end
());
// Test certificate status
// Test certificate status
auto certAllowed = alice
Account->accountManager()
->getCertificatesByStatus(
auto
certAllowed
=
alice
TrustStore
->
getCertificatesByStatus
(
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
CPPUNIT_ASSERT
(
CPPUNIT_ASSERT
(
std
::
find_if
(
certAllowed
.
begin
(),
certAllowed
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
std
::
find_if
(
certAllowed
.
begin
(),
certAllowed
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
==
certAllowed
.
end
());
==
certAllowed
.
end
());
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(id)
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
id
)
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
UNDEFINED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
UNDEFINED
);
alice
Account
->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::ALLOWED);
alice
TrustStore
->
setCertificateStatus
(
ca
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
certAllowed = alice
Account->accountManager()
->getCertificatesByStatus(
certAllowed
=
alice
TrustStore
->
getCertificatesByStatus
(
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
CPPUNIT_ASSERT
(
CPPUNIT_ASSERT
(
std
::
find_if
(
certAllowed
.
begin
(),
certAllowed
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
std
::
find_if
(
certAllowed
.
begin
(),
certAllowed
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
!=
certAllowed
.
end
());
!=
certAllowed
.
end
());
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(id)
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
id
)
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
alice
Account
->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::UNDEFINED);
alice
TrustStore
->
setCertificateStatus
(
ca
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
UNDEFINED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(id)
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
id
)
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
UNDEFINED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
UNDEFINED
);
alice
Account
->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::ALLOWED);
alice
TrustStore
->
setCertificateStatus
(
ca
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(id)
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
id
)
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
// Test getPinnedCertificates
// Test getPinnedCertificates
pinned = alice
Account->c
ertStore
().
getPinnedCertificates();
pinned
=
alice
C
ertStore
->
getPinnedCertificates
();
CPPUNIT_ASSERT
(
pinned
.
size
()
==
storeSize
+
2
);
CPPUNIT_ASSERT
(
pinned
.
size
()
==
storeSize
+
2
);
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
!=
pinned
.
end
());
!=
pinned
.
end
());
// Test findCertificateByUID & findIssuer
// Test findCertificateByUID & findIssuer
CPPUNIT_ASSERT(!alice
Account->c
ertStore
().
findCertificateByUID("NON_EXISTING_ID"));
CPPUNIT_ASSERT
(
!
alice
C
ertStore
->
findCertificateByUID
(
"NON_EXISTING_ID"
));
auto cert = alice
Account->c
ertStore
().
findCertificateByUID(id);
auto
cert
=
alice
C
ertStore
->
findCertificateByUID
(
id
);
CPPUNIT_ASSERT
(
cert
);
CPPUNIT_ASSERT
(
cert
);
auto issuer = alice
Account->c
ertStore
().
findIssuer(cert);
auto
issuer
=
alice
C
ertStore
->
findIssuer
(
cert
);
CPPUNIT_ASSERT
(
issuer
);
CPPUNIT_ASSERT
(
issuer
);
CPPUNIT_ASSERT
(
issuer
->
getId
().
toString
()
==
id
);
CPPUNIT_ASSERT
(
issuer
->
getId
().
toString
()
==
id
);
// Test is allowed
// Test is allowed
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*ca.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
ca
.
second
));
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*account.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
account
.
second
));
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*device.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
device
.
second
));
// Ban device
// Ban device
alice
Account
->setCertificateStatus(device.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED);
alice
TrustStore
->
setCertificateStatus
(
device
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(device.second->getId().toString())
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
device
.
second
->
getId
().
toString
())
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(id)
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
id
)
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*ca.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
ca
.
second
));
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*account.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
account
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*device.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
device
.
second
));
// Ban account
// Ban account
alice
Account
->setCertificateStatus(account.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED);
alice
TrustStore
->
setCertificateStatus
(
account
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(account.second->getId().toString())
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
account
.
second
->
getId
().
toString
())
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*ca.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
ca
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*account.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
account
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*device2.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
device2
.
second
));
// Unban account
// Unban account
alice
Account
->setCertificateStatus(account.second,
alice
TrustStore
->
setCertificateStatus
(
account
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(account.second->getId().toString())
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
account
.
second
->
getId
().
toString
())
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
ALLOWED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*ca.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
ca
.
second
));
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*account.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
account
.
second
));
CPPUNIT_ASSERT(alice
Account->accountManager()
->isAllowed(*device2.second));
CPPUNIT_ASSERT
(
alice
TrustStore
->
isAllowed
(
*
device2
.
second
));
// Ban CA
// Ban CA
alice
Account
->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED);
alice
TrustStore
->
setCertificateStatus
(
ca
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(ca.second->getId().toString())
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
ca
.
second
->
getId
().
toString
())
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*ca.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
ca
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*account.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
account
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*device2.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
device2
.
second
));
alice
Account
->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED);
alice
TrustStore
->
setCertificateStatus
(
ca
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(ca.second->getId().toString())
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
ca
.
second
->
getId
().
toString
())
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
// Test unpin
// Test unpin
alice
Account->c
ertStore
().
unpinCertificate(id);
alice
C
ertStore
->
unpinCertificate
(
id
);
pinned = alice
Account->c
ertStore
().
getPinnedCertificates();
pinned
=
alice
C
ertStore
->
getPinnedCertificates
();
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
==
pinned
.
end
());
==
pinned
.
end
());
// Test statusToStr
// Test statusToStr
CPPUNIT_ASSERT(strcmp(dhtnet::tls::statusToStr(dhtnet::tls::TrustStatus::TRUSTED),
/*
CPPUNIT_ASSERT(strcmp(dhtnet::tls::statusToStr(dhtnet::tls::TrustStatus::TRUSTED),
libdhtnet::Certificate::TrustStatus::TRUSTED)
libdhtnet::Certificate::TrustStatus::TRUSTED)
== 0);
== 0);
CPPUNIT_ASSERT(strcmp(dhtnet::tls::statusToStr(dhtnet::tls::TrustStatus::UNTRUSTED),
CPPUNIT_ASSERT(strcmp(dhtnet::tls::statusToStr(dhtnet::tls::TrustStatus::UNTRUSTED),
...
@@ -181,7 +180,6 @@ CertStoreTest::trustStoreTest()
...
@@ -181,7 +180,6 @@ CertStoreTest::trustStoreTest()
void
void
CertStoreTest
::
getCertificateWithSplitted
()
CertStoreTest
::
getCertificateWithSplitted
()
{
{
//auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId);
auto
ca
=
dht
::
crypto
::
generateIdentity
(
"test CA"
);
auto
ca
=
dht
::
crypto
::
generateIdentity
(
"test CA"
);
auto
account
=
dht
::
crypto
::
generateIdentity
(
"test account"
,
ca
,
4096
,
true
);
auto
account
=
dht
::
crypto
::
generateIdentity
(
"test account"
,
ca
,
4096
,
true
);
auto
device
=
dht
::
crypto
::
generateIdentity
(
"test device"
,
account
);
auto
device
=
dht
::
crypto
::
generateIdentity
(
"test device"
,
account
);
...
@@ -191,37 +189,35 @@ CertStoreTest::getCertificateWithSplitted()
...
@@ -191,37 +189,35 @@ CertStoreTest::getCertificateWithSplitted()
auto
devicePartialCert
=
std
::
make_shared
<
dht
::
crypto
::
Certificate
>
(
auto
devicePartialCert
=
std
::
make_shared
<
dht
::
crypto
::
Certificate
>
(
device
.
second
->
toString
(
false
));
device
.
second
->
toString
(
false
));
/*
alice
Account->c
ertStore
().
pinCertificate(caCert);
alice
C
ertStore
->
pinCertificate
(
caCert
);
alice
Account->c
ertStore
().
pinCertificate(accountCert);
alice
C
ertStore
->
pinCertificate
(
accountCert
);
alice
Account->c
ertStore
().
pinCertificate(devicePartialCert);
alice
C
ertStore
->
pinCertificate
(
devicePartialCert
);
auto fullCert = alice
Account->c
ertStore
().
getCertificate(device.second->getId().toString());
auto
fullCert
=
alice
C
ertStore
->
getCertificate
(
device
.
second
->
getId
().
toString
());
CPPUNIT_ASSERT
(
fullCert
->
issuer
&&
fullCert
->
issuer
->
getUID
()
==
accountCert
->
getUID
());
CPPUNIT_ASSERT
(
fullCert
->
issuer
&&
fullCert
->
issuer
->
getUID
()
==
accountCert
->
getUID
());
CPPUNIT_ASSERT
(
fullCert
->
issuer
->
issuer
CPPUNIT_ASSERT
(
fullCert
->
issuer
->
issuer
&& fullCert->issuer->issuer->getUID() == caCert->getUID());
*/
&&
fullCert
->
issuer
->
issuer
->
getUID
()
==
caCert
->
getUID
());
}
}
void
void
CertStoreTest
::
testBannedParent
()
CertStoreTest
::
testBannedParent
()
{
{
/*auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId);
auto
ca
=
dht
::
crypto
::
generateIdentity
(
"test CA"
);
auto
ca
=
dht
::
crypto
::
generateIdentity
(
"test CA"
);
auto
account
=
dht
::
crypto
::
generateIdentity
(
"test account"
,
ca
,
4096
,
true
);
auto
account
=
dht
::
crypto
::
generateIdentity
(
"test account"
,
ca
,
4096
,
true
);
auto
device
=
dht
::
crypto
::
generateIdentity
(
"test device"
,
account
);
auto
device
=
dht
::
crypto
::
generateIdentity
(
"test device"
,
account
);
auto
device2
=
dht
::
crypto
::
generateIdentity
(
"test device 2"
,
account
);
auto
device2
=
dht
::
crypto
::
generateIdentity
(
"test device 2"
,
account
);
auto
id
=
ca
.
second
->
getId
().
toString
();
auto
id
=
ca
.
second
->
getId
().
toString
();
auto pinned = alice
Account->c
ertStore
().
getPinnedCertificates();
auto
pinned
=
alice
C
ertStore
->
getPinnedCertificates
();
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
CPPUNIT_ASSERT
(
std
::
find_if
(
pinned
.
begin
(),
pinned
.
end
(),
[
&
](
auto
v
)
{
return
v
==
id
;
})
==
pinned
.
end
());
==
pinned
.
end
());
// Ban account
// Ban account
alice
Account
->setCertificateStatus(account.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED);
alice
TrustStore
->
setCertificateStatus
(
account
.
second
,
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(alice
Account->accountManager()
->getCertificateStatus(account.second->getId().toString())
CPPUNIT_ASSERT
(
alice
TrustStore
->
getCertificateStatus
(
account
.
second
->
getId
().
toString
())
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
==
dhtnet
::
tls
::
TrustStore
::
PermissionStatus
::
BANNED
);
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*account.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
account
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*device2.second));
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
device2
.
second
));
CPPUNIT_ASSERT(not alice
Account->accountManager()
->isAllowed(*device.second));
*/
CPPUNIT_ASSERT
(
not
alice
TrustStore
->
isAllowed
(
*
device
.
second
));
}
}
...
...
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