src/java.base/share/classes/javax/crypto/Cipher.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
child 50323 25d711fca885
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   319         StringTokenizer parser = new StringTokenizer(transformation, "/");
   319         StringTokenizer parser = new StringTokenizer(transformation, "/");
   320         try {
   320         try {
   321             while (parser.hasMoreTokens() && count < 3) {
   321             while (parser.hasMoreTokens() && count < 3) {
   322                 parts[count++] = parser.nextToken().trim();
   322                 parts[count++] = parser.nextToken().trim();
   323             }
   323             }
   324             if (count == 0 || count == 2 || parser.hasMoreTokens()) {
   324             if (count == 0 || count == 2) {
   325                 throw new NoSuchAlgorithmException("Invalid transformation"
   325                 throw new NoSuchAlgorithmException("Invalid transformation"
   326                                                + " format:" +
   326                                                + " format:" +
   327                                                transformation);
   327                                                transformation);
       
   328             }
       
   329             // treats all subsequent tokens as part of padding
       
   330             if (count == 3 && parser.hasMoreTokens()) {
       
   331                 parts[2] = parts[2] + parser.nextToken("\r\n");
   328             }
   332             }
   329         } catch (NoSuchElementException e) {
   333         } catch (NoSuchElementException e) {
   330             throw new NoSuchAlgorithmException("Invalid transformation " +
   334             throw new NoSuchAlgorithmException("Invalid transformation " +
   331                                            "format:" + transformation);
   335                                            "format:" + transformation);
   332         }
   336         }