this.update(hData);
sOut.write((byte)version); sOut.write((byte)0xff); sOut.write((byte)(hData.length >> 24)); sOut.write((byte)(hData.length >> 16)); sOut.write((byte)(hData.length >> 8)); sOut.write((byte)(hData.length));
    public PGPSignature generate()        throws PGPException, SignatureException    {        MPInteger[]             sigValues;        int                     version = 4;        ByteArrayOutputStream   sOut = new ByteArrayOutputStream();                int    index = 0;                if (!creationTimeFound)        {            hashed[index++] = new SignatureCreationTime(false, new Date());        }                if (!issuerKeyIDFound)        {            hashed[index++] = new IssuerKeyID(false, privKey.getKeyID());        }                try        {            sOut.write((byte)version);            sOut.write((byte)signatureType);            sOut.write((byte)keyAlgorithm);            sOut.write((byte)hashAlgorithm);                        ByteArrayOutputStream    hOut = new ByteArrayOutputStream();                        for (int i = 0; i != hashed.length; i++)            {                hashed[i].encode(hOut);            }                            byte[]                            data = hOut.toByteArray();                sOut.write((byte)(data.length >> 8));            sOut.write((byte)data.length);            sOut.write(data);        }        catch (IOException e)        {            throw new PGPException("exception encoding hashed data.", e);        }                byte[]    hData = sOut.toByteArray();                this.update(hData);                this.update((byte)version);        this.update((byte)0xff);        this.update((byte)(hData.length >> 24));        this.update((byte)(hData.length >> 16));        this.update((byte)(hData.length >> 8));        this.update((byte)(hData.length));                if (keyAlgorithm == PublicKeyAlgorithmTags.RSA_SIGN            || keyAlgorithm == PublicKeyAlgorithmTags.RSA_GENERAL)    // an RSA signature        {            sigValues = new MPInteger[1];            sigValues[0] = new MPInteger(new BigInteger(1, sig.sign()));        }        else        {               sigValues = PGPUtil.dsaSigToMpi(sig.sign());        }                byte[]                        digest = dig.digest();        byte[]                        fingerPrint = new byte[2];                fingerPrint[0] = digest[0];        fingerPrint[1] = digest[1];                return new PGPSignature(new SignaturePacket(signatureType, privKey.getKeyID(), keyAlgorithm, hashAlgorithm, hashed, unhashed, fingerPrint, sigValues));    }