Skip to content

Commit

Permalink
clean up redundant code
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Dec 7, 2023
1 parent 78a81d1 commit 4022478
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libsync/clientsideencryptiontokenselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,15 @@ void ClientSideEncryptionTokenSelector::discoverCertificates(const AccountPtr &a

const auto result = BIO2ByteArray(out);
const auto sslCertificate = QSslCertificate{result, QSsl::Pem};
const auto certificateDigest = sslCertificate.digest(QCryptographicHash::Sha256).toBase64();

qCInfo(lcCseSelector()) << "newly found certificate"
<< "subject:" << sslCertificate.subjectDisplayName()
<< "issuer:" << sslCertificate.issuerDisplayName()
<< "valid since:" << sslCertificate.effectiveDate()
<< "valid until:" << sslCertificate.expiryDate()
<< "serial number:" << sslCertificate.serialNumber()
<< "SHA256 fingerprint:" << sslCertificate.digest(QCryptographicHash::Sha256).toBase64();
<< "SHA256 fingerprint:" << certificateDigest;

if (sslCertificate.isSelfSigned()) {
qCDebug(lcCseSelector()) << "newly found certificate is self signed: goint to ignore it";
Expand All @@ -240,7 +241,7 @@ void ClientSideEncryptionTokenSelector::discoverCertificates(const AccountPtr &a
{QStringLiteral("serialNumber"), sslCertificate.serialNumber()},
{QStringLiteral("validSince"), sslCertificate.effectiveDate()},
{QStringLiteral("validUntil"), sslCertificate.expiryDate()},
{QStringLiteral("sha256Fingerprint"), sslCertificate.digest(QCryptographicHash::Sha256).toBase64()},
{QStringLiteral("sha256Fingerprint"), certificateDigest},
{QStringLiteral("certificate"), QVariant::fromValue(sslCertificate)},
});
}
Expand Down

0 comments on commit 4022478

Please sign in to comment.