summaryrefslogtreecommitdiffstats
path: root/luni/src/main
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2011-01-28 14:16:20 -0800
committerBrian Carlstrom <bdc@google.com>2011-01-28 14:16:20 -0800
commit937b6c4ef5f8ad57279e2ebed4393a78d1729d8b (patch)
tree4ed8dfa147722d57f7605f9ce8eeb623e26cf381 /luni/src/main
parent6503386ac054111d3827c2ba4b172f46491edfba (diff)
downloadlibcore-937b6c4ef5f8ad57279e2ebed4393a78d1729d8b.zip
libcore-937b6c4ef5f8ad57279e2ebed4393a78d1729d8b.tar.gz
libcore-937b6c4ef5f8ad57279e2ebed4393a78d1729d8b.tar.bz2
Tolerate leading slash in Cipher transformation
Bug: 3387688 Change-Id: Icd551df2cafd256e49fb92d12d7cb381479d841d
Diffstat (limited to 'luni/src/main')
-rw-r--r--luni/src/main/java/javax/crypto/Cipher.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/luni/src/main/java/javax/crypto/Cipher.java b/luni/src/main/java/javax/crypto/Cipher.java
index bff877f..06cfa70 100644
--- a/luni/src/main/java/javax/crypto/Cipher.java
+++ b/luni/src/main/java/javax/crypto/Cipher.java
@@ -327,6 +327,11 @@ public class Cipher {
}
private static String[] checkTransformation(String transformation) throws NoSuchAlgorithmException {
+ // ignore an extra prefix / characters such as in
+ // "/DES/CBC/PKCS5Paddin" http://b/3387688
+ if (transformation.startsWith("/")) {
+ transformation = transformation.substring(1);
+ }
// 'transformation' should be of the form "algorithm/mode/padding".
String[] pieces = transformation.split("/");
if (pieces.length > 3) {