Update to gopengpg v2.0.0
This commit is contained in:
parent
9a688b518f
commit
84b1c07f64
13 changed files with 314 additions and 56 deletions
|
|
@ -30,11 +30,11 @@ struct ObjectivePgp: PgpInterface {
|
|||
self.privateKey = privateKey
|
||||
}
|
||||
|
||||
func decrypt(encryptedData: Data, passphrase: String) throws -> Data? {
|
||||
func decrypt(encryptedData: Data, keyID: String, passphrase: String) throws -> Data? {
|
||||
return try ObjectivePGP.decrypt(encryptedData, andVerifySignature: false, using: keyring.keys) { _ in passphrase }
|
||||
}
|
||||
|
||||
func encrypt(plainData: Data) throws -> Data {
|
||||
func encrypt(plainData: Data, keyID: String) throws -> Data {
|
||||
let encryptedData = try ObjectivePGP.encrypt(plainData, addSignature: false, using: keyring.keys, passphraseForKey: nil)
|
||||
if Defaults.encryptInArmored {
|
||||
return Armor.armored(encryptedData, as: .message).data(using: .ascii)!
|
||||
|
|
@ -43,6 +43,10 @@ struct ObjectivePgp: PgpInterface {
|
|||
}
|
||||
|
||||
var keyId: String {
|
||||
return publicKey.keyID.longIdentifier
|
||||
}
|
||||
|
||||
var shortKeyId: String {
|
||||
return publicKey.keyID.shortIdentifier
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue