Пример #1
0
        public void Encode(
            Stream outStream)
        {
            BcpgOutputStream output = BcpgOutputStream.Wrap(outStream);

            output.WritePacket(sigPack);
        }
Пример #2
0
        public void Encode(Stream outStream)
        {
            var bcpgOut = BcpgOutputStream.Wrap(outStream);

            bcpgOut.WritePacket(_sigPck);
            if (_trustPck != null)
            {
                bcpgOut.WritePacket(_trustPck);
            }
        }
Пример #3
0
    public void Encode(Stream outStream)
    {
        BcpgOutputStream bcpgOutputStream = BcpgOutputStream.Wrap(outStream);

        bcpgOutputStream.WritePacket(sigPck);
        if (trustPck != null)
        {
            bcpgOutputStream.WritePacket(trustPck);
        }
    }
Пример #4
0
        public void Encode(
            Stream outStr)
        {
            BcpgOutputStream bcpgOut = BcpgOutputStream.Wrap(outStr);

            bcpgOut.WritePacket(secret);
            if (pub.trustPk != null)
            {
                bcpgOut.WritePacket(pub.trustPk);
            }

            if (pub.subSigs == null) // is not a sub key
            {
                foreach (PgpSignature keySig in pub.keySigs)
                {
                    keySig.Encode(bcpgOut);
                }

                for (int i = 0; i != pub.ids.Count; i++)
                {
                    object pubID = pub.ids[i];
                    if (pubID is string)
                    {
                        string id = (string)pubID;
                        bcpgOut.WritePacket(new UserIdPacket(id));
                    }
                    else
                    {
                        PgpUserAttributeSubpacketVector v = (PgpUserAttributeSubpacketVector)pubID;
                        bcpgOut.WritePacket(new UserAttributePacket(v.ToSubpacketArray()));
                    }

                    if (pub.idTrusts[i] != null)
                    {
                        bcpgOut.WritePacket((ContainedPacket)pub.idTrusts[i]);
                    }

                    foreach (PgpSignature sig in (IList)pub.idSigs[i])
                    {
                        sig.Encode(bcpgOut);
                    }
                }
            }
            else
            {
                foreach (PgpSignature subSig in pub.subSigs)
                {
                    subSig.Encode(bcpgOut);
                }
            }

            // TODO Check that this is right/necessary
            //bcpgOut.Finish();
        }
        public void Encode(Stream outStr)
        {
            var bcpgOut = BcpgOutputStream.Wrap(outStr);

            foreach (long key in _order)
            {
                var pub = (PgpSecretKeyRing)_secretRings[key];

                pub.Encode(bcpgOut);
            }
        }
Пример #6
0
        public void Encode(
            Stream outStream)
        {
            BcpgOutputStream output = BcpgOutputStream.Wrap(outStream);

            output.WritePacket(secret);
            if (pub.trustPk != null)
            {
                output.WritePacket(pub.trustPk);
            }

            if (pub.subSigs == null)        // is not a sub key
            {
                for (int i = 0; i != pub.keySigs.Count; i++)
                {
                    ((PgpSignature)pub.keySigs[i]).Encode(output);
                }

                for (int i = 0; i != pub.ids.Count; i++)
                {
                    if (pub.ids[i] is UserIdPacket)
                    {
                        UserIdPacket id = (UserIdPacket)pub.ids[i];

                        output.WritePacket(id);
                    }
                    else
                    {
                        PgpUserAttributeSubpacketVector v = (PgpUserAttributeSubpacketVector)pub.ids[i];

                        output.WritePacket(new UserAttributePacket(v.ToSubpacketArray()));
                    }

                    if (pub.idTrusts[i] != null)
                    {
                        output.WritePacket((ContainedPacket)pub.idTrusts[i]);
                    }

                    List <PgpSignature> sigs = pub.idSigs[i];

                    for (int j = 0; j != sigs.Count; j++)
                    {
                        sigs[j].Encode(output);
                    }
                }
            }
            else
            {
                for (int j = 0; j != pub.subSigs.Count; j++)
                {
                    ((PgpSignature)pub.subSigs[j]).Encode(output);
                }
            }
        }
    public void Encode(Stream outStr)
    {
        BcpgOutputStream outStr2 = BcpgOutputStream.Wrap(outStr);

        foreach (object item in order)
        {
            long             num = (long)item;
            PgpPublicKeyRing pgpPublicKeyRing = (PgpPublicKeyRing)pubRings[num];
            pgpPublicKeyRing.Encode(outStr2);
        }
    }
        public void Encode(
            Stream outStr)
        {
            BcpgOutputStream bcpgOut = BcpgOutputStream.Wrap(outStr);

            foreach (long key in order)
            {
                PgpPublicKeyRing sec = (PgpPublicKeyRing)pubRings[key];

                sec.Encode(bcpgOut);
            }
        }
