1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 02:25:50 +01:00

Rename org.bouncycastle package

Fixes roboelectric in unit tests.
This commit is contained in:
José Rebelo 2023-11-25 21:15:31 +00:00
parent 84cf8efb59
commit 543c8b28d0
34 changed files with 98 additions and 95 deletions

View File

@ -293,8 +293,10 @@ dependencies {
implementation 'com.android.volley:volley:1.2.1' implementation 'com.android.volley:volley:1.2.1'
// Bouncy Castle is included directly in GB, to avoid pulling the entire dependency // Bouncy Castle is included directly in GB, to avoid pulling the entire dependency
//implementation 'org.bouncycastle:bcpkix-jdk15to18:1.76' // it's included in the org.bouncycastle.shaded package, to prevent conflicts with
//implementation 'org.bouncycastle:bcprov-jdk15to18:1.76' // roboelectric
//implementation 'org.bouncycastle:bcpkix-jdk18on:1.76'
//implementation 'org.bouncycastle:bcprov-jdk18on:1.76'
// NON-FOSS dependencies // NON-FOSS dependencies
// implementation('androidx.core:core-google-shortcuts:1.0.1') { // implementation('androidx.core:core-google-shortcuts:1.0.1') {

View File

@ -25,11 +25,11 @@ import com.google.protobuf.ByteString;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.crypto.CryptoException; import org.bouncycastle.shaded.crypto.CryptoException;
import org.bouncycastle.crypto.engines.AESEngine; import org.bouncycastle.shaded.crypto.engines.AESEngine;
import org.bouncycastle.crypto.modes.CCMBlockCipher; import org.bouncycastle.shaded.crypto.modes.CCMBlockCipher;
import org.bouncycastle.crypto.params.AEADParameters; import org.bouncycastle.shaded.crypto.params.AEADParameters;
import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.shaded.crypto.params.KeyParameter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* all parameter classes implement this. * all parameter classes implement this.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* the foundation class for the hard exceptions thrown by the crypto packages. * the foundation class for the hard exceptions thrown by the crypto packages.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* this exception is thrown if a buffer that is meant to have output * this exception is thrown if a buffer that is meant to have output

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
public abstract class DefaultMultiBlockCipher public abstract class DefaultMultiBlockCipher
implements MultiBlockCipher implements MultiBlockCipher

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* this exception is thrown whenever we find something we don't expect in a * this exception is thrown whenever we find something we don't expect in a

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* Base interface for a cipher engine capable of processing multiple blocks at a time. * Base interface for a cipher engine capable of processing multiple blocks at a time.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
public class OutputLengthException public class OutputLengthException
extends DataLengthException extends DataLengthException

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* the foundation class for the exceptions thrown by the crypto packages. * the foundation class for the exceptions thrown by the crypto packages.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* Ciphers producing a key stream which can be reset to particular points in the stream implement this. * Ciphers producing a key stream which can be reset to particular points in the stream implement this.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* General interface for a stream cipher that supports skipping. * General interface for a stream cipher that supports skipping.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* A parent class for block cipher modes that do not require block aligned data to be processed, but can function in * A parent class for block cipher modes that do not require block aligned data to be processed, but can function in

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto; package org.bouncycastle.shaded.crypto;
/** /**
* the interface stream ciphers conform to. * the interface stream ciphers conform to.

View File

@ -1,13 +1,13 @@
package org.bouncycastle.crypto.engines; package org.bouncycastle.shaded.crypto.engines;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.shaded.crypto.DataLengthException;
import org.bouncycastle.crypto.DefaultMultiBlockCipher; import org.bouncycastle.shaded.crypto.DefaultMultiBlockCipher;
import org.bouncycastle.crypto.MultiBlockCipher; import org.bouncycastle.shaded.crypto.MultiBlockCipher;
import org.bouncycastle.crypto.OutputLengthException; import org.bouncycastle.shaded.crypto.OutputLengthException;
import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.shaded.crypto.params.KeyParameter;
import org.bouncycastle.util.Arrays; import org.bouncycastle.shaded.util.Arrays;
import org.bouncycastle.util.Pack; import org.bouncycastle.shaded.util.Pack;
/** /**
* an implementation of the AES (Rijndael), from FIPS-197. * an implementation of the AES (Rijndael), from FIPS-197.

View File

@ -1,10 +1,10 @@
package org.bouncycastle.crypto.macs; package org.bouncycastle.shaded.crypto.macs;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.crypto.Mac; import org.bouncycastle.shaded.crypto.Mac;
import org.bouncycastle.crypto.modes.CBCBlockCipher; import org.bouncycastle.shaded.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.paddings.BlockCipherPadding; import org.bouncycastle.shaded.crypto.paddings.BlockCipherPadding;
/** /**
* standard CBC Block Cipher MAC - if no padding is specified the default of * standard CBC Block Cipher MAC - if no padding is specified the default of
@ -43,7 +43,7 @@ public class CBCBlockCipherMac
*/ */
public CBCBlockCipherMac( public CBCBlockCipherMac(
BlockCipher cipher, BlockCipher cipher,
BlockCipherPadding padding) org.bouncycastle.shaded.crypto.paddings.BlockCipherPadding padding)
{ {
this(cipher, (cipher.getBlockSize() * 8) / 2, padding); this(cipher, (cipher.getBlockSize() * 8) / 2, padding);
} }

View File

@ -1,6 +1,6 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
/** /**
* An {@link AEADCipher} based on a {@link BlockCipher}. * An {@link AEADCipher} based on a {@link BlockCipher}.

View File

@ -1,8 +1,9 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.shaded.crypto.DataLengthException;
import org.bouncycastle.crypto.InvalidCipherTextException; import org.bouncycastle.shaded.crypto.InvalidCipherTextException;
import org.bouncycastle.shaded.crypto.params.AEADParameters;
/** /**
* A cipher mode that includes authenticated encryption with a streaming mode and optional associated data. * A cipher mode that includes authenticated encryption with a streaming mode and optional associated data.
@ -16,7 +17,7 @@ import org.bouncycastle.crypto.InvalidCipherTextException;
* may be output prior to the call to {@link #doFinal(byte[], int)} that results in an authentication * may be output prior to the call to {@link #doFinal(byte[], int)} that results in an authentication
* failure. The higher level protocol utilising this cipher must ensure the plaintext data is handled * failure. The higher level protocol utilising this cipher must ensure the plaintext data is handled
* appropriately until the end of data is reached and the entire ciphertext is authenticated. * appropriately until the end of data is reached and the entire ciphertext is authenticated.
* @see org.bouncycastle.crypto.params.AEADParameters * @see AEADParameters
*/ */
public interface AEADCipher public interface AEADCipher
{ {
@ -88,7 +89,7 @@ public interface AEADCipher
* @param outOff offset into out to start copying the data at. * @param outOff offset into out to start copying the data at.
* @return number of bytes written into out. * @return number of bytes written into out.
* @throws IllegalStateException if the cipher is in an inappropriate state. * @throws IllegalStateException if the cipher is in an inappropriate state.
* @throws org.bouncycastle.crypto.InvalidCipherTextException if the MAC fails to match. * @throws InvalidCipherTextException if the MAC fails to match.
*/ */
public int doFinal(byte[] out, int outOff) public int doFinal(byte[] out, int outOff)
throws IllegalStateException, InvalidCipherTextException; throws IllegalStateException, InvalidCipherTextException;

View File

@ -1,11 +1,11 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.shaded.crypto.DataLengthException;
import org.bouncycastle.crypto.DefaultMultiBlockCipher; import org.bouncycastle.shaded.crypto.DefaultMultiBlockCipher;
import org.bouncycastle.crypto.params.ParametersWithIV; import org.bouncycastle.shaded.crypto.params.ParametersWithIV;
import org.bouncycastle.util.Arrays; import org.bouncycastle.shaded.util.Arrays;
/** /**
* implements Cipher-Block-Chaining (CBC) mode on top of a simple cipher. * implements Cipher-Block-Chaining (CBC) mode on top of a simple cipher.

View File

@ -1,7 +1,7 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
import org.bouncycastle.crypto.MultiBlockCipher; import org.bouncycastle.shaded.crypto.MultiBlockCipher;
public interface CBCModeCipher public interface CBCModeCipher
extends MultiBlockCipher extends MultiBlockCipher

View File

@ -1,17 +1,17 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.shaded.crypto.DataLengthException;
import org.bouncycastle.crypto.InvalidCipherTextException; import org.bouncycastle.shaded.crypto.InvalidCipherTextException;
import org.bouncycastle.crypto.Mac; import org.bouncycastle.shaded.crypto.Mac;
import org.bouncycastle.crypto.OutputLengthException; import org.bouncycastle.shaded.crypto.OutputLengthException;
import org.bouncycastle.crypto.macs.CBCBlockCipherMac; import org.bouncycastle.shaded.crypto.macs.CBCBlockCipherMac;
import org.bouncycastle.crypto.params.AEADParameters; import org.bouncycastle.shaded.crypto.params.AEADParameters;
import org.bouncycastle.crypto.params.ParametersWithIV; import org.bouncycastle.shaded.crypto.params.ParametersWithIV;
import org.bouncycastle.util.Arrays; import org.bouncycastle.shaded.util.Arrays;
/** /**
* Implements the Counter with Cipher Block Chaining mode (CCM) detailed in * Implements the Counter with Cipher Block Chaining mode (CCM) detailed in

View File

@ -1,4 +1,4 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
public interface CCMModeCipher public interface CCMModeCipher
extends AEADBlockCipher extends AEADBlockCipher

View File

@ -1,8 +1,8 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
import org.bouncycastle.crypto.MultiBlockCipher; import org.bouncycastle.shaded.crypto.MultiBlockCipher;
import org.bouncycastle.crypto.SkippingStreamCipher; import org.bouncycastle.shaded.crypto.SkippingStreamCipher;
public interface CTRModeCipher public interface CTRModeCipher
extends MultiBlockCipher, SkippingStreamCipher extends MultiBlockCipher, SkippingStreamCipher

View File

@ -1,13 +1,13 @@
package org.bouncycastle.crypto.modes; package org.bouncycastle.shaded.crypto.modes;
import org.bouncycastle.crypto.BlockCipher; import org.bouncycastle.shaded.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.shaded.crypto.DataLengthException;
import org.bouncycastle.crypto.OutputLengthException; import org.bouncycastle.shaded.crypto.OutputLengthException;
import org.bouncycastle.crypto.StreamBlockCipher; import org.bouncycastle.shaded.crypto.StreamBlockCipher;
import org.bouncycastle.crypto.params.ParametersWithIV; import org.bouncycastle.shaded.crypto.params.ParametersWithIV;
import org.bouncycastle.util.Arrays; import org.bouncycastle.shaded.util.Arrays;
import org.bouncycastle.util.Pack; import org.bouncycastle.shaded.util.Pack;
/** /**
* Implements the Segmented Integer Counter (SIC) mode on top of a simple * Implements the Segmented Integer Counter (SIC) mode on top of a simple

View File

@ -1,8 +1,8 @@
package org.bouncycastle.crypto.paddings; package org.bouncycastle.shaded.crypto.paddings;
import java.security.SecureRandom; import java.security.SecureRandom;
import org.bouncycastle.crypto.InvalidCipherTextException; import org.bouncycastle.shaded.crypto.InvalidCipherTextException;
/** /**
* Block cipher padders are expected to conform to this interface * Block cipher padders are expected to conform to this interface

View File

@ -1,7 +1,7 @@
package org.bouncycastle.crypto.params; package org.bouncycastle.shaded.crypto.params;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.util.Arrays; import org.bouncycastle.shaded.util.Arrays;
public class AEADParameters public class AEADParameters
implements CipherParameters implements CipherParameters

View File

@ -1,7 +1,7 @@
package org.bouncycastle.crypto.params; package org.bouncycastle.shaded.crypto.params;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
import org.bouncycastle.util.Arrays; import org.bouncycastle.shaded.util.Arrays;
public class KeyParameter public class KeyParameter
implements CipherParameters implements CipherParameters

View File

@ -1,6 +1,6 @@
package org.bouncycastle.crypto.params; package org.bouncycastle.shaded.crypto.params;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.shaded.crypto.CipherParameters;
public class ParametersWithIV public class ParametersWithIV
implements CipherParameters implements CipherParameters

View File

@ -1,4 +1,4 @@
package org.bouncycastle.util; package org.bouncycastle.shaded.util;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;

View File

@ -1,4 +1,4 @@
package org.bouncycastle.util; package org.bouncycastle.shaded.util;
public class Objects public class Objects
{ {

View File

@ -1,4 +1,4 @@
package org.bouncycastle.util; package org.bouncycastle.shaded.util;
/** /**
* Utility methods for converting byte arrays into ints and longs, and back again. * Utility methods for converting byte arrays into ints and longs, and back again.

View File

@ -1,4 +1,4 @@
package org.bouncycastle.util; package org.bouncycastle.shaded.util;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;