LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-29-2017, 12:54 PM   #1
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Ensuring data integrity with subkeys - obtaining main key id from signature


This may have a XY problem component to it so I'll explain my goal:
I want to be able to give a person a file to keep as a "backup", let them hold onto it, use it for their own purposes if desired and at their whim return this file to me to restore with. However, I should be able to verify automatically that
  • The file is unchanged
  • The file was from me

My solution is to use gpg and sign the file using a detached signature with subkeys

When I verify using a subkey, I get this result
Code:
gpg --verify file file.sig
gpg: Signature made Wed 29 Mar 2017 10:50:14 AM PDT using RSA key ID 7B1F325C
gpg: Good signature from "Sefyir"
The problem is 7B1F325C is the subkey id, not the main key id.
Is it possible to extract this from a detached signature without requiring interactivity?
 
Old 03-29-2017, 01:45 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by Sefyir View Post
However, I should be able to verify automatically that

The file is unchanged
The file was from me
You could use gpgv, with the --keyring option pointing to a keyring file containing only your own key.

Quote:
Originally Posted by Sefyir View Post
The problem is 7B1F325C is the subkey id, not the main key id.
Why is that a problem?
 
Old 03-29-2017, 07:06 PM   #3
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Original Poster
Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Quote:
Why is that a problem?
It's not, but I need to identify if it's valid automatically. I needed to be able to reference what the main key id was so that multiple subkeys could be verified (expired + active)
However, soon after posting this a simple answer came to me (as always)

This should be true if 7B1F325C keyid is relevant to primarykeyid
Code:
$ gpg --list-keys 7B1F325C | grep -q primarykeyid
Quote:
You could use gpgv, with the --keyring option pointing to a keyring file containing only your own key.
I didn't know about this tool, I will have to keep it in mind, thank you! The problem is the same service checking the key will also issue signatures.
But this could be used in a more secure method of it..

Last edited by Sefyir; 03-29-2017 at 07:11 PM.
 
Old 03-30-2017, 10:24 AM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by Sefyir View Post
Quote:
You could use gpgv, with the --keyring option pointing to a keyring file containing only your own key.
I didn't know about this tool, I will have to keep it in mind, thank you! The problem is the same service checking the key will also issue signatures.
But this could be used in a more secure method of it..
Actually, the full gpg command has a --keyring option, so I guess the same trick should work with that one too.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ensuring integrity of SFTP file transfers? penyuan Linux - Software 2 01-28-2016 09:13 PM
Ensuring GRUB2 / Linux / dmcrypt integrity salantrax Linux - Security 2 05-18-2014 11:29 AM
Program/Manager for ensuring ISO integrity loadedmind Linux - Newbie 4 10-26-2011 09:55 AM
C++: obtaining and printing a function signature R00ts Programming 4 01-07-2008 11:54 AM
Smart Key Signature ERRORS! How do I delete this bad key from my computer? Balarabay1 Linux - Software 4 09-27-2006 11:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration