mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
Merge pull request #5874 from nextcloud/bounycastle
Switch to bouncycastle
This commit is contained in:
commit
5da1b7f8a9
3 changed files with 25 additions and 21 deletions
|
@ -311,7 +311,7 @@ dependencies {
|
|||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.6'
|
||||
implementation 'org.lukhnos:nnio:0.2'
|
||||
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
|
||||
implementation 'org.bouncycastle:bcpkix-jdk15on:1.65'
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
|
||||
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
|
||||
|
|
6
lint.xml
6
lint.xml
|
@ -7,7 +7,7 @@
|
|||
<issue id="InvalidPackage">
|
||||
<ignore path="**/freemarker-2.*.*.jar" />
|
||||
<ignore path="**/nnio-0.2.jar"/>
|
||||
<ignore path="**/pkix-1.54.0.0.jar"/>
|
||||
<ignore path="**/bcpkix-jdk15on-1.65.jar" />
|
||||
</issue>
|
||||
|
||||
<issue id="UnusedResources">
|
||||
|
@ -44,4 +44,8 @@
|
|||
<ignore path="**/values-**/strings.xml" />
|
||||
</issue>
|
||||
|
||||
<issue id="TrustAllX509TrustManager">
|
||||
<ignore path="**/bouncycastle/est/jcajce/*.class" />
|
||||
</issue>
|
||||
|
||||
</lint>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
package com.owncloud.android.utils;
|
||||
|
||||
import org.spongycastle.asn1.pkcs.PKCSObjectIdentifiers;
|
||||
import org.spongycastle.asn1.x500.X500Name;
|
||||
import org.spongycastle.asn1.x509.AlgorithmIdentifier;
|
||||
import org.spongycastle.asn1.x509.BasicConstraints;
|
||||
import org.spongycastle.asn1.x509.Extension;
|
||||
import org.spongycastle.asn1.x509.ExtensionsGenerator;
|
||||
import org.spongycastle.crypto.params.AsymmetricKeyParameter;
|
||||
import org.spongycastle.crypto.util.PrivateKeyFactory;
|
||||
import org.spongycastle.operator.ContentSigner;
|
||||
import org.spongycastle.operator.DefaultDigestAlgorithmIdentifierFinder;
|
||||
import org.spongycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;
|
||||
import org.spongycastle.operator.OperatorCreationException;
|
||||
import org.spongycastle.operator.bc.BcRSAContentSignerBuilder;
|
||||
import org.spongycastle.pkcs.PKCS10CertificationRequest;
|
||||
import org.spongycastle.pkcs.PKCS10CertificationRequestBuilder;
|
||||
import org.spongycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder;
|
||||
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
|
||||
import org.bouncycastle.asn1.x509.BasicConstraints;
|
||||
import org.bouncycastle.asn1.x509.Extension;
|
||||
import org.bouncycastle.asn1.x509.ExtensionsGenerator;
|
||||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
|
||||
import org.bouncycastle.crypto.util.PrivateKeyFactory;
|
||||
import org.bouncycastle.operator.ContentSigner;
|
||||
import org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder;
|
||||
import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;
|
||||
import org.bouncycastle.operator.OperatorCreationException;
|
||||
import org.bouncycastle.operator.bc.BcRSAContentSignerBuilder;
|
||||
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
|
||||
import org.bouncycastle.pkcs.PKCS10CertificationRequestBuilder;
|
||||
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyPair;
|
||||
|
@ -25,7 +25,7 @@ import java.security.KeyPair;
|
|||
* https://github.com/awslabs/aws-sdk-android-samples/blob/master/CreateIotCertWithCSR/src/com/amazonaws/demo/csrcert/CsrHelper.java
|
||||
* accessed at 31.08.17
|
||||
* Original parts are licensed under the Apache License, Version 2.0: http://aws.amazon.com/apache2.0
|
||||
* Own parts are licensed unter GPLv3+.
|
||||
* Own parts are licensed under GPLv3+.
|
||||
*/
|
||||
|
||||
public final class CsrHelper {
|
||||
|
@ -50,7 +50,7 @@ public final class CsrHelper {
|
|||
return "-----BEGIN CERTIFICATE REQUEST-----\n" + android.util.Base64.encodeToString(derCSR,
|
||||
android.util.Base64.NO_WRAP) + "\n-----END CERTIFICATE REQUEST-----";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the certificate signing request (CSR) from private and public keys
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ public final class CsrHelper {
|
|||
ContentSigner signer = new BcRSAContentSignerBuilder(signatureAlgorithm, digestAlgorithm).build(privateKey);
|
||||
|
||||
PKCS10CertificationRequestBuilder csrBuilder = new JcaPKCS10CertificationRequestBuilder(new X500Name(principal),
|
||||
keyPair.getPublic());
|
||||
keyPair.getPublic());
|
||||
ExtensionsGenerator extensionsGenerator = new ExtensionsGenerator();
|
||||
extensionsGenerator.addExtension(Extension.basicConstraints, true, new BasicConstraints(true));
|
||||
csrBuilder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest, extensionsGenerator.generate());
|
||||
|
|
Loading…
Reference in a new issue