Skip to content

Commit 263888e

Browse files
committed
add tests
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent e001fad commit 263888e

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

app/src/androidTest/java/com/owncloud/android/utils/EncryptionUtilsV2IT.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ class EncryptionUtilsV2IT : EncryptionIT() {
758758
certificateEnc2,
759759
certificateT1
760760
)
761+
762+
assertTrue(encryptionUtilsV2.verifySignedData(signed, certs))
761763
}
762764

763765
@Throws(Throwable::class)
@@ -778,6 +780,8 @@ class EncryptionUtilsV2IT : EncryptionIT() {
778780
EncryptionUtils.convertCertFromString(enc2Cert),
779781
certificate
780782
)
783+
784+
assertTrue(encryptionUtilsV2.verifySignedData(signed, certs))
781785
}
782786

783787
@Test

app/src/main/java/com/nextcloud/utils/CmsSignatureVerifier.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,7 @@
77

88
package com.nextcloud.utils
99

10-
/**
11-
* JNI bridge that delegates CMS signature verification to native OpenSSL.
12-
*
13-
* The native implementation mirrors the iOS `verifySignatureCMS` logic:
14-
* - Parses the DER-encoded CMS structure
15-
* - Verifies the detached signature without CA-chain validation (CMS_NO_SIGNER_CERT_VERIFY)
16-
* - Matches the resulting signer identity against each supplied PEM certificate
17-
* (equivalent to `CMS_SignerInfo_cert_cmp`)
18-
*/
1910
class CmsSignatureVerifier {
20-
/**
21-
* @param cmsData DER-encoded CMS ContentInfo (detached, without embedded content)
22-
* @param messageData The raw content bytes that were signed
23-
* @param certificates PEM-encoded X.509 certificates to match against the CMS signer
24-
* @return `true` if the signature is cryptographically valid and the signer matches
25-
* at least one of the supplied certificates
26-
*/
2711
external fun verifySignedData(cmsData: ByteArray, messageData: ByteArray, certificates: Array<String>): Boolean
2812

2913
companion object {

0 commit comments

Comments
 (0)