Class SignedOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class SignedOutputStream
    extends java.io.FilterOutputStream
    Objects of this class can be used to sign the contents of a stream that can be verified by a SignedInputStream class. Note: This is not a part of the official handle protocol specification. This was introduced by CNRI solely for replication in the Handle.net software.
    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      SignedOutputStream​(java.io.OutputStream out)  
      SignedOutputStream​(java.security.cert.X509Certificate certificate, java.security.PrivateKey sourceKey, java.io.OutputStream out, java.net.Socket socket)  
      SignedOutputStream​(java.security.PrivateKey sourceKey, java.io.OutputStream out)
      Create a stream that can verify the data read from the stream in blocks.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void signBlock()
      Signs the bytes written since the last signature on the stream.
      void write​(byte[] b)  
      void write​(byte[] b, int off, int len)  
      void write​(int b)
      Write a byte to the stream.
      • Methods inherited from class java.io.FilterOutputStream

        close, flush
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SignedOutputStream

        public SignedOutputStream​(java.security.PrivateKey sourceKey,
                                  java.io.OutputStream out)
                           throws HandleException,
                                  java.io.IOException
        Create a stream that can verify the data read from the stream in blocks. The caller should call the verifyBlock method at the end of every block of data that needs to be verified. verifyBlock must be called at the same position in the stream that signBlock was called in the parallel SignedOutputStream object that generated the stream.
        Throws:
        HandleException
        java.io.IOException
      • SignedOutputStream

        public SignedOutputStream​(java.io.OutputStream out)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • SignedOutputStream

        public SignedOutputStream​(java.security.cert.X509Certificate certificate,
                                  java.security.PrivateKey sourceKey,
                                  java.io.OutputStream out,
                                  java.net.Socket socket)
                           throws HandleException,
                                  java.io.IOException
        Throws:
        HandleException
        java.io.IOException
    • Method Detail

      • write

        public void write​(int b)
                   throws java.io.IOException
        Write a byte to the stream.
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • signBlock

        public void signBlock()
                       throws java.io.IOException,
                              java.security.SignatureException
        Signs the bytes written since the last signature on the stream. This should be called at the exact same point in the stream as the verifyBlock method in the SignedInputStream class.
        Throws:
        java.io.IOException
        java.security.SignatureException