Пример #9
0
        public void Encode(Stream outStr)
        {
            var bcpgOut = BcpgOutputStream.Wrap(outStr);


            bcpgOut.WritePacket(_secret);
            if (_pub.TrustPaket != null)
            {
                bcpgOut.WritePacket(_pub.TrustPaket);
            }

            if (_pub.SubSigs == null) // is not a sub key
            {
                foreach (PgpSignature keySig in _pub.KeySigs)
                {
                    keySig.Encode(bcpgOut);
                }

                for (var i = 0; i != _pub.Ids.Count; i++)
                {
                    var pubId = _pub.Ids[i];

                    if (pubId is string)
                    {
                        var id = (string)pubId;
                        bcpgOut.WritePacket(new UserIdPacket(id));
                    }
                    else
                    {
                        var v = (PgpUserAttributeSubpacketVector)pubId;
                        bcpgOut.WritePacket(new UserAttributePacket(v.ToSubpacketArray()));
                    }

                    if (_pub.IdTrusts[i] != null)
                    {
                        bcpgOut.WritePacket((ContainedPacket)_pub.IdTrusts[i]);
                    }

                    foreach (PgpSignature sig in (IList)_pub.IdSigs[i])
                    {
                        sig.Encode(bcpgOut);
                    }
                }
            }
            else
            {
                foreach (PgpSignature subSig in _pub.SubSigs)
                {
                    subSig.Encode(bcpgOut);
                }
            }
        }
Пример #10
0
        public void Encode(
            Stream outStr)
        {
            BcpgOutputStream bcpgOut = BcpgOutputStream.Wrap(outStr);

            bcpgOut.WritePacket(publicPk);
            if (trustPk != null)
            {
                bcpgOut.WritePacket(trustPk);
            }

            if (subSigs == null)                // not a sub-key
            {
                foreach (PgpSignature keySig in keySigs)
                {
                    keySig.Encode(bcpgOut);
                }

                for (int i = 0; i != ids.Count; i++)
                {
                    if (ids[i] is string)
                    {
                        string id = (string)ids[i];

                        bcpgOut.WritePacket(new UserIdPacket(id));
                    }
                    else
                    {
                        PgpUserAttributeSubpacketVector v = (PgpUserAttributeSubpacketVector)ids[i];
                        bcpgOut.WritePacket(new UserAttributePacket(v.ToSubpacketArray()));
                    }

                    if (idTrusts[i] != null)
                    {
                        bcpgOut.WritePacket((ContainedPacket)idTrusts[i]);
                    }

                    foreach (PgpSignature sig in (IList)idSigs[i])
                    {
                        sig.Encode(bcpgOut);
                    }
                }
            }
            else
            {
                foreach (PgpSignature subSig in subSigs)
                {
                    subSig.Encode(bcpgOut);
                }
            }
        }
