4589N/A * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * RSA cipher implementation using the Microsoft Crypto API. 0N/A * Objects should be instantiated by calling Cipher.getInstance() using the 0N/A * following algorithm name: 0N/A * We only do one RSA operation per doFinal() call. If the application passes 0N/A * more data via calls to update() or doFinal(), we throw an 0N/A * IllegalBlockSizeException when doFinal() is called (see JCE API spec). 0N/A * Bulk encryption using RSA does not make sense and is not standardized. 0N/A * Note: RSA keys should be at least 512 bits long 0N/A * @author Andreas Sterbenz 0N/A * @author Vincent Ryan 0N/A // constant for an empty byte array 0N/A private final static byte[]
B0 =
new byte[
0];
0N/A // mode constant for public key encryption 0N/A // mode constant for private key decryption 0N/A // mode constant for private key encryption (signing) 0N/A // mode constant for public key decryption (verifying) 0N/A // constant for PKCS#1 v1.5 RSA 0N/A // current mode, one of MODE_* above. Set when init() is called 0N/A // active padding type, one of PAD_* above. Set by setPadding() 0N/A // buffer for the data 0N/A // offset into the buffer (number of bytes buffered) 0N/A // size of the output (the length of the key). 0N/A // the public key, if we were initialized using a public key 0N/A // the private key, if we were initialized using a private key 0N/A // modes do not make sense for RSA, but allow ECB 0N/A // set the padding type 0N/A // return 0 as block size, we are not a block cipher 0N/A // return the output size 0N/A // no iv, return null 0N/A // no parameters, return null 0N/A (
"Parameters not supported");
0N/A (
"Parameters not supported");
0N/A // initialize this cipher 4108N/A // Convert key to MSCAPI format 4108N/A // Check against the local and global values to make sure 4108N/A // the sizes are ok. Round up to the nearest byte. 4108N/A // Adjust key length due to sign bit 0N/A // internal update method 0N/A // internal doFinal() method. Here we perform the actual RSA operation 0N/A // should not occur, handled with length check above 0N/A // Construct an X.509 encoded public key. 0N/A // Construct a PKCS #8 encoded private key. 0N/A // Construct an encoded secret key. 0N/A * It expects and returns ciphertext data in big-endian form.