Beispiel #1
0
        internal void UpdateFromMem(IntPtr keyPtr)
        {
            var key = (_gpgme_key)Marshal.PtrToStructure(keyPtr, typeof(_gpgme_key));

            _key_ptr = keyPtr;

            Revoked         = key.revoked;
            Expired         = key.expired;
            Disabled        = key.disabled;
            Invalid         = key.invalid;
            CanEncrypt      = key.can_encrypt;
            CanSign         = key.can_sign;
            CanCertify      = key.can_certify;
            CanAuthenticate = key.can_authenticate;
            IsQualified     = key.is_qualified;
            Secret          = key.secret;

            Protocol    = (Protocol)key.protocol;
            OwnerTrust  = (Validity)key.owner_trust;
            KeylistMode = (KeylistMode)key.keylist_mode;

            IssuerName   = Gpgme.PtrToStringUTF8(key.issuer_name);
            IssuerSerial = Gpgme.PtrToStringAnsi(key.issuer_serial);
            ChainId      = Gpgme.PtrToStringAnsi(key.chain_id);

            if (key.subkeys != IntPtr.Zero)
            {
                Subkeys = new Subkey(key.subkeys);
            }

            if (key.uids != IntPtr.Zero)
            {
                Uids = new UserId(key.uids);
            }
        }
Beispiel #2
0
        private void UpdateFromMem(IntPtr subkeyPtr)
        {
            var subkey = (_gpgme_subkey)
                         Marshal.PtrToStructure(subkeyPtr,
                                                typeof(_gpgme_subkey));

            Revoked         = subkey.revoked;
            Expired         = subkey.expired;
            Disabled        = subkey.disabled;
            Invalid         = subkey.invalid;
            CanEncrypt      = subkey.can_encrypt;
            CanSign         = subkey.can_sign;
            CanCertify      = subkey.can_certify;
            CanAuthenticate = subkey.can_authenticate;
            IsQualified     = subkey.is_qualified;
            Secret          = subkey.secret;

            PubkeyAlgorithm = (KeyAlgorithm)subkey.pubkey_algo;
            Length          = subkey.length;

            KeyId       = Gpgme.PtrToStringAnsi(subkey.keyid);
            Fingerprint = Gpgme.PtrToStringAnsi(subkey.fpr);
            _timestamp  = (long)subkey.timestamp;
            _expires    = (long)subkey.expires;

            if (subkey.next != IntPtr.Zero)
            {
                Next = new Subkey(subkey.next);
            }
        }
        private void UpdateFromMem(IntPtr subkeyPtr)
        {
            _gpgme_subkey subkey = (_gpgme_subkey)
                                   Marshal.PtrToStructure(subkeyPtr,
                                                          typeof(_gpgme_subkey));

            revoked          = subkey.revoked;
            expired          = subkey.expired;
            disabled         = subkey.disabled;
            invalid          = subkey.invalid;
            can_encrypt      = subkey.can_encrypt;
            can_sign         = subkey.can_sign;
            can_certify      = subkey.can_certify;
            can_authenticate = subkey.can_authenticate;
            is_qualified     = subkey.is_qualified;
            secret           = subkey.secret;

            pubkey_algo = (KeyAlgorithm)subkey.pubkey_algo;
            length      = (long)subkey.length;

            keyid     = Gpgme.PtrToStringAnsi(subkey.keyid);
            fpr       = Gpgme.PtrToStringAnsi(subkey.fpr);
            timestamp = (long)subkey.timestamp;
            expires   = (long)subkey.expires;

            if (subkey.next != (IntPtr)0)
            {
                next = new Subkey(subkey.next);
            }
        }
Beispiel #4
0
        private void UpdateFromMem(IntPtr keysigPtr)
        {
            var keysig = (_gpgme_key_sig)Marshal.PtrToStructure(keysigPtr,
                                                                typeof(_gpgme_key_sig));

            Revoked    = keysig.revoked;
            Expired    = keysig.expired;
            Invalid    = keysig.invalid;
            Exportable = keysig.exportable;

            PubkeyAlgorithm = (KeyAlgorithm)keysig.pubkey_algo;

            KeyId   = Gpgme.PtrToStringAnsi(keysig.keyid);
            Uid     = Gpgme.PtrToStringAnsi(keysig.uid);
            Name    = Gpgme.PtrToStringAnsi(keysig.name);
            Comment = Gpgme.PtrToStringAnsi(keysig.comment);
            Email   = Gpgme.PtrToStringAnsi(keysig.email);

            _timestamp = (long)keysig.timestamp;
            _expires   = (long)keysig.expires;

            Status   = keysig.status;
            SigClass = keysig.sig_class;

            if (keysig.notations != IntPtr.Zero)
            {
                Notations = new SignatureNotation(keysig.notations);
            }

            if (keysig.next != IntPtr.Zero)
            {
                Next = new KeySignature(keysig.next);
            }
        }
