-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1187 from nextcloud/E2Esharing
E2E sharing
- Loading branch information
Showing
32 changed files
with
982 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><!-- | ||
~ | ||
~ Nextcloud Android client application | ||
~ | ||
~ @author Tobias Kaminsky | ||
~ Copyright (C) 2024 Tobias Kaminsky | ||
~ Copyright (C) 2024 Nextcloud GmbH | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU Affero General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ This program is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU Affero General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Affero General Public License | ||
~ along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
~ | ||
--> | ||
|
||
<lint> | ||
<issue id="TrustAllX509TrustManager"> | ||
<ignore path="**/bouncycastle/est/jcajce/*.class" /> | ||
<ignore path="**/bcpkix-jdk18on-1.75.jar" /> | ||
</issue> | ||
</lint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
.../src/androidTest/java/com/owncloud/android/lib/resources/e2ee/SendCSRRemoteOperationIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* Nextcloud Android Library is available under MIT license | ||
* | ||
* @author Tobias Kaminsky | ||
* Copyright (C) 2024 Tobias Kaminsky | ||
* Copyright (C) 2024 Nextcloud GmbH | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
*/ | ||
package com.owncloud.android.lib.resources.e2ee | ||
|
||
import com.owncloud.android.AbstractIT | ||
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory | ||
import com.owncloud.android.lib.resources.users.GetPublicKeyRemoteOperation | ||
import com.owncloud.android.lib.resources.users.SendCSRRemoteOperation | ||
import junit.framework.TestCase | ||
import junit.framework.TestCase.assertTrue | ||
import org.junit.Before | ||
import org.junit.Test | ||
import java.security.KeyPairGenerator | ||
import java.security.SecureRandom | ||
|
||
class SendCSRRemoteOperationIT : AbstractIT() { | ||
@Before | ||
fun init() { | ||
// E2E server app checks for official NC client with >=3.13.0, | ||
// and blocks all other clients, e.g. 3rd party apps using this lib | ||
OwnCloudClientManagerFactory.setUserAgent("Mozilla/5.0 (Android) Nextcloud-android/3.13.0") | ||
} | ||
|
||
@Throws(Throwable::class) | ||
@Test | ||
fun publicKey() { | ||
val keyGen = KeyPairGenerator.getInstance("RSA") | ||
keyGen.initialize(KEY_SIZE, SecureRandom()) | ||
|
||
val keyPair = keyGen.genKeyPair() | ||
|
||
// create CSR | ||
val urlEncoded: String = CsrHelper().generateCsrPemEncodedString(keyPair, client.userId) | ||
|
||
val operation = SendCSRRemoteOperation(urlEncoded) | ||
var result = operation.execute(nextcloudClient) | ||
|
||
assertTrue(result.isSuccess) | ||
|
||
// verify public key | ||
result = GetPublicKeyRemoteOperation(client.userId).execute(nextcloudClient) | ||
assertTrue(result.isSuccess) | ||
TestCase.assertNotNull(result.resultData) | ||
} | ||
|
||
companion object { | ||
const val KEY_SIZE = 2048 | ||
} | ||
} |
Oops, something went wrong.