Пример #11
0
        public void Encode(Stream outStr)
        {
            var bcpgOut = BcpgOutputStream.Wrap(outStr);

            bcpgOut.WritePacket(_publicPk);
            if (_trustPk != null)
            {
                bcpgOut.WritePacket(_trustPk);
            }

            if (_subSigs == null) // not a sub-key
            {
                foreach (PgpSignature keySig in _keySigs)
                {
                    keySig.Encode(bcpgOut);
                }

                for (var i = 0; i != _ids.Count; i++)
                {
                    var id = _ids[i] as string;
                    if (id != null)
                    {
                        bcpgOut.WritePacket(new UserIdPacket(id));
                    }
                    else
                    {
                        var v = (IPgpUserAttributeSubpacketVector)_ids[i];
                        bcpgOut.WritePacket(new UserAttributePacket(v.ToSubpacketArray()));
                    }

                    if (_idTrusts[i] != null)
                    {
                        bcpgOut.WritePacket((ContainedPacket)_idTrusts[i]);
                    }

                    foreach (var sig in _idSigs[i])
                    {
                        sig.Encode(bcpgOut);
                    }
                }
            }
            else
            {
                foreach (PgpSignature subSig in _subSigs)
                {
                    subSig.Encode(bcpgOut);
                }
            }
        }
        public void Encode(Stream outStr)
        {
            BcpgOutputStream outStr2 = BcpgOutputStream.Wrap(outStr);

            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)order).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    long             num = (long)enumerator.get_Current();
                    PgpSecretKeyRing pgpSecretKeyRing = (PgpSecretKeyRing)secretRings.get_Item((object)num);
                    pgpSecretKeyRing.Encode((Stream)(object)outStr2);
                }
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
Пример #13
0
        public void Encode(Stream outStr)
        {
            BcpgOutputStream bcpgOutputStream = BcpgOutputStream.Wrap(outStr);

            bcpgOutputStream.WritePacket(publicPk);
            if (trustPk != null)
            {
                bcpgOutputStream.WritePacket(trustPk);
            }
            global::System.Collections.IEnumerator enumerator;
            if (subSigs == null)
            {
                {
                    enumerator = ((global::System.Collections.IEnumerable)keySigs).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            PgpSignature pgpSignature = (PgpSignature)enumerator.get_Current();
                            pgpSignature.Encode((Stream)(object)bcpgOutputStream);
                        }
                    }
                    finally
                    {
                        global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                for (int i = 0; i != ((global::System.Collections.ICollection)ids).get_Count(); i++)
                {
                    if (ids.get_Item(i) is string)
                    {
                        string id = (string)ids.get_Item(i);
                        bcpgOutputStream.WritePacket(new UserIdPacket(id));
                    }
                    else
                    {
                        PgpUserAttributeSubpacketVector pgpUserAttributeSubpacketVector = (PgpUserAttributeSubpacketVector)ids.get_Item(i);
                        bcpgOutputStream.WritePacket(new UserAttributePacket(pgpUserAttributeSubpacketVector.ToSubpacketArray()));
                    }
                    if (idTrusts.get_Item(i) != null)
                    {
                        bcpgOutputStream.WritePacket((ContainedPacket)idTrusts.get_Item(i));
                    }
                    {
                        enumerator = ((global::System.Collections.IEnumerable)(global::System.Collections.IList) idSigs.get_Item(i)).GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                PgpSignature pgpSignature2 = (PgpSignature)enumerator.get_Current();
                                pgpSignature2.Encode((Stream)(object)bcpgOutputStream);
                            }
                        }
                        finally
                        {
                            global::System.IDisposable disposable2 = enumerator as global::System.IDisposable;
                            if (disposable2 != null)
                            {
                                disposable2.Dispose();
                            }
                        }
                    }
                }
                return;
            }
            enumerator = ((global::System.Collections.IEnumerable)subSigs).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    PgpSignature pgpSignature3 = (PgpSignature)enumerator.get_Current();
                    pgpSignature3.Encode((Stream)(object)bcpgOutputStream);
                }
            }
            finally
            {
                global::System.IDisposable disposable3 = enumerator as global::System.IDisposable;
                if (disposable3 != null)
                {
                    disposable3.Dispose();
                }
            }
        }
        public void Encode(Stream outStr)
        {
            var wrap = BcpgOutputStream.Wrap(outStr);

            wrap.WritePacket(_sigPack);
        }