Class RydePgpSigningOutputStream

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

    public class RydePgpSigningOutputStream
    extends ImprovedOutputStream
    OpenPGP detached signing service that wraps an OutputStream.

    This is the outermost layer. It signs the resulting file without modifying its bytes, instead generating an out-of-band .asc signature file. This is basically a SHA-256 checksum of the deposit file that's signed with our RSA private key. This allows the people who receive a deposit to check the signature against our public key so they can know the data hasn't been forged.

    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      RydePgpSigningOutputStream​(java.io.OutputStream os, org.bouncycastle.openpgp.PGPKeyPair signingKey)
      Create a signer that wraps os and generates a detached signature using signingKey.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getSignature()
      Returns the byte contents for the detached .asc signature file.
      void write​(byte[] b, int off, int len)  
      void write​(int b)  
      • Methods inherited from class java.io.FilterOutputStream

        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

      • RydePgpSigningOutputStream

        public RydePgpSigningOutputStream​(@WillNotClose
                                          java.io.OutputStream os,
                                          org.bouncycastle.openpgp.PGPKeyPair signingKey)
        Create a signer that wraps os and generates a detached signature using signingKey. After closing, you should call getSignature() to get the detached signature.
        Parameters:
        os - is the upstream OutputStream which is not closed by this object
        Throws:
        java.lang.RuntimeException - to rethrow PGPException
    • Method Detail

      • getSignature

        public byte[] getSignature()
                            throws java.io.IOException,
                                   org.bouncycastle.openpgp.PGPException
        Returns the byte contents for the detached .asc signature file.
        Throws:
        java.io.IOException
        org.bouncycastle.openpgp.PGPException