< prev index next >

src/java.base/share/classes/javax/crypto/Cipher.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 557,578 **** int canuse = tr.supportsModePadding(s); if (canuse == S_NO) { // does not support mode or padding we need, ignore continue; } ! if (canuse == S_YES) { ! return new Cipher(null, s, t, transformation, transforms); ! } else { // S_MAYBE, try out if it works try { CipherSpi spi = (CipherSpi)s.newInstance(null); tr.setModePadding(spi); ! return new Cipher(spi, s, t, transformation, transforms); } catch (Exception e) { failure = e; } } - } throw new NoSuchAlgorithmException ("Cannot find any provider supporting " + transformation, failure); } /** --- 557,578 ---- int canuse = tr.supportsModePadding(s); if (canuse == S_NO) { // does not support mode or padding we need, ignore continue; } ! // S_YES, S_MAYBE ! // even when mode and padding are both supported, they ! // may not be used together, try out and see if it works try { CipherSpi spi = (CipherSpi)s.newInstance(null); tr.setModePadding(spi); ! // specify null instead of spi for delayed provider selection ! return new Cipher(null, s, t, transformation, transforms); } catch (Exception e) { failure = e; } } throw new NoSuchAlgorithmException ("Cannot find any provider supporting " + transformation, failure); } /**
< prev index next >