File tree 2 files changed +24
-6
lines changed 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ Below is a rough list of things to be resolved
6
6
* Improve in memory handling
7
7
* Improve filename handling
8
8
* Support Trust levels
9
- * Add full public key id handling (the short id is only 8 chars long, even better to utilize the full id)
10
9
* Document exit codes and make them more explicit
11
10
12
11
### Bugs
Original file line number Diff line number Diff line change @@ -210,12 +210,31 @@ func checkGPG(file File) (state SigState, err error) {
210
210
fmt .Printf ("Invalid signature or public key not present: %s\n " , err )
211
211
os .Exit (2 )
212
212
}
213
- state .sig = signer .PrimaryKey .KeyIdShortString ()
214
213
215
- if len (* flagKeyid ) > 0 {
216
- keyid := strings .ToUpper (* flagKeyid )
217
- if keyid != state .sig {
218
- fmt .Printf ("The remote file was not signed by the expected GPG Public key. Expected %s and got %s\n " , keyid , state .sig )
214
+ state .sig = signer .PrimaryKey .KeyIdString ()
215
+
216
+ l := len (* flagKeyid )
217
+ if l > 0 {
218
+ var rid string
219
+
220
+ // Force the local id to be all uppercase
221
+ lid := strings .ToUpper (* flagKeyid )
222
+
223
+ // check the number of chars on the remote id to see if it's a
224
+ // short or long id. If it's not 8 or 16, it's not valid.
225
+ switch l {
226
+ case 8 :
227
+ rid = signer .PrimaryKey .KeyIdShortString ()
228
+ case 16 :
229
+ rid = signer .PrimaryKey .KeyIdString ()
230
+ }
231
+ if len (rid ) == 0 {
232
+ fmt .Printf ("You did not specify a valid GPG keyid length. Must be 8 or 16 characters." )
233
+ os .Exit (2 )
234
+ }
235
+
236
+ if lid != rid {
237
+ fmt .Printf ("The remote file was not signed by the expected GPG Public key. Expected %s and got %s\n " , lid , rid )
219
238
os .Exit (2 )
220
239
}
221
240
}
You can’t perform that action at this time.
0 commit comments