Beispiel #5
0
        private void UpdateFromMem(IntPtr itemPtr)
        {
            var titem = new _gpgme_trust_item();

            Marshal.PtrToStructure(itemPtr, titem);

            KeyId = Gpgme.PtrToStringAnsi(titem.keyid);
            switch (titem.type)
            {
            case 1:
                Type = TrustItemType.Key;
                break;

            case 2:
                Type = TrustItemType.UserId;
                break;

            default:
                throw new GeneralErrorException("Unknown trust item type value of " + titem.type);
            }
            Level      = titem.level;
            OwnerTrust = Gpgme.PtrToStringUTF8(titem.owner_trust);
            Validity   = Gpgme.PtrToStringAnsi(titem.validity);
            Name       = Gpgme.PtrToStringUTF8(titem.name);
        }
Beispiel #6
0
        private void UpdateFromMem(IntPtr keysigPtr)
        {
            _gpgme_key_sig keysig = (_gpgme_key_sig)Marshal.PtrToStructure(keysigPtr,
                                                                           typeof(_gpgme_key_sig));

            revoked    = keysig.revoked;
            expired    = keysig.expired;
            invalid    = keysig.invalid;
            exportable = keysig.exportable;

            pubkey_algo = (KeyAlgorithm)keysig.pubkey_algo;

            keyid   = Gpgme.PtrToStringAnsi(keysig.keyid);
            uid     = Gpgme.PtrToStringAnsi(keysig.uid);
            name    = Gpgme.PtrToStringAnsi(keysig.name);
            comment = Gpgme.PtrToStringAnsi(keysig.comment);
            email   = Gpgme.PtrToStringAnsi(keysig.email);

            timestamp = (long)keysig.timestamp;
            expires   = (long)keysig.expires;

            status    = keysig.status;
            sig_class = (long)keysig.sig_class;

            if (keysig.notations != (IntPtr)0)
            {
                notations = new SignatureNotation(keysig.notations);
            }

            if (keysig.next != (IntPtr)0)
            {
                next = new KeySignature(keysig.next);
            }
        }
        private void UpdateFromMem(IntPtr keyresultPtr)
        {
            _gpgme_op_genkey_result result = new _gpgme_op_genkey_result();

            Marshal.PtrToStructure(keyresultPtr, result);
            fingerprint = Gpgme.PtrToStringAnsi(result.fpr);
            hasPrimary  = result.primary;
            hasSub      = result.sub;
        }
Beispiel #8
0
        private void UpdateFromMem(IntPtr sPtr)
        {
            var ikey = new _gpgme_invalid_key();

            Marshal.PtrToStructure(sPtr, ikey);

            Fingerprint = Gpgme.PtrToStringAnsi(ikey.fpr);
            _reason     = ikey.reason;

            if (ikey.next != IntPtr.Zero)
            {
                Next = new InvalidKey(ikey.next);
            }
        }
        private void UpdateFromMem(IntPtr statusPtr)
        {
            var result = new _gpgme_import_status();

            Marshal.PtrToStructure(statusPtr, result);

            if (result.fpr != IntPtr.Zero)
            {
                _fpr = Gpgme.PtrToStringAnsi(result.fpr);
            }
            _status = result.status;
            _result = result.result;
            if (result.next != IntPtr.Zero)
            {
                _next = new ImportStatus(result.next);
            }
        }
        internal void UpdateFromMem(IntPtr keyPtr)
        {
            _gpgme_key key = (_gpgme_key)
                             Marshal.PtrToStructure(keyPtr,
                                                    typeof(_gpgme_key));

            this.keyPtr = keyPtr;

            revoked          = key.revoked;
            expired          = key.expired;
            disabled         = key.disabled;
            invalid          = key.invalid;
            can_encrypt      = key.can_encrypt;
            can_sign         = key.can_sign;
            can_certify      = key.can_certify;
            can_authenticate = key.can_authenticate;
            is_qualified     = key.is_qualified;
            secret           = key.secret;

            protocol    = (Protocol)key.protocol;
            owner_trust = (Validity)key.owner_trust;
            keylistmode = (KeylistMode)key.keylist_mode;

            issuer_name   = Gpgme.PtrToStringUTF8(key.issuer_name);
            issuer_serial = Gpgme.PtrToStringAnsi(key.issuer_serial);
            chain_id      = Gpgme.PtrToStringAnsi(key.chain_id);

            if (key.subkeys != (IntPtr)0)
            {
                subkeys = new Subkey(key.subkeys);
            }

            if (key.uids != (IntPtr)0)
            {
                uids = new UserId(key.uids);
            }
        }