Beispiel #1
0
 internal PgpUser(ContainedPacket userPacket, PgpKey publicKey, PgpSignature signature)
 {
     this.userPacket = userPacket;
     //this.publicKey = publicKey;
     this.selfCertifications   = new List <PgpCertification>();
     this.otherCertifications  = new List <PgpCertification>();
     this.revocationSignatures = new List <PgpCertification>();
     AddCertification(publicKey, signature);
 }
Beispiel #2
0
 internal PgpUser(PgpUser user, PgpKey publicKey)
 {
     this.userPacket = user.userPacket;
     //this.publicKey = publicKey;
     this.selfCertifications   = new List <PgpCertification>();
     this.otherCertifications  = new List <PgpCertification>();
     this.revocationSignatures = new List <PgpCertification>();
     foreach (var certification in user.selfCertifications)
     {
         this.selfCertifications.Add(new PgpCertification(certification.Signature, userPacket, publicKey));
     }
     foreach (var certification in user.otherCertifications)
     {
         this.otherCertifications.Add(new PgpCertification(certification.Signature, userPacket, publicKey));
     }
     foreach (var certification in user.revocationSignatures)
     {
         this.revocationSignatures.Add(new PgpCertification(certification.Signature, userPacket, publicKey));
     }
 }
Beispiel #3
0
        internal PgpUser(IPacketReader packetReader, PgpKey publicKey)
        {
            Debug.Assert(packetReader.NextPacketTag() == PacketTag.UserId || packetReader.NextPacketTag() == PacketTag.UserAttribute);

            //this.publicKey = publicKey;
            this.userPacket  = packetReader.ReadContainedPacket();
            this.trustPacket = packetReader.NextPacketTag() == PacketTag.Trust ? (TrustPacket)packetReader.ReadContainedPacket() : null;

            selfCertifications   = new List <PgpCertification>();
            otherCertifications  = new List <PgpCertification>();
            revocationSignatures = new List <PgpCertification>();

            while (packetReader.NextPacketTag() == PacketTag.Signature)
            {
                var signaturePacket      = (SignaturePacket)packetReader.ReadContainedPacket();
                var signatureTrustPacket = packetReader.NextPacketTag() == PacketTag.Trust ? (TrustPacket)packetReader.ReadContainedPacket() : null;
                var signature            = new PgpSignature(signaturePacket, signatureTrustPacket);
                AddCertification(publicKey, signature);
            }
        }
Beispiel #4
0
 public void WritePacket(ContainedPacket packet)
 {
     // The only packets that should be writtern here are the streamable ones
     // or nested signature.
     if (packet is OnePassSignaturePacket && !generator.onePassWritten)
     {
         // Nested signature, write our one-pass packet first
         WriteOnePassSignature(true);
         innerWriter.WritePacket(packet);
     }
     else if (packet is SignaturePacket)
     {
         Debug.Assert(generator.onePassWritten);
         Debug.Assert(generator.literalDataWritten);
         innerWriter.WritePacket(packet);
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
 public void WritePacket(ContainedPacket p)
 {
     p.Encode(this);
 }
Beispiel #6
0
 public void WritePacket(ContainedPacket packet) => packetWriter.WritePacket(packet);