src/share/classes/java/security/SignatureSpi.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2006, 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, 2013, 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
*** 33,43 ****
import sun.security.jca.JCAUtil;
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
! * for the <code>Signature</code> class, which is used to provide the
* functionality of a digital signature algorithm. Digital signatures are used
* for authentication and integrity assurance of digital data.
*.
* <p> All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
--- 33,43 ----
import sun.security.jca.JCAUtil;
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
! * for the {@code Signature} class, which is used to provide the
* functionality of a digital signature algorithm. Digital signatures are used
* for authentication and integrity assurance of digital data.
*.
* <p> All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
*** 128,139 ****
protected abstract void engineUpdate(byte[] b, int off, int len)
throws SignatureException;
/**
* Updates the data to be signed or verified using the specified
! * ByteBuffer. Processes the <code>data.remaining()</code> bytes
! * starting at at <code>data.position()</code>.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
* @param input the ByteBuffer
* @since 1.5
--- 128,139 ----
protected abstract void engineUpdate(byte[] b, int off, int len)
throws SignatureException;
/**
* Updates the data to be signed or verified using the specified
! * ByteBuffer. Processes the {@code data.remaining()} bytes
! * starting at at {@code data.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
* @param input the ByteBuffer
* @since 1.5
*** 181,224 ****
*/
protected abstract byte[] engineSign() throws SignatureException;
/**
* Finishes this signature operation and stores the resulting signature
! * bytes in the provided buffer <code>outbuf</code>, starting at
! * <code>offset</code>.
* The format of the signature depends on the underlying
* signature scheme.
*
* <p>The signature implementation is reset to its initial state
* (the state it was in after a call to one of the
! * <code>engineInitSign</code> methods)
* and can be reused to generate further signatures with the same private
* key.
*
* This method should be abstract, but we leave it concrete for
* binary compatibility. Knowledgeable providers should override this
* method.
*
* @param outbuf buffer for the signature result.
*
! * @param offset offset into <code>outbuf</code> where the signature is
* stored.
*
! * @param len number of bytes within <code>outbuf</code> allotted for the
* signature.
* Both this default implementation and the SUN provider do not
* return partial digests. If the value of this parameter is less
* than the actual signature length, this method will throw a
* SignatureException.
* This parameter is ignored if its value is greater than or equal to
* the actual signature length.
*
! * @return the number of bytes placed into <code>outbuf</code>
*
* @exception SignatureException if the engine is not
* initialized properly, if this signature algorithm is unable to
! * process the input data provided, or if <code>len</code> is less
* than the actual signature length.
*
* @since 1.2
*/
protected int engineSign(byte[] outbuf, int offset, int len)
--- 181,224 ----
*/
protected abstract byte[] engineSign() throws SignatureException;
/**
* Finishes this signature operation and stores the resulting signature
! * bytes in the provided buffer {@code outbuf}, starting at
! * {@code offset}.
* The format of the signature depends on the underlying
* signature scheme.
*
* <p>The signature implementation is reset to its initial state
* (the state it was in after a call to one of the
! * {@code engineInitSign} methods)
* and can be reused to generate further signatures with the same private
* key.
*
* This method should be abstract, but we leave it concrete for
* binary compatibility. Knowledgeable providers should override this
* method.
*
* @param outbuf buffer for the signature result.
*
! * @param offset offset into {@code outbuf} where the signature is
* stored.
*
! * @param len number of bytes within {@code outbuf} allotted for the
* signature.
* Both this default implementation and the SUN provider do not
* return partial digests. If the value of this parameter is less
* than the actual signature length, this method will throw a
* SignatureException.
* This parameter is ignored if its value is greater than or equal to
* the actual signature length.
*
! * @return the number of bytes placed into {@code outbuf}
*
* @exception SignatureException if the engine is not
* initialized properly, if this signature algorithm is unable to
! * process the input data provided, or if {@code len} is less
* than the actual signature length.
*
* @since 1.2
*/
protected int engineSign(byte[] outbuf, int offset, int len)
*** 291,301 ****
*
* @param param the string identifier of the parameter.
*
* @param value the parameter value.
*
! * @exception InvalidParameterException if <code>param</code> is an
* invalid parameter for this signature algorithm engine,
* the parameter is already set
* and cannot be set again, a security exception occurs, and so on.
*
* @deprecated Replaced by {@link
--- 291,301 ----
*
* @param param the string identifier of the parameter.
*
* @param value the parameter value.
*
! * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this signature algorithm engine,
* the parameter is already set
* and cannot be set again, a security exception occurs, and so on.
*
* @deprecated Replaced by {@link
*** 360,370 ****
* @param param the string name of the parameter.
*
* @return the object that represents the parameter value, or null if
* there is none.
*
! * @exception InvalidParameterException if <code>param</code> is an
* invalid parameter for this engine, or another exception occurs while
* trying to get this parameter.
*
* @deprecated
*/
--- 360,370 ----
* @param param the string name of the parameter.
*
* @return the object that represents the parameter value, or null if
* there is none.
*
! * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this engine, or another exception occurs while
* trying to get this parameter.
*
* @deprecated
*/
*** 376,386 ****
* Returns a clone if the implementation is cloneable.
*
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called
! * on an implementation that does not support <code>Cloneable</code>.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
return super.clone();
} else {
--- 376,386 ----
* Returns a clone if the implementation is cloneable.
*
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called
! * on an implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
return super.clone();
} else {