Check GPG key on startup

This commit is contained in:
clerie 2024-11-24 17:42:39 +01:00
parent cd6b508436
commit 9f39a49c4c

View File

@ -5,6 +5,7 @@ import (
"io"
"io/ioutil"
"os"
"strings"
"time"
"flag"
"log"
@ -169,8 +170,11 @@ func main() {
log.Fatalf("Error: %v", err)
}
log.Printf("Encrypting files to %v", strings.ToUpper(gpgkey.GetFingerprint()))
if !gpgkey.CanEncrypt(time.Now().Unix()) {
log.Fatalf("Error: Provided GPG key does not support encryption")
}
factory := &ForwarderDriverFactory{
RecipientKey: gpgkey,