diff options
author | Adam Vartanian <flooey@google.com> | 2017-07-11 10:17:24 +0100 |
---|---|---|
committer | Adam Vartanian <flooey@google.com> | 2017-07-20 08:55:12 +0100 |
commit | 4936950820c68699a4ace55a2a8e5f7f677a913d (patch) | |
tree | 60fd944d4a3dcd27d8a5308e7b7598afa18d2025 /bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java | |
parent | 6ec33a667cad9a33e8049206a0507fcece28fd9c (diff) | |
download | bouncycastle-4936950820c68699a4ace55a2a8e5f7f677a913d.tar.gz |
Update change markers in external/bouncycastle.
For the most part, this is just changing markers that had no explanatory
text and adding an explanation. Some more detail on two of the common
explanations:
"Unsupported algorithms": We choose not to ship a whole lot of the
various crypto algorithms that Bouncy Castle supports. Justfying each
individual choice to disable a given algorithm is out of place in the
code and also doesn't have a natural home (since each algorithm is
disabled in upwards of a dozen places), so just mark where algorithms
are disabled due to being unsupported.
"Unknown reason": I looked in the history and couldn't find any
justification for the change. Generally these changes were made in
commits with descriptions like "bouncycastle 1.49 upgrade" from multiple
years ago. I don't want to change behavior in this change, so I left
these changes as they were; these can be revisited in the future if
desired.
This change also reverts some diffs from upstream, both inside disabled
blocks of code (which is irrelevant) and ones that are active but have
no behavioral change (for example, an added package-visible constructor
that isn't called by any class in the package). There're also a number
of whitespace-only changes that revert diffs from upstream.
Bug: 63092064
Test: cts -m CtsLibcoreTestCases
Change-Id: I27c61063eda849455bc93edaf180acefb5eed217
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java')
-rw-r--r-- | bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java | 141 |
1 files changed, 72 insertions, 69 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java b/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java index c98b764c..5a3af046 100644 --- a/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java +++ b/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/rsa/CipherSpi.java @@ -26,9 +26,8 @@ import org.bouncycastle.crypto.AsymmetricBlockCipher; import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.Digest; import org.bouncycastle.crypto.InvalidCipherTextException; -// BEGIN android-removed +// Android-removed: Unsupported algorithm // import org.bouncycastle.crypto.encodings.ISO9796d1Encoding; -// END android-removed import org.bouncycastle.crypto.encodings.OAEPEncoding; import org.bouncycastle.crypto.encodings.PKCS1Encoding; import org.bouncycastle.crypto.engines.RSABlindedEngine; @@ -203,12 +202,12 @@ public class CipherSpi { cipher = new PKCS1Encoding(new RSABlindedEngine()); } - // BEGIN android-removed + // BEGIN Android-removed: Unsupported algorithm // else if (pad.equals("ISO9796-1PADDING")) // { // cipher = new ISO9796d1Encoding(new RSABlindedEngine()); // } - // END android-removed + // END Android-removed: Unsupported algorithm else if (pad.equals("OAEPWITHMD5ANDMGF1PADDING")) { initFromSpec(new OAEPParameterSpec("MD5", "MGF1", new MGF1ParameterSpec("MD5"), PSource.PSpecified.DEFAULT)); @@ -237,27 +236,29 @@ public class CipherSpi { initFromSpec(new OAEPParameterSpec("SHA-512", "MGF1", MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT)); } - // BEGIN android-removed - // else if (pad.equals("OAEPWITHSHA3-224ANDMGF1PADDING")) - // { - // initFromSpec(new OAEPParameterSpec("SHA3-224", "MGF1", new MGF1ParameterSpec("SHA3-224"), PSource.PSpecified.DEFAULT)); - // } - // else if (pad.equals("OAEPWITHSHA3-256ANDMGF1PADDING")) - // { - // initFromSpec(new OAEPParameterSpec("SHA3-256", "MGF1", new MGF1ParameterSpec("SHA3-256"), PSource.PSpecified.DEFAULT)); - // } - // else if (pad.equals("OAEPWITHSHA3-384ANDMGF1PADDING")) - // { - // initFromSpec(new OAEPParameterSpec("SHA3-384", "MGF1", new MGF1ParameterSpec("SHA3-384"), PSource.PSpecified.DEFAULT)); - // } - // else if (pad.equals("OAEPWITHSHA3-512ANDMGF1PADDING")) - // { - // initFromSpec(new OAEPParameterSpec("SHA3-512", "MGF1", new MGF1ParameterSpec("SHA3-512"), PSource.PSpecified.DEFAULT)); - // } - // END android-removed + // BEGIN Android-removed: Unsupported algorithms + /* + else if (pad.equals("OAEPWITHSHA3-224ANDMGF1PADDING")) + { + initFromSpec(new OAEPParameterSpec("SHA3-224", "MGF1", new MGF1ParameterSpec("SHA3-224"), PSource.PSpecified.DEFAULT)); + } + else if (pad.equals("OAEPWITHSHA3-256ANDMGF1PADDING")) + { + initFromSpec(new OAEPParameterSpec("SHA3-256", "MGF1", new MGF1ParameterSpec("SHA3-256"), PSource.PSpecified.DEFAULT)); + } + else if (pad.equals("OAEPWITHSHA3-384ANDMGF1PADDING")) + { + initFromSpec(new OAEPParameterSpec("SHA3-384", "MGF1", new MGF1ParameterSpec("SHA3-384"), PSource.PSpecified.DEFAULT)); + } + else if (pad.equals("OAEPWITHSHA3-512ANDMGF1PADDING")) + { + initFromSpec(new OAEPParameterSpec("SHA3-512", "MGF1", new MGF1ParameterSpec("SHA3-512"), PSource.PSpecified.DEFAULT)); + } + */ + // END Android-removed: Unsupported algorithms else { - throw new NoSuchPaddingException(padding + " unavailable with RSA."); + throw new NoSuchPaddingException(padding + " unavailable with RSA."); } } @@ -562,50 +563,52 @@ public class CipherSpi } } - // BEGIN android-removed - // static public class PKCS1v1_5Padding - // extends CipherSpi - // { - // public PKCS1v1_5Padding() - // { - // super(new PKCS1Encoding(new RSABlindedEngine())); - // } - // } - // - // static public class PKCS1v1_5Padding_PrivateOnly - // extends CipherSpi - // { - // public PKCS1v1_5Padding_PrivateOnly() - // { - // super(false, true, new PKCS1Encoding(new RSABlindedEngine())); - // } - // } - // - // static public class PKCS1v1_5Padding_PublicOnly - // extends CipherSpi - // { - // public PKCS1v1_5Padding_PublicOnly() - // { - // super(true, false, new PKCS1Encoding(new RSABlindedEngine())); - // } - // } - // - // static public class OAEPPadding - // extends CipherSpi - // { - // public OAEPPadding() - // { - // super(OAEPParameterSpec.DEFAULT); - // } - // } - // - // static public class ISO9796d1Padding - // extends CipherSpi - // { - // public ISO9796d1Padding() - // { - // super(new ISO9796d1Encoding(new RSABlindedEngine())); - // } - // } - // END android-removed + // BEGIN Android-removed: Unsupported algorithms + /* + static public class PKCS1v1_5Padding + extends CipherSpi + { + public PKCS1v1_5Padding() + { + super(new PKCS1Encoding(new RSABlindedEngine())); + } + } + + static public class PKCS1v1_5Padding_PrivateOnly + extends CipherSpi + { + public PKCS1v1_5Padding_PrivateOnly() + { + super(false, true, new PKCS1Encoding(new RSABlindedEngine())); + } + } + + static public class PKCS1v1_5Padding_PublicOnly + extends CipherSpi + { + public PKCS1v1_5Padding_PublicOnly() + { + super(true, false, new PKCS1Encoding(new RSABlindedEngine())); + } + } + + static public class OAEPPadding + extends CipherSpi + { + public OAEPPadding() + { + super(OAEPParameterSpec.DEFAULT); + } + } + + static public class ISO9796d1Padding + extends CipherSpi + { + public ISO9796d1Padding() + { + super(new ISO9796d1Encoding(new RSABlindedEngine())); + } + } + */ + // END Android-removed: Unsupported algorithms } |