mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 10:05:49 +01:00
Rename org.bouncycastle package
Fixes roboelectric in unit tests.
This commit is contained in:
parent
84cf8efb59
commit
543c8b28d0
@ -293,8 +293,10 @@ dependencies {
|
||||
implementation 'com.android.volley:volley:1.2.1'
|
||||
|
||||
// Bouncy Castle is included directly in GB, to avoid pulling the entire dependency
|
||||
//implementation 'org.bouncycastle:bcpkix-jdk15to18:1.76'
|
||||
//implementation 'org.bouncycastle:bcprov-jdk15to18:1.76'
|
||||
// it's included in the org.bouncycastle.shaded package, to prevent conflicts with
|
||||
// roboelectric
|
||||
//implementation 'org.bouncycastle:bcpkix-jdk18on:1.76'
|
||||
//implementation 'org.bouncycastle:bcprov-jdk18on:1.76'
|
||||
|
||||
// NON-FOSS dependencies
|
||||
// implementation('androidx.core:core-google-shortcuts:1.0.1') {
|
||||
|
@ -25,11 +25,11 @@ import com.google.protobuf.ByteString;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bouncycastle.crypto.CryptoException;
|
||||
import org.bouncycastle.crypto.engines.AESEngine;
|
||||
import org.bouncycastle.crypto.modes.CCMBlockCipher;
|
||||
import org.bouncycastle.crypto.params.AEADParameters;
|
||||
import org.bouncycastle.crypto.params.KeyParameter;
|
||||
import org.bouncycastle.shaded.crypto.CryptoException;
|
||||
import org.bouncycastle.shaded.crypto.engines.AESEngine;
|
||||
import org.bouncycastle.shaded.crypto.modes.CCMBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.params.AEADParameters;
|
||||
import org.bouncycastle.shaded.crypto.params.KeyParameter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
/**
|
||||
* all parameter classes implement this.
|
@ -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.
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
public abstract class DefaultMultiBlockCipher
|
||||
implements MultiBlockCipher
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
|
||||
/**
|
@ -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.
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
public class OutputLengthException
|
||||
extends DataLengthException
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
/**
|
||||
* the foundation class for the exceptions thrown by the crypto packages.
|
@ -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.
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
/**
|
||||
* General interface for a stream cipher that supports skipping.
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto;
|
||||
package org.bouncycastle.shaded.crypto;
|
||||
|
||||
/**
|
||||
* the interface stream ciphers conform to.
|
@ -1,13 +1,13 @@
|
||||
package org.bouncycastle.crypto.engines;
|
||||
package org.bouncycastle.shaded.crypto.engines;
|
||||
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.crypto.DataLengthException;
|
||||
import org.bouncycastle.crypto.DefaultMultiBlockCipher;
|
||||
import org.bouncycastle.crypto.MultiBlockCipher;
|
||||
import org.bouncycastle.crypto.OutputLengthException;
|
||||
import org.bouncycastle.crypto.params.KeyParameter;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import org.bouncycastle.util.Pack;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.crypto.DataLengthException;
|
||||
import org.bouncycastle.shaded.crypto.DefaultMultiBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.MultiBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.OutputLengthException;
|
||||
import org.bouncycastle.shaded.crypto.params.KeyParameter;
|
||||
import org.bouncycastle.shaded.util.Arrays;
|
||||
import org.bouncycastle.shaded.util.Pack;
|
||||
|
||||
/**
|
||||
* an implementation of the AES (Rijndael), from FIPS-197.
|
@ -1,10 +1,10 @@
|
||||
package org.bouncycastle.crypto.macs;
|
||||
package org.bouncycastle.shaded.crypto.macs;
|
||||
|
||||
import org.bouncycastle.crypto.BlockCipher;
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.crypto.Mac;
|
||||
import org.bouncycastle.crypto.modes.CBCBlockCipher;
|
||||
import org.bouncycastle.crypto.paddings.BlockCipherPadding;
|
||||
import org.bouncycastle.shaded.crypto.BlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.crypto.Mac;
|
||||
import org.bouncycastle.shaded.crypto.modes.CBCBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.paddings.BlockCipherPadding;
|
||||
|
||||
/**
|
||||
* standard CBC Block Cipher MAC - if no padding is specified the default of
|
||||
@ -43,7 +43,7 @@ public class CBCBlockCipherMac
|
||||
*/
|
||||
public CBCBlockCipherMac(
|
||||
BlockCipher cipher,
|
||||
BlockCipherPadding padding)
|
||||
org.bouncycastle.shaded.crypto.paddings.BlockCipherPadding padding)
|
||||
{
|
||||
this(cipher, (cipher.getBlockSize() * 8) / 2, padding);
|
||||
}
|
||||
@ -85,7 +85,7 @@ public class CBCBlockCipherMac
|
||||
public CBCBlockCipherMac(
|
||||
BlockCipher cipher,
|
||||
int macSizeInBits,
|
||||
BlockCipherPadding padding)
|
||||
BlockCipherPadding padding)
|
||||
{
|
||||
if ((macSizeInBits % 8) != 0)
|
||||
{
|
@ -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}.
|
@ -1,8 +1,9 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.crypto.DataLengthException;
|
||||
import org.bouncycastle.crypto.InvalidCipherTextException;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.crypto.DataLengthException;
|
||||
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.
|
||||
@ -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
|
||||
* 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.
|
||||
* @see org.bouncycastle.crypto.params.AEADParameters
|
||||
* @see AEADParameters
|
||||
*/
|
||||
public interface AEADCipher
|
||||
{
|
||||
@ -88,7 +89,7 @@ public interface AEADCipher
|
||||
* @param outOff offset into out to start copying the data at.
|
||||
* @return number of bytes written into out.
|
||||
* @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)
|
||||
throws IllegalStateException, InvalidCipherTextException;
|
@ -1,11 +1,11 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
import org.bouncycastle.crypto.BlockCipher;
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.crypto.DataLengthException;
|
||||
import org.bouncycastle.crypto.DefaultMultiBlockCipher;
|
||||
import org.bouncycastle.crypto.params.ParametersWithIV;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import org.bouncycastle.shaded.crypto.BlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.crypto.DataLengthException;
|
||||
import org.bouncycastle.shaded.crypto.DefaultMultiBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.params.ParametersWithIV;
|
||||
import org.bouncycastle.shaded.util.Arrays;
|
||||
|
||||
/**
|
||||
* implements Cipher-Block-Chaining (CBC) mode on top of a simple cipher.
|
@ -1,7 +1,7 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
import org.bouncycastle.crypto.BlockCipher;
|
||||
import org.bouncycastle.crypto.MultiBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.BlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.MultiBlockCipher;
|
||||
|
||||
public interface CBCModeCipher
|
||||
extends MultiBlockCipher
|
@ -1,17 +1,17 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import org.bouncycastle.crypto.BlockCipher;
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.crypto.DataLengthException;
|
||||
import org.bouncycastle.crypto.InvalidCipherTextException;
|
||||
import org.bouncycastle.crypto.Mac;
|
||||
import org.bouncycastle.crypto.OutputLengthException;
|
||||
import org.bouncycastle.crypto.macs.CBCBlockCipherMac;
|
||||
import org.bouncycastle.crypto.params.AEADParameters;
|
||||
import org.bouncycastle.crypto.params.ParametersWithIV;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import org.bouncycastle.shaded.crypto.BlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.crypto.DataLengthException;
|
||||
import org.bouncycastle.shaded.crypto.InvalidCipherTextException;
|
||||
import org.bouncycastle.shaded.crypto.Mac;
|
||||
import org.bouncycastle.shaded.crypto.OutputLengthException;
|
||||
import org.bouncycastle.shaded.crypto.macs.CBCBlockCipherMac;
|
||||
import org.bouncycastle.shaded.crypto.params.AEADParameters;
|
||||
import org.bouncycastle.shaded.crypto.params.ParametersWithIV;
|
||||
import org.bouncycastle.shaded.util.Arrays;
|
||||
|
||||
/**
|
||||
* Implements the Counter with Cipher Block Chaining mode (CCM) detailed in
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
public interface CCMModeCipher
|
||||
extends AEADBlockCipher
|
@ -1,8 +1,8 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
import org.bouncycastle.crypto.BlockCipher;
|
||||
import org.bouncycastle.crypto.MultiBlockCipher;
|
||||
import org.bouncycastle.crypto.SkippingStreamCipher;
|
||||
import org.bouncycastle.shaded.crypto.BlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.MultiBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.SkippingStreamCipher;
|
||||
|
||||
public interface CTRModeCipher
|
||||
extends MultiBlockCipher, SkippingStreamCipher
|
@ -1,13 +1,13 @@
|
||||
package org.bouncycastle.crypto.modes;
|
||||
package org.bouncycastle.shaded.crypto.modes;
|
||||
|
||||
import org.bouncycastle.crypto.BlockCipher;
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.crypto.DataLengthException;
|
||||
import org.bouncycastle.crypto.OutputLengthException;
|
||||
import org.bouncycastle.crypto.StreamBlockCipher;
|
||||
import org.bouncycastle.crypto.params.ParametersWithIV;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import org.bouncycastle.util.Pack;
|
||||
import org.bouncycastle.shaded.crypto.BlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.crypto.DataLengthException;
|
||||
import org.bouncycastle.shaded.crypto.OutputLengthException;
|
||||
import org.bouncycastle.shaded.crypto.StreamBlockCipher;
|
||||
import org.bouncycastle.shaded.crypto.params.ParametersWithIV;
|
||||
import org.bouncycastle.shaded.util.Arrays;
|
||||
import org.bouncycastle.shaded.util.Pack;
|
||||
|
||||
/**
|
||||
* Implements the Segmented Integer Counter (SIC) mode on top of a simple
|
@ -1,8 +1,8 @@
|
||||
package org.bouncycastle.crypto.paddings;
|
||||
package org.bouncycastle.shaded.crypto.paddings;
|
||||
|
||||
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
|
@ -1,7 +1,7 @@
|
||||
package org.bouncycastle.crypto.params;
|
||||
package org.bouncycastle.shaded.crypto.params;
|
||||
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.util.Arrays;
|
||||
|
||||
public class AEADParameters
|
||||
implements CipherParameters
|
@ -1,7 +1,7 @@
|
||||
package org.bouncycastle.crypto.params;
|
||||
package org.bouncycastle.shaded.crypto.params;
|
||||
|
||||
import org.bouncycastle.crypto.CipherParameters;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import org.bouncycastle.shaded.crypto.CipherParameters;
|
||||
import org.bouncycastle.shaded.util.Arrays;
|
||||
|
||||
public class KeyParameter
|
||||
implements CipherParameters
|
@ -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
|
||||
implements CipherParameters
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.util;
|
||||
package org.bouncycastle.shaded.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.NoSuchElementException;
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.util;
|
||||
package org.bouncycastle.shaded.util;
|
||||
|
||||
public class Objects
|
||||
{
|
@ -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.
|
@ -1,4 +1,4 @@
|
||||
package org.bouncycastle.util;
|
||||
package org.bouncycastle.shaded.util;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
Loading…
Reference in New Issue
Block a user