es.caib.signatura.impl
Class SMIMEInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by es.caib.signatura.impl.SMIMEInputStream
All Implemented Interfaces:
java.io.Closeable

public class SMIMEInputStream
extends java.io.InputStream

Clase que transforma un InputStream cualquiera en un InputStream en formato SMIME, estableciendo en la cabecera el content-type que se le pasa como argumento al constructor y codificando los bytes de entrada en base64. Modificacion introducidas por FGU para permitir generacion del SMIME a partir de un PKCS#7 que contiene una firma en paralelo: * Se intoruduce nuevo constructor a partir de un array de bytes que contiene el pkcs#7 y el contentType * Se introduce el atributo contentType para en el metodo fetchContentHeader no tener que obtenerlo de la signature * El constructor que utiliza la Signature da valor al atribute contentType

Version:
1.0
Author:
Biel Buades

Constructor Summary
SMIMEInputStream(byte[] pkcs7, java.io.InputStream content, java.lang.String contentType)
          Crea un nuevo SMIMEInputStream a partir de la firma en pkcs7 y el contentType del MIME
SMIMEInputStream(Signature signature, java.io.InputStream content)
          Crea un nuevo MIMEInputStream
 
Method Summary
 int available()
           
 void close()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] targetBuffer, int offset, int length)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMIMEInputStream

public SMIMEInputStream(Signature signature,
                        java.io.InputStream content)
                 throws java.io.UnsupportedEncodingException
Crea un nuevo MIMEInputStream

Parameters:
signature - Firma electrónica válida para el documento a encapsular
content - InputStream con el contenido del documento firmado.
Throws:
java.io.UnsupportedEncodingException

SMIMEInputStream

public SMIMEInputStream(byte[] pkcs7,
                        java.io.InputStream content,
                        java.lang.String contentType)
Crea un nuevo SMIMEInputStream a partir de la firma en pkcs7 y el contentType del MIME

Parameters:
pkcs7 - el array de bytes que representa el pkcs7
content - El contenido que se firma.
contentType - El tipo del contenido que se firma.
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] targetBuffer,
                int offset,
                int length)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream


Copyright © 2011 Direcció General de Tecnologia i Comunicacions. Govern de les Illes Balears. All Rights Reserved.