2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 1545N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1545N/A * This code is free software; you can redistribute it and/or modify it 1545N/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 1545N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 1545N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1545N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1545N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1545N/A * version 2 for more details (a copy is included in the LICENSE file that 1545N/A * You should have received a copy of the GNU General Public License version 1545N/A * 2 along with this work; if not, write to the Free Software Foundation, 1545N/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 1545N/A * ECDSA signature implementation. This class currently supports the 1545N/A * following algorithm names: 1545N/A // message digest implementation we use 1545N/A // flag indicating whether the digest has been reset 1545N/A // private key, if initialized for signing 1545N/A // public key, if initialized for verifying 1545N/A * Constructs a new ECDSASignature. Used by Raw subclass. 1545N/A * @exception ProviderException if the native ECC library is unavailable. 1545N/A * Constructs a new ECDSASignature. Used by subclasses. 1545N/A // Nested class for NONEwithECDSA signatures 1545N/A // the longest supported digest is 512 bits (SHA-512) 1545N/A // Stores the precomputed message digest value. 1545N/A // Stores the precomputed message digest value. 1545N/A // Stores the precomputed message digest value. 1545N/A // Returns the precomputed message digest value. 1545N/A // Nested class for SHA1withECDSA signatures 1545N/A // Nested class for SHA256withECDSA signatures 1545N/A // Nested class for SHA384withECDSA signatures 1545N/A // Nested class for SHA512withECDSA signatures 1545N/A // initialize for verification. See JCA doc 1545N/A // Should check that the supplied key is appropriate for signature 1545N/A // algorithm (e.g. P-256 for SHA256withECDSA) 1545N/A // initialize for signing. See JCA doc 1545N/A // initialize for signing. See JCA doc 1545N/A // Should check that the supplied key is appropriate for signature 1545N/A // algorithm (e.g. P-256 for SHA256withECDSA) 1545N/A * Resets the message digest if needed. 1545N/A * Returns the message digest value. 1545N/A // update the signature with the plaintext data. See JCA doc 1545N/A // update the signature with the plaintext data. See JCA doc 1545N/A // update the signature with the plaintext data. See JCA doc 1545N/A // sign the data and return the signature. See JCA doc 1674N/A // seed is twice the key size (in bytes) plus 1 1545N/A // verify the data and return the result. See JCA doc 1545N/A }
else {
// instanceof ECPublicKey 1545N/A // set parameter, not supported. See JCA doc 1545N/A // get parameter, not supported. See JCA doc 1545N/A // Convert the concatenation of R and S into their DER encoding 1545N/A // Convert the DER encoding of R and S into a concatenation of R and S 1545N/A // r and s each occupy half the array 1545N/A // trim leading (most significant) zeroes from the result 1545N/A * Signs the digest using the private key. 1545N/A * @param digest the digest to be signed. 1545N/A * @param s the private key's S value. 1545N/A * @param encodedParams the curve's DER encoded object identifier. 1545N/A * @param seed the random seed. 1545N/A * @return byte[] the signature. 1545N/A * Verifies the signed digest using the public key. 1545N/A * @param signedDigest the signature to be verified. It is encoded 1545N/A * as a concatenation of the key's R and S values. 1545N/A * @param digest the digest to be used. 1545N/A * @param w the public key's W point (in uncompressed form). 1545N/A * @param encodedParams the curve's DER encoded object identifier. 1545N/A * @return boolean true if the signature is successfully verified.