< prev index next >

src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/RSASignature.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2012, 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) 2005, 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
*** 24,42 **** */ package sun.security.mscapi; import java.nio.ByteBuffer; ! import java.security.PublicKey; ! import java.security.PrivateKey; ! import java.security.InvalidKeyException; ! import java.security.InvalidParameterException; ! import java.security.KeyStoreException; ! import java.security.NoSuchAlgorithmException; ! import java.security.ProviderException; ! import java.security.MessageDigest; ! import java.security.SignatureException; import java.math.BigInteger; import sun.security.rsa.RSAKeyFactory; /** --- 24,35 ---- */ package sun.security.mscapi; import java.nio.ByteBuffer; ! import java.security.*; ! import java.security.spec.AlgorithmParameterSpec; import java.math.BigInteger; import sun.security.rsa.RSAKeyFactory; /**
*** 228,237 **** --- 221,231 ---- super("MD2"); } } // initialize for signing. See JCA doc + @Override protected void engineInitVerify(PublicKey key) throws InvalidKeyException { // This signature accepts only RSAPublicKey if ((key instanceof java.security.interfaces.RSAPublicKey) == false) {
*** 278,287 **** --- 272,282 ---- this.privateKey = null; resetDigest(); } // initialize for signing. See JCA doc + @Override protected void engineInitSign(PrivateKey key) throws InvalidKeyException { // This signature accepts only RSAPrivateKey if ((key instanceof sun.security.mscapi.RSAPrivateKey) == false) { throw new InvalidKeyException("Key type not supported");
*** 324,333 **** --- 319,329 ---- * @param b the byte to use for the update. * * @exception SignatureException if the engine is not initialized * properly. */ + @Override protected void engineUpdate(byte b) throws SignatureException { messageDigest.update(b); needsReset = true; }
*** 341,350 **** --- 337,347 ---- * @param len the number of bytes to use, starting at offset * * @exception SignatureException if the engine is not initialized * properly */ + @Override protected void engineUpdate(byte[] b, int off, int len) throws SignatureException { messageDigest.update(b, off, len); needsReset = true;
*** 354,363 **** --- 351,361 ---- * Updates the data to be signed or verified, using the * specified ByteBuffer. * * @param input the ByteBuffer */ + @Override protected void engineUpdate(ByteBuffer input) { messageDigest.update(input); needsReset = true; }
*** 372,381 **** --- 370,380 ---- * * @exception SignatureException if the engine is not * initialized properly or if this signature algorithm is unable to * process the input data provided. */ + @Override protected byte[] engineSign() throws SignatureException { byte[] hash = getDigestValue(); // Omit the hash OID when generating a Raw signature
*** 433,442 **** --- 432,442 ---- * @exception SignatureException if the engine is not * initialized properly, the passed-in signature is improperly * encoded or of the wrong type, if this signature algorithm is unable to * process the input data provided, etc. */ + @Override protected boolean engineVerify(byte[] sigBytes) throws SignatureException { byte[] hash = getDigestValue();
*** 468,484 **** --- 468,501 ---- * * @deprecated Replaced by {@link * #engineSetParameter(java.security.spec.AlgorithmParameterSpec) * engineSetParameter}. */ + @Override @Deprecated protected void engineSetParameter(String param, Object value) throws InvalidParameterException { throw new InvalidParameterException("Parameter not supported"); } + /** + * Sets this signature engine with the specified algorithm parameter. + * + * @param params the parameters + * + * @exception InvalidAlgorithmParameterException if the given + * parameter is invalid + */ + @Override + protected void engineSetParameter(AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException + { + if (params != null) { + throw new InvalidAlgorithmParameterException("No parameter accepted"); + } + } /** * Gets the value of the specified algorithm parameter. * This method supplies a general-purpose mechanism through which it * is possible to get the various parameters of this object. A parameter
*** 498,515 **** --- 515,543 ---- * invalid parameter for this engine, or another exception occurs while * trying to get this parameter. * * @deprecated */ + @Override @Deprecated protected Object engineGetParameter(String param) throws InvalidParameterException { throw new InvalidParameterException("Parameter not supported"); } /** + * Gets the algorithm parameter from this signature engine. + * + * @return the parameter, or null if no parameter is used. + */ + @Override + protected AlgorithmParameters engineGetParameters() { + return null; + } + + /** * Generates a public-key BLOB from a key's components. */ // used by RSACipher static native byte[] generatePublicKeyBlob( int keyBitLength, byte[] modulus, byte[] publicExponent)
< prev index next >