Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * See the NOTICE file distributed with this work for additional
   * information regarding copyright ownership.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.xwiki.crypto.signer;
 
 
Interface on a signer engines ready to process data for signing or verification.

Version:
$Id: eadb86410dcbfcaf9713c5381314fa2a4f6e6a16 $
Since:
5.4RC1
 
 public interface Signer
 {
    

Returns:
the algorithm name of the underlying signer.
 
     String getAlgorithmName();

    

Returns:
true if the signer is initialised for signing, and false for verifying.
 
     boolean isForSigning();

    
Return a pass through input stream, all data will be accumulated for calculating signatures. The signer is reset each time this function is called.

Parameters:
is an input stream to read from and pass through.
Returns:
a pass through input stream.
 
Return a pass through output stream, all data will be accumulated for calculating signatures. The signer is reset each time this function is called.

Returns:
an output stream to this signer.
 
     OutputStream getOutputStream();

    
Accumulate byte data to calculate signature.

Parameters:
input a byte.
 
     void update(byte input);

    
Accumulate byte array data to calculate signature.

Parameters:
input a byte array.
 
     void update(byte[] input);

    
Accumulate part of a byte array to calculate signature.

Parameters:
input the input buffer.
inputOffset the offset in input where the input starts.
inputLen the input length.
 
     void update(byte[] inputint inputOffsetint inputLen);

    
Generate a signature for the accumulated data. The bytes that have been accumulated during a previous update or stream operations are signed. Upon finish, this method resets this signer.

Returns:
a buffer with the signature.
Throws:
java.security.GeneralSecurityException if this signing algorithm is unable to proceed properly.
 
    byte[] generate() throws GeneralSecurityException;


    
Generate a signature for the accumulated data, including the provided buffer. The bytes that have been accumulated during a previous update or stream operations appended with the given input buffer are signed. Upon finish, this method resets this signer.

Parameters:
input the input buffer.
Returns:
a buffer with the signature.
Throws:
java.security.GeneralSecurityException if this signing algorithm is unable to proceed properly.
    byte[] generate(byte[] inputthrows GeneralSecurityException;


    
Generate a signature for the accumulated data, including the part of the provided buffer. The bytes that have been accumulated during a previous update or stream operations appended with the first inputLen bytes in the input buffer, starting at inputOffset inclusive, are signed. Upon finish, this method resets this signer.

Parameters:
input the input buffer.
inputOffset the offset in input where the input starts.
inputLen the input length.
Returns:
a buffer with the signature.
Throws:
java.security.GeneralSecurityException if this signing algorithm is unable to proceed properly.
    byte[] generate(byte[] inputint inputOffsetint inputLenthrows GeneralSecurityException;

    
Verify the given signature against the accumulated data. The bytes that have been accumulated during a previous update or stream operations are signed, and signatures are compared. Upon finish, this method resets this signer.

Parameters:
signature to be verified.
Returns:
true if signatures are equals.
Throws:
java.security.GeneralSecurityException if this signing algorithm is unable to proceed properly.
    boolean verify(byte[] signaturethrows GeneralSecurityException;


    
Verify the given signature against the accumulated data, including the provided buffer. The bytes that have been accumulated during a previous update or stream operations appended with the given input buffer are signed, and signatures are compared. Upon finish, this method resets this signer.

Parameters:
signature to be verified.
input the input buffer.
Returns:
a buffer with the signature.
Throws:
java.security.GeneralSecurityException if this signing algorithm is unable to proceed properly.
    boolean verify(byte[] signaturebyte[] inputthrows GeneralSecurityException;


    
Verify the given signature against the accumulated data, including the part of the provided buffer. The bytes that have been accumulated during a previous update or stream operations appended with the first inputLen bytes in the input buffer, starting at inputOffset inclusive, are signed, and signatures are compared. Upon finish, this method resets this signer.

Parameters:
signature to be verified.
signOffset the offset in signature buffer where the signature starts.
signLen the signature length.
input the input buffer.
inputOffset the offset in input where the input starts.
inputLen the input length.
Returns:
a buffer with the signature.
Throws:
java.security.GeneralSecurityException if this signing algorithm is unable to proceed properly.
    boolean verify(byte[] signatureint signOffsetint signLenbyte[] inputint inputOffsetint inputLen)
        throws GeneralSecurityException;

    

Returns:
the algorithm identifier of this signer in encoded form.
    byte[] getEncoded();
New to GrepCode? Check out our FAQ X