@@ -46,37 +46,22 @@ func VerifyRelayBinary(path string) {
46
46
// Download and copy the file
47
47
files .DownloadAndCopyFile (relaysManifestFilePath , RelaysManifestFileURL )
48
48
49
- // Use GPG to verify the manifest signature file and output the primary key and signature subkey fingerprints
50
- cmd := exec .Command ("gpg" , "--verify " , "--with-fingerprint " , "--with-subkey-fingerprints " , relaysManifestSigFilePath )
49
+ // Use GPG to verify the manifest signature file
50
+ out , err := exec .Command ("gpg" , "--status-fd " , "1 " , "--verify " , relaysManifestSigFilePath ). Output ( )
51
51
52
- out , err := cmd .CombinedOutput ()
53
52
if err != nil {
54
53
pterm .Println ()
55
54
pterm .Error .Println (fmt .Sprintf ("Failed to run the gpg verify command on the %s file: %v" , relaysManifestSigFilePath , err ))
56
55
os .Exit (1 )
57
56
}
58
57
59
- gpgVerifyOutput := string (out )
58
+ validSig := strings . Contains ( string (out ), fmt . Sprintf ( "[GNUPG:] VALIDSIG %s" , NodeTecSigningSubkeyFingerprint ) )
60
59
61
- goodSig := strings .Contains (gpgVerifyOutput , NodeTecGoodSigMsg )
62
-
63
- // Extract the formatted primary key and formatted signature subkey fingerprints from the output
64
- _ , formattedPrimaryAndSubKeyFingerprints , _ := strings .Cut (gpgVerifyOutput , "Primary key fingerprint: " )
65
-
66
- formattedPrimaryKeyFingerprint , formattedSubkeyFingerprint , _ := strings .Cut (formattedPrimaryAndSubKeyFingerprints , "Subkey fingerprint: " )
67
-
68
- // Remove the spaces and new line characters from the formatted primary key and formatted signature subkey fingerprints
69
- formattedPrimaryKeyFingerprint = strings .ReplaceAll (formattedPrimaryKeyFingerprint , " " , "" )
70
- formattedSubkeyFingerprint = strings .ReplaceAll (formattedSubkeyFingerprint , " " , "" )
71
-
72
- primaryKeyFingerprint := strings .ReplaceAll (formattedPrimaryKeyFingerprint , "\n " , "" )
73
- subkeyFingerprint := strings .ReplaceAll (formattedSubkeyFingerprint , "\n " , "" )
74
-
75
- if goodSig && primaryKeyFingerprint == NodeTecPrimaryKeyFingerprint && subkeyFingerprint == NodeTecSigningSubkeyFingerprint {
76
- spinner .UpdateText (fmt .Sprintf ("Verified the signature of the %s file and the fingerprints" , relaysManifestFilePath ))
60
+ if validSig {
61
+ spinner .UpdateText (fmt .Sprintf ("Verified the signature of the %s file" , relaysManifestFilePath ))
77
62
} else {
78
63
pterm .Println ()
79
- pterm .Error .Println (fmt .Sprintf ("Failed to verify the signature of the %s file and/or the fingerprints " , relaysManifestFilePath ))
64
+ pterm .Error .Println (fmt .Sprintf ("Failed to verify the signature of the %s file" , relaysManifestFilePath ))
80
65
os .Exit (1 )
81
66
}
82
67
0 commit comments