Esempio n. 1
0
            private void WriteOnePassSignature(bool isNested)
            {
                Debug.Assert(!generator.onePassWritten);
                var onePassPacket = new OnePassSignaturePacket(
                    generator.signatureGenerator.SignatureType,
                    generator.signatureGenerator.HashAlgorithm,
                    generator.signatureGenerator.PrivateKey.Algorithm,
                    generator.signatureGenerator.PrivateKey.KeyId,
                    isNested);

                innerWriter.WritePacket(onePassPacket);
                generator.onePassWritten = true;
            }
Esempio n. 2
0
        internal PgpOnePassSignature(
            OnePassSignaturePacket sigPack)
        {
            this.sigPack = sigPack;
            this.signatureType = sigPack.SignatureType;

            try
            {
                this.sig = SignerUtilities.GetSigner(
                    PgpUtilities.GetSignatureName(sigPack.KeyAlgorithm, sigPack.HashAlgorithm));
            }
            catch (Exception e)
            {
                throw new PgpException("can't set up signature object.",  e);
            }
        }
Esempio n. 3
0
        internal PgpOnePassSignature(
            OnePassSignaturePacket sigPack)
        {
            this.sigPack       = sigPack;
            this.signatureType = sigPack.SignatureType;

            try
            {
                this.sig = SignerUtilities.GetSigner(
                    PgpUtilities.GetSignatureName(sigPack.KeyAlgorithm, sigPack.HashAlgorithm));
            }
            catch (Exception e)
            {
                throw new PgpException("can't set up signature object.", e);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Parses a signed message out of the given array of packets.
        /// In this special case, the first packet must be a signature
        /// packet or a one-pass signature packet. This is followed by
        /// an OpenPGP message and optionally (if the first packet was
        /// a one-pass signature packet) and ordinary signature packet.
        /// </summary>
        /// <returns>Returns the number of packets used by the function.
        /// </returns>
        /// <param name="packets">Array of packets that contains the
        /// signed message.</param>
        /// <remarks>No remarks</remarks>
        public override int ParseMessage(Packet[] packets)
        {
            if (packets[0] is OnePassSignaturePacket)
            {
                bOnePassSigned = true;
                opsOnePass     = (OnePassSignaturePacket)packets[0];
            }
            else if (packets[0] is SignaturePacket)
            {
                bOnePassSigned = false;
                spSignature    = (SignaturePacket)packets[0];
            }
            else
            {
                throw new System.ArgumentException("This does not appear to be a valid OpenPGP signed message!");
            }

            Packet[] pMessage = new Packet[packets.Length - 1];
            Array.Copy(packets, 1, pMessage, 0, pMessage.Length);
            lmSignedMessage = new LiteralMessage();
            int iPos = 0;

            try {
                iPos = lmSignedMessage.ParseMessage(pMessage);
            } catch (Exception) {}

            if (iPos == 0)
            {
                throw new System.ArgumentException("This does not appear to be a valid OpenPGP signed message!");
            }

            iPos++;
            if (bOnePassSigned)
            {
                if (packets[iPos] is SignaturePacket)
                {
                    spSignature = (SignaturePacket)packets[iPos];
                    iPos++;
                }
                else
                {
                    throw new System.ArgumentException("This does not appear to be a valid OpenPGP signed message!");
                }
            }

            return(iPos);
        }
Esempio n. 5
0
 internal PgpOnePassSignature(
     OnePassSignaturePacket sigPack)
 {
     this.sigPack       = sigPack;
     this.signatureType = sigPack.SignatureType;
 }
		internal PgpOnePassSignature(
            OnePassSignaturePacket sigPack)
        {
            this.sigPack = sigPack;
            this.signatureType = sigPack.SignatureType;
        }
 internal PgpOnePassSignature(
     OnePassSignaturePacket sigPack)
 {
     _sigPack       = sigPack;
     _signatureType = sigPack.SignatureType;
 }
 internal PgpOnePassSignature(
     OnePassSignaturePacket sigPack)
 {
     _sigPack = sigPack;
     _signatureType = sigPack.SignatureType;
 }