├── .gitignore ├── .gitmodules ├── .tx └── config ├── Dependencies └── .gitignore ├── LeakFinder ├── AppDelegate.h ├── AppDelegate.m ├── LeakFinder-Info.plist ├── LeakFinder-Prefix.pch ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib └── main.m ├── Libmacgpg.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── Libmacgpg + XPC.xcscheme ├── Makefile ├── NewUnitTests └── GPGSocketCloseTest.m ├── Readme.md ├── Release Notes ├── 0.6.md └── 0.7.md ├── Resources ├── Info.plist ├── Keyservers.plist ├── ca.lproj │ └── Localizable.strings ├── cs.lproj │ └── Localizable.strings ├── da.lproj │ └── Localizable.strings ├── de.lproj │ └── Localizable.strings ├── el.lproj │ └── Localizable.strings ├── en.lproj │ └── Localizable.strings ├── es.lproj │ └── Localizable.strings ├── fa_IR.lproj │ └── Localizable.strings ├── fr.lproj │ └── Localizable.strings ├── id.lproj │ └── Localizable.strings ├── it.lproj │ └── Localizable.strings ├── ja.lproj │ └── Localizable.strings ├── nb.lproj │ └── Localizable.strings ├── nl.lproj │ └── Localizable.strings ├── pt.lproj │ └── Localizable.strings ├── ru.lproj │ └── Localizable.strings ├── sks-keyservers.netCA.der ├── sks-keyservers.plist ├── sv.lproj │ └── Localizable.strings └── th.lproj │ └── Localizable.strings ├── SignatureViewApp ├── SignatureViewApp-Info.plist ├── SignatureViewApp-Prefix.pch ├── SignatureViewAppAppDelegate.h ├── SignatureViewAppAppDelegate.m ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib └── main.m ├── Source ├── DirectoryWatcher.h ├── DirectoryWatcher.m ├── GPGArraySetting.h ├── GPGArraySetting.m ├── GPGConf.h ├── GPGConf.m ├── GPGConfReader.h ├── GPGConfReader.m ├── GPGController.h ├── GPGController.m ├── GPGDictSetting.h ├── GPGDictSetting.m ├── GPGException.h ├── GPGException.m ├── GPGFileStream.h ├── GPGFileStream.m ├── GPGGlobals.h ├── GPGGlobals.m ├── GPGKey.h ├── GPGKey.m ├── GPGKeyFetcher.h ├── GPGKeyFetcher.m ├── GPGKeyManager.h ├── GPGKeyManager.m ├── GPGKeyMonitoring.h ├── GPGKeyMonitoring.m ├── GPGKeyserver.h ├── GPGKeyserver.m ├── GPGLinesSetting.h ├── GPGLinesSetting.m ├── GPGMemoryStream.h ├── GPGMemoryStream.m ├── GPGOptions.h ├── GPGOptions.m ├── GPGPacket │ ├── COPYING.pgpdump │ ├── GPGCompressedDataPacket.h │ ├── GPGCompressedDataPacket.m │ ├── GPGCompressedDataPacket_Private.h │ ├── GPGIgnoredPackets.h │ ├── GPGIgnoredPackets.m │ ├── GPGKeyMaterialPacket.h │ ├── GPGKeyMaterialPacket.m │ ├── GPGLiteralDataPacket.h │ ├── GPGLiteralDataPacket.m │ ├── GPGOnePassSignaturePacket.h │ ├── GPGOnePassSignaturePacket.m │ ├── GPGPacket.h │ ├── GPGPacket.m │ ├── GPGPacketParser.h │ ├── GPGPacketParser.m │ ├── GPGPacketParser_Private.h │ ├── GPGPacket_Private.h │ ├── GPGPublicKeyEncryptedSessionKeyPacket.h │ ├── GPGPublicKeyEncryptedSessionKeyPacket.m │ ├── GPGSignaturePacket.h │ ├── GPGSignaturePacket.m │ ├── GPGSymmetricEncryptedSessionKeyPacket.h │ ├── GPGSymmetricEncryptedSessionKeyPacket.m │ ├── GPGUserAttributePacket.h │ ├── GPGUserAttributePacket.m │ ├── GPGUserIDPacket.h │ └── GPGUserIDPacket.m ├── GPGRemoteKey.h ├── GPGRemoteKey.m ├── GPGRemoteUserID.h ├── GPGRemoteUserID.m ├── GPGSignature.h ├── GPGSignature.m ├── GPGStatusLine.h ├── GPGStatusLine.m ├── GPGStdSetting.h ├── GPGStdSetting.m ├── GPGStream.h ├── GPGStream.m ├── GPGTask.h ├── GPGTask.m ├── GPGTaskHelper.h ├── GPGTaskHelper.m ├── GPGTaskHelperXPC.h ├── GPGTaskHelperXPC.m ├── GPGTaskOrder.h ├── GPGTaskOrder.m ├── GPGTask_Private.h ├── GPGTransformer.h ├── GPGTransformer.m ├── GPGTypesRW.h ├── GPGUTF8Argument.h ├── GPGUTF8Argument.m ├── GPGUnArmor.h ├── GPGUnArmor.m ├── GPGUpdateController.h ├── GPGUpdateController.m ├── GPGUserDefaults.h ├── GPGUserDefaults.m ├── GPGUserID.h ├── GPGUserID.m ├── GPGUserIDSignature.h ├── GPGUserIDSignature.m ├── GPGVerifyingKeyserver.h ├── GPGVerifyingKeyserver.m ├── GPGWatcher.h ├── GPGWatcher.m ├── JailfreeProtocol.h ├── Libmacgpg.h ├── Libmacgpg_Prefix.pch ├── NSBundle+GPGLocalization.h ├── NSBundle+GPGLocalization.m ├── NSBundle+Sandbox.h ├── NSBundle+Sandbox.m ├── NSPipe+NoSigPipe.h ├── NSPipe+NoSigPipe.m ├── PLWeakCompatibilityStubs.h ├── PLWeakCompatibilityStubs.m └── org.gpgtools.Libmacgpg.xpc │ ├── GSPaddle.framework │ ├── GSPaddle │ ├── Headers │ ├── Modules │ ├── Resources │ └── Versions │ │ ├── A │ │ ├── GSPaddle │ │ ├── Headers │ │ │ ├── GSPaddle.h │ │ │ ├── GSPaddleErrorCodes.h │ │ │ ├── PADApi+GSPaddle.h │ │ │ └── Paddle+CustomBundleIdentifier.h │ │ ├── Modules │ │ │ └── module.modulemap │ │ ├── Resources │ │ │ └── Info.plist │ │ └── _CodeSignature │ │ │ └── CodeResources │ │ └── Current │ ├── Info.plist │ ├── JailfreeTask.h │ ├── JailfreeTask.m │ ├── Paddle.framework │ ├── Headers │ ├── Modules │ ├── Paddle │ ├── Resources │ └── Versions │ │ ├── A │ │ ├── Headers │ │ │ ├── PADAlert.h │ │ │ ├── PADCheckoutOptions.h │ │ │ ├── PADDisplayConfiguration.h │ │ │ ├── PADError.h │ │ │ ├── PADLicenseMigrate.h │ │ │ ├── PADPriceOverride.h │ │ │ ├── PADProduct.h │ │ │ ├── PADProductConfiguration.h │ │ │ └── Paddle.h │ │ ├── Modules │ │ │ └── module.modulemap │ │ ├── Paddle │ │ └── Resources │ │ │ ├── Info.plist │ │ │ ├── PADActivateWindow.nib │ │ │ ├── PADCheckoutWindow.nib │ │ │ ├── PADProductNoTrialWindow.nib │ │ │ ├── PADProductWindow.nib │ │ │ ├── PADWebPopWindowController.nib │ │ │ ├── de.lproj │ │ │ └── Localizable.strings │ │ │ ├── en.lproj │ │ │ └── Localizable.strings │ │ │ ├── error.html │ │ │ ├── es.lproj │ │ │ └── Localizable.strings │ │ │ ├── fr.lproj │ │ │ └── Localizable.strings │ │ │ ├── it.lproj │ │ │ └── Localizable.strings │ │ │ ├── ja.lproj │ │ │ └── Localizable.strings │ │ │ ├── pl.lproj │ │ │ └── Localizable.strings │ │ │ ├── pt.lproj │ │ │ └── Localizable.strings │ │ │ ├── ru.lproj │ │ │ └── Localizable.strings │ │ │ ├── zh-Hans.lproj │ │ │ └── Localizable.strings │ │ │ └── zh-TW.lproj │ │ │ └── Localizable.strings │ │ └── Current │ ├── main.m │ └── org.gpgtools.Libmacgpg.xpc.plist ├── UnitTests ├── GPGArraySettingTest.m ├── GPGConfReaderTest.m ├── GPGControllerTest.m ├── GPGDictSettingTest.m ├── GPGLinesSettingTest.m ├── GPGOptionsTest.m ├── GPGPacketTest.m ├── GPGStdSettingTest.m ├── GPGTestVerify.m ├── GPGUnarmorTest.m ├── GPGUnitTest.h ├── GPGUnitTest.m ├── Info.plist └── Resources │ ├── Decrypt │ ├── LiteralAfterCustomEncrypted.gpg │ ├── LiteralAfterCustomEncrypted.res │ ├── LiteralAfterEmptyEncrypted.gpg │ ├── LiteralAfterEmptyEncrypted.res │ ├── Normal.gpg │ └── Normal.res │ ├── Encrypted.gpg │ ├── GPGPacket │ ├── compressed1.gpg │ └── key1.gpg │ ├── NoMDC.gpg │ ├── NoSecKey.gpg │ ├── OpenPGP.asc │ ├── SignedInputStringCR.txt │ ├── SignedInputStringCRLF.txt │ ├── SignedInputStringLF.txt │ └── Unarmor │ ├── Unarmor_2Messages.res │ ├── Unarmor_2Messages.txt │ ├── Unarmor_ClearsignComplicated.clear │ ├── Unarmor_ClearsignComplicated.res │ ├── Unarmor_ClearsignComplicated.txt │ ├── Unarmor_ClearsignNoLF.clear │ ├── Unarmor_ClearsignNoLF.res │ ├── Unarmor_ClearsignNoLF.txt │ ├── Unarmor_ClearsignOneLF.clear │ ├── Unarmor_ClearsignOneLF.res │ ├── Unarmor_ClearsignOneLF.txt │ ├── Unarmor_ClearsignTwoLF.clear │ ├── Unarmor_ClearsignTwoLF.res │ ├── Unarmor_ClearsignTwoLF.txt │ ├── Unarmor_DoubleNewline.res │ ├── Unarmor_DoubleNewline.txt │ ├── Unarmor_InvalidComment.res │ ├── Unarmor_InvalidComment.txt │ ├── Unarmor_InvalidVersion.res │ ├── Unarmor_InvalidVersion.txt │ ├── Unarmor_MissingNewline.res │ ├── Unarmor_MissingNewline.txt │ ├── Unarmor_NoNewline.res │ ├── Unarmor_NoNewline.txt │ ├── Unarmor_Normal.res │ ├── Unarmor_Normal.txt │ ├── Unarmor_UnicodeDashes.res │ ├── Unarmor_UnicodeDashes.txt │ ├── Unarmor_Version.res │ ├── Unarmor_Version.txt │ ├── Unarmor_VersionOnline.res │ └── Unarmor_VersionOnline.txt └── Version.config /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pbxuser 3 | !default.pbxuser 4 | *.mode1v3 5 | !default.mode1v3 6 | *.mode2v3 7 | !default.mode2v3 8 | *.perspectivev3 9 | !default.perspectivev3 10 | *.xcworkspace 11 | !default.xcworkspace 12 | build/ 13 | xcuserdata 14 | *.moved-aside 15 | Dependencies/GPGTools_Core 16 | Dependencies/DeployResources 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/.gitmodules -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | lang_map = pt_BR:pt 4 | 5 | [libmacgpg.localizable] 6 | file_filter = Resources/.lproj/Localizable.strings 7 | source_lang = en 8 | source_file = Resources/en.lproj/Localizable.strings 9 | type = STRINGS 10 | -------------------------------------------------------------------------------- /Dependencies/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /LeakFinder/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LeakFinder 4 | // 5 | // Created by Lukas Pitschl on 23.04.13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | - (IBAction)doEncrypt:(id)sender; 14 | 15 | @property (nonatomic, assign) IBOutlet NSWindow *window; 16 | @property (nonatomic, assign) IBOutlet NSButton *encryptButton; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LeakFinder/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LeakFinder 4 | // 5 | // Created by Lukas Pitschl on 23.04.13. 6 | // 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 15 | { 16 | // Insert code here to initialize your application 17 | } 18 | 19 | - (IBAction)doEncrypt:(id)sender { 20 | NSLog(@"Start round."); 21 | @autoreleasepool { 22 | NSData *inputData = [[NSData alloc] initWithContentsOfFile:@"/Users/lukele/Downloads/GPGTools-20130330-2.dmg"]; 23 | GPGController *gc = [[GPGController alloc] init]; 24 | [gc addSignerKey:@"E58271326F9F4937"]; 25 | NSData *encryptedData = [gc processData:inputData withEncryptSignMode:GPGPublicKeyEncrypt recipients:@[@"E58271326F9F4937"] hiddenRecipients:nil]; 26 | NSLog(@"encrypted data: %ld", (unsigned long)[encryptedData length]); 27 | NSData *decryptedData = [gc decryptData:encryptedData]; 28 | NSLog(@"decrypted data: %ld", (unsigned long)[decryptedData length]); 29 | } 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /LeakFinder/LeakFinder-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.gpgtools.Libmacgpg.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /LeakFinder/LeakFinder-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'LeakFinder' target in the 'LeakFinder' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /LeakFinder/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /LeakFinder/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LeakFinder/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LeakFinder 4 | // 5 | // Created by Lukas Pitschl on 23.04.13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PROJECT = Libmacgpg 2 | TARGET = Libmacgpg 3 | PRODUCT = Libmacgpg 4 | PINENTRY_PATH = ./Dependencies/pinentry-mac 5 | XPC_INSTALLATION_DIR = $(HOME)/Library/Application Support/GPGTools 6 | VPATH = build/Release/Libmacgpg.framework/Versions/Current 7 | 8 | all: $(PRODUCT) 9 | 10 | update-pinentry: 11 | @echo "Updating pinentry..." 12 | @test -d "$(PINENTRY_PATH)/.git" || git submodule init 13 | git submodule update 14 | 15 | update: update-pinentry 16 | 17 | $(PRODUCT): Source/* Resources/* Resources/*/* Libmacgpg.xcodeproj 18 | @xcodebuild -project $(PROJECT).xcodeproj -target "$(PROJECT)" build $(XCCONFIG) 19 | @xcodebuild -project $(PROJECT).xcodeproj -target "org.gpgtools.Libmacgpg.xpc" build $(XCCONFIG) "XPC_INSTALLATION_DIR='$(XPC_INSTALLATION_DIR)'" 20 | 21 | clean: 22 | rm -rf build/ 23 | # Cleanup pinentry-mac if necessary. 24 | @test -d "$(PINENTRY_PATH)/build" && rm -rf "$(PINENTRY_PATH)/build" || exit 0 25 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Libmacgpg-free 2 | ========= 3 | 4 | Libmacgpg-free is a drop-in-replacement for [GPG Suite](https://gpgtools.org) Libmacgpg removing the paywall. 5 | 6 | Tested with GPG-Suite **2019.1**, 2018.5 and 2018.4 7 | 8 | Build 9 | ----- 10 | 11 | #### Clone the repository 12 | ```bash 13 | git clone --recursive https://github.com/macgpg/libmacgpg-free 14 | cd Libmacgpg-free 15 | ``` 16 | 17 | #### Build (newest version 2019.1) 18 | ```bash 19 | make 20 | ``` 21 | *Checkout an older tag if you wish to build for older versions* 22 | 23 | #### Install 24 | * Install the [GPG Suite](https://gpgtools.org). 25 | * Build this library or [download it](https://github.com/macgpg/libmacgpg-free/releases). 26 | * Make sure the version of your downloaded GPGTools match the version of this library (see [releases](https://github.com/macgpg/libmacgpg-free/releases)) 27 | * To replace the existing org.gpgtools.Libmacgpg: 28 | 29 | ```bash 30 | sudo cp ./build/Release/org.gpgtools.Libmacgpg.xpc/Contents/MacOS/org.gpgtools.Libmacgpg /Library/Application\ Support/GPGTools/org.gpgtools.Libmacgpg.xpc/Contents/MacOS 31 | sudo chmod 755 /Library/Application\ Support/GPGTools/org.gpgtools.Libmacgpg.xpc/Contents/MacOS/org.gpgtools.Libmacgpg 32 | ``` 33 | 34 | Restart your computer or at least restart the XPC `org.gpgtools.Libmacgpg.xpc`: 35 | ```bash 36 | sudo launchctl stop org.gpgtools.Libmacgpg.xpc 37 | sudo launchctl start org.gpgtools.Libmacgpg.xpc 38 | ``` 39 | 40 | ...or eventully kill the org.gpgtools.Libmacgpg.xpc process. 41 | -------------------------------------------------------------------------------- /Release Notes/0.6.md: -------------------------------------------------------------------------------- 1 | Libmacgpg 0.6 - Release Notes 2 | ============================== 3 | 4 | Features 5 | -------- 6 | ### Be more tolerant toward malformed messages 7 | 8 | * To many line breaks or other minor malformations so far resulted in a message that could not be decrypted. We are now much more tolerant and flexible. [#63, #145, #14, #38] 9 | 10 | 11 | Bugfixes 12 | -------- 13 | 14 | * One of the most annoying, infamous bugs has finally gone down meaning users will no longer see the "no pinentry" error. Socket connection to gpg-agent was not closed under some circumstances. [#147] 15 | * One of the most common crashes in the 2015.06 release has been fixed. GPGTaskHelperXPC no longer crashes. [#143] 16 | * Crash in Libmacgpg GPGPacket fixed. [#146] 17 | * Fix: Empty key list in GPG Keychain main window. [#149] 18 | * Fix: Use new pinentry with keychain support for new MacGPG. [#148] -------------------------------------------------------------------------------- /Release Notes/0.7.md: -------------------------------------------------------------------------------- 1 | Libmacgpg 0.7 2 | ============= 3 | 4 | Improvements 5 | ---- 6 | * Be more tolerant when importing keys with wrong new lines. [#64] -------------------------------------------------------------------------------- /Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleName 10 | ${PRODUCT_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | org.gpgtools.Libmacgpg 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleSignature 20 | ???? 21 | NSPrincipalClass 22 | 23 | BuildNumber 24 | AUTOFILL 25 | CommitHash 26 | AUTOFILL 27 | CFBundleShortVersionString 28 | AUTOFILL 29 | CFBundleVersion 30 | AUTOFILL 31 | 32 | 33 | -------------------------------------------------------------------------------- /Resources/Keyservers.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | hkps://keys.openpgp.org 6 | 7 | 8 | -------------------------------------------------------------------------------- /Resources/sks-keyservers.netCA.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Resources/sks-keyservers.netCA.der -------------------------------------------------------------------------------- /SignatureViewApp/SignatureViewApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.gpgmail.signatureview.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /SignatureViewApp/SignatureViewApp-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SignatureViewApp' target in the 'SignatureViewApp' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /SignatureViewApp/SignatureViewAppAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SignatureViewAppAppDelegate.h 3 | // SignatureViewApp 4 | // 5 | // Created by Lukas Pitschl on 26.07.11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SignatureViewAppAppDelegate : NSObject { 12 | NSWindow *_window; 13 | } 14 | 15 | @property (nonatomic, strong) IBOutlet NSWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SignatureViewApp/SignatureViewAppAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SignatureViewAppAppDelegate.m 3 | // SignatureViewApp 4 | // 5 | // Created by Lukas Pitschl on 26.07.11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "SignatureViewAppAppDelegate.h" 10 | #import 11 | #import "SignatureView.h" 12 | 13 | @implementation SignatureViewAppAppDelegate 14 | 15 | @synthesize window = _window; 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 18 | { 19 | GPGController *gpgc = [[[GPGController alloc] init] autorelease]; 20 | gpgc.verbose = YES; 21 | NSSet *keys = [gpgc allKeys]; 22 | 23 | NSData *d1 = [NSData dataWithContentsOfFile:@"/Users/lukele/Desktop/hello.txt.asc"]; 24 | NSData *d2 = [gpgc decryptData:d1]; 25 | NSLog(@"Signatures: %@", [gpgc signatures]); 26 | 27 | NSLog(@"SignatureView: %@", [SignatureView class]); 28 | SignatureView *s = [SignatureView signatureView]; 29 | NSLog(@"Signature view: %p", s); 30 | [s setKeyList:keys]; 31 | [s setSignatures:[gpgc signatures]]; 32 | [s run]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /SignatureViewApp/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /SignatureViewApp/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SignatureViewApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SignatureViewApp 4 | // 5 | // Created by Lukas Pitschl on 26.07.11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Source/DirectoryWatcher.h: -------------------------------------------------------------------------------- 1 | 2 | @protocol DirectoryWatcherDelegate 3 | - (void)pathsChanged:(NSArray *)paths flags:(const FSEventStreamEventFlags[])flags; 4 | @end 5 | 6 | 7 | @interface DirectoryWatcher : NSObject { 8 | NSObject *delegate; 9 | FSEventStreamRef eventStream; 10 | NSMutableSet *pathsToWatch; 11 | NSUInteger latency; 12 | } 13 | 14 | @property (nonatomic, assign) NSObject *delegate; 15 | @property (nonatomic) NSUInteger latency; 16 | 17 | 18 | + (id)directoryWatcherWithPath:(NSString *)path; 19 | + (id)directoryWatcherWithPaths:(NSArray *)paths; 20 | - (id)initWithPath:(NSString *)path; 21 | - (id)initWithPaths:(NSArray *)paths; 22 | 23 | - (void)addPath:(NSString *)path; 24 | - (void)addPaths:(NSArray *)paths; 25 | - (void)removePath:(NSString *)path; 26 | - (void)removePaths:(NSArray *)paths; 27 | - (void)removeAllPaths; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Source/GPGArraySetting.h: -------------------------------------------------------------------------------- 1 | /* 2 | GPGArraySetting.h 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGStdSetting.h" 23 | 24 | // Represents an option which is an NSArray of values. 25 | // E.g., "--auto-key-locate parameters" 26 | @interface GPGArraySetting : GPGStdSetting 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Source/GPGArraySetting.m: -------------------------------------------------------------------------------- 1 | /* 2 | GPGArraySetting.m 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import "GPGArraySetting.h" 22 | #import "GPGConfReader.h" 23 | 24 | static NSMutableCharacterSet *whspcomma_; 25 | 26 | @implementation GPGArraySetting 27 | 28 | + (void)initialize { 29 | static BOOL initialized = NO; 30 | if(!initialized) 31 | { 32 | initialized = YES; 33 | whspcomma_ = [[NSMutableCharacterSet characterSetWithCharactersInString:@","] retain]; 34 | [whspcomma_ formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]]; 35 | } 36 | } 37 | 38 | - (id) initForKey:(NSString *)key { 39 | if ((self = [super initForKey:key])) { 40 | value_ = [[NSMutableArray arrayWithCapacity:0] retain]; 41 | } 42 | return self; 43 | } 44 | 45 | - (void) setValue:(id)value { 46 | if (!value) { 47 | [raw_ release]; 48 | raw_ = nil; 49 | [value_ removeAllObjects]; 50 | self.isActive = FALSE; 51 | } 52 | else if ([value isKindOfClass:[NSArray class]]) { 53 | [raw_ release]; 54 | raw_ = nil; 55 | NSMutableArray *sanitizedValue = [NSMutableArray array]; 56 | for(id v in value) { 57 | if([v isKindOfClass:[NSString class]]) 58 | v = [self sanitizedValueForValue:v]; 59 | [sanitizedValue addObject:v]; 60 | } 61 | [value_ removeAllObjects]; 62 | [value_ addObjectsFromArray:sanitizedValue]; 63 | self.isActive = TRUE; 64 | } 65 | } 66 | 67 | - (NSString *) encodeValue { 68 | NSMutableString *result = [NSMutableString stringWithCapacity:0]; 69 | if (value_ && [value_ count] > 0) { 70 | if (!self.isActive) 71 | [result appendString:@"#"]; 72 | [result appendFormat:@"%@ %@\n", self.key, [value_ componentsJoinedByString:@" "]]; 73 | } 74 | else { 75 | [result appendFormat:@"#%@\n", self.key]; 76 | } 77 | return result; 78 | } 79 | 80 | - (void) incorporate:(NSString *)setting forFullKey:fullKey { 81 | if (setting) { 82 | NSArray *vparts = [GPGConfReader splitString:setting bySet:whspcomma_ maxCount:NSIntegerMax]; 83 | [value_ addObjectsFromArray:vparts]; 84 | if ([vparts count] > 0) 85 | isActive_ = TRUE; 86 | } 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /Source/GPGConf.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface GPGConf : NSObject { 5 | NSString *path; 6 | NSMutableDictionary *config; 7 | // Contains either GPGStdSetting instances or strings read from the file; 8 | // If a GPGStdSetting, then it will be mapped in ->config 9 | NSMutableArray *contents; 10 | GPGOptionsDomain optionsDomain; 11 | } 12 | @property (nonatomic, retain, readonly) NSString *path; 13 | @property (nonatomic, readwrite) GPGOptionsDomain optionsDomain; 14 | 15 | - (BOOL)saveConfig; 16 | - (NSString *)getContents; 17 | + (id)confWithPath:(NSString *)path; 18 | - (id)initWithPath:(NSString *)path; 19 | - (id)initWithPath:(NSString *)path andDomain:(GPGOptionsDomain)domain; 20 | 21 | - (BOOL)loadContents:(NSString *)contentString; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Source/GPGConfReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | GPGConfReader.h 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGOptions.h" 23 | 24 | @class GPGStdSetting; 25 | 26 | @interface GPGConfReader : NSObject { 27 | GPGOptionsDomain domain_; 28 | } 29 | 30 | + (id) readerForDomain:(GPGOptionsDomain)domain; 31 | + (void) initialize; 32 | - (id) initForDomain:(GPGOptionsDomain)domain; 33 | 34 | // Get the condensed setting key name from the specified line, or nil if the 35 | // line is a straight-up comment or blank line. 36 | // "Condensed" means to remove name modifiers like "no-". 37 | - (NSString *) condensedKeyForLine:(NSString *)line; 38 | 39 | // Split the specified line into full key and expression and return/assign. 40 | // E.g, "keyserver-options server1=parameters" will result in 41 | // *key == "keyserver-options" and return value "server1=parameters" 42 | - (NSString *) settingForLine:(NSString *)line outFullKey:(NSString **)key; 43 | 44 | // Get a new GPGStdSetting for the specified line, or nil if the line is not a valid option 45 | // (e.g., if it is an empty line or a straight-up comment). 46 | // Note: line will not be appended yet to the newly-built instance in order to allow 47 | // for handling preceding comments 48 | - (id) buildForLine:(NSString *)line; 49 | 50 | // Split an NSString into the specified max number of components. 51 | // Unlike NSString componentsSeparatedByString, this split method will treat adjacent 52 | // split characters as one separator. 53 | + (NSArray *) splitString:(NSString *)string bySet:(NSCharacterSet *)separator maxCount:(NSUInteger)maximum; 54 | @end 55 | -------------------------------------------------------------------------------- /Source/GPGDictSetting.h: -------------------------------------------------------------------------------- 1 | /* 2 | GPGDictSetting.h 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGStdSetting.h" 23 | 24 | // Represents an option which is a dictionary of key name and NSArray values; 25 | // E.g., --keyserver-options name=value1 value2 26 | @interface GPGDictSetting : GPGStdSetting 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Source/GPGFileStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGFileStream.h 3 | // Libmacgpg 4 | // 5 | // Created by Chris Fraire on 5/21/12. 6 | // Copyright (c) 2012 Chris Fraire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // you can call the read methods of GPGStream on a writeable 12 | // GPGFileStream, at which point it will convert to a readable 13 | // stream (from offset 0) and no longer be writeable 14 | @interface GPGFileStream : GPGStream { 15 | NSString *_filepath; 16 | // for writing 17 | NSFileHandle *_fh; 18 | // for reading 19 | NSFileHandle *_readfh; 20 | // for readable files 21 | unsigned long long _flength; 22 | 23 | // cache to speed-up byte wise reading. 24 | NSData *_cacheData; 25 | const UInt8 *_cacheBytes; 26 | NSUInteger _cacheLocation; 27 | NSUInteger _cacheAvailableBytes; 28 | NSUInteger _realOffset; 29 | 30 | } 31 | 32 | // returns nil if creating file for writing failed 33 | + (id)fileStreamForWritingAtPath:(NSString *)path; 34 | // returns nil if opening file for reading failed 35 | + (id)fileStreamForReadingAtPath:(NSString *)path; 36 | 37 | - (id)initForWritingAtPath:(NSString *)path error:(NSError **)error; 38 | - (id)initForReadingAtPath:(NSString *)path error:(NSError **)error; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Source/GPGKeyFetcher.h: -------------------------------------------------------------------------------- 1 | 2 | @interface GPGKeyFetcher : NSObject { 3 | NSCache *cache; 4 | NSURLSession *session; 5 | } 6 | 7 | 8 | /* 9 | * Returns the de-armored key-data for the specified mail address from a keyserver. 10 | * 11 | */ 12 | - (void)fetchKeyForMailAddress:(NSString *)mailAddress block:(void (^)(NSData *data, NSString *verifiedMail, NSError *error))block; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Source/GPGKeyManager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | @interface GPGKeyManager : NSObject { 4 | NSString *_homedir; 5 | 6 | NSSet *_allKeys; 7 | NSSet *_allKeysAndSubkeys; 8 | 9 | NSMutableSet *_mutableAllKeys; 10 | NSDictionary *_keysByKeyID; 11 | 12 | dispatch_once_t _once_keysByKeyID; 13 | 14 | 15 | dispatch_queue_t _keyLoadingQueue; 16 | dispatch_queue_t _keyChangeNotificationQueue; 17 | 18 | NSSet *_secretKeys; 19 | 20 | dispatch_queue_t _completionQueue; 21 | 22 | NSMutableArray *_keyLoadingOperations; 23 | dispatch_queue_t _keyLoadingOperationsLock; 24 | 25 | 26 | //For loadKeys 27 | 28 | NSSet *_secKeyFingerprints; 29 | NSDictionary *_secKeyInfos; 30 | NSArray *_keyLines; 31 | NSData *_attributeData; 32 | NSMutableDictionary *_attributeInfos; // A dict of arrays of dict with: location, length, type, index, count. 33 | NSUInteger _attributeDataLocation; 34 | BOOL _fetchUserAttributes; 35 | BOOL _fetchSignatures; 36 | BOOL _allowWeakDigestAlgos; 37 | 38 | 39 | dispatch_semaphore_t _allKeysAndSubkeysOnce; 40 | } 41 | @property (nonatomic, copy) NSString *homedir; 42 | 43 | @property (nonatomic) BOOL allowWeakDigestAlgos; 44 | 45 | @property (nonatomic, readonly) NSSet *allKeys; 46 | @property (nonatomic, readonly) NSSet *allKeysAndSubkeys; 47 | @property (nonatomic, readonly) NSDictionary *keysByKeyID; 48 | 49 | /* Subset of allKeys including only secret keys. */ 50 | @property (nonatomic, readonly) NSSet *secretKeys; 51 | 52 | /* retain is not allow on dispatch_queues, but the implementation will 53 | * retain this queue. 54 | * If no queue is set the main queue will be used. 55 | */ 56 | @property (nonatomic, assign) dispatch_queue_t completionQueue; 57 | 58 | /* 59 | GPGKeyManager is a singleton. 60 | */ 61 | + (GPGKeyManager *)sharedInstance; 62 | 63 | /* 64 | Load the specified keys from gpg, pass nil to load all. 65 | keys: A set of GPGKeys. 66 | fetchSignatures: Also load signatures? 67 | fetchUserAttributes: Also load user attributes (e.g. PhotoID) 68 | */ 69 | - (void)loadKeys:(NSSet *)keys fetchSignatures:(BOOL)fetchSignatures fetchUserAttributes:(BOOL)fetchUserAttributes; 70 | 71 | - (void)loadAllKeys; 72 | 73 | 74 | /* Load the specified keys. 75 | * completionHandler will be called once the keys are loaded, and pass 76 | * the loaded keys as argument. 77 | */ 78 | - (void)loadKeys:(NSSet *)keys completionHandler:(void(^)(NSSet *))completionHandler; 79 | 80 | /* Load signatures for the specified keys. 81 | * completionHandler will be called once the signatures are loaded, and pass 82 | * the loaded keys as argument. 83 | */ 84 | - (void)loadSignaturesForKeys:(NSSet *)keys completionHandler:(void(^)(NSSet *))completionHandler; 85 | 86 | /* Load attributes (photo) for the specified keys. 87 | * completionHandler will be called once the attributes are loaded, and pass 88 | * the loaded keys as argument. 89 | */ 90 | - (void)loadAttributesForKeys:(NSSet *)keys completionHandler:(void(^)(NSSet *))completionHandler; 91 | 92 | /* Load both signatures and attributes for the specified keys. 93 | * completionHandler will be called once the signatures and attributes are loaded, and pass 94 | * the loaded keys as argument. 95 | */ 96 | - (void)loadSignaturesAndAttributesForKeys:(NSSet *)keys completionHandler:(void(^)(NSSet *))completionHandler; 97 | 98 | /* 99 | * Returns a human readable descryption of the keys. 100 | * Used whenever keys are listed in a dialog. 101 | */ 102 | - (NSString *)descriptionForKeys:(NSArray *)keys; 103 | 104 | @end 105 | 106 | /* Register to this notification to received notifications when keys were modified. */ 107 | extern NSString * const GPGKeyManagerKeysDidChangeNotification; 108 | -------------------------------------------------------------------------------- /Source/GPGKeyMonitoring.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGKeyMonitoring.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 05.07.18. 6 | // 7 | 8 | @interface GPGKeyMonitoring : NSObject 9 | /* 10 | * All alerts will be atached to this window. 11 | * Be sure to set this to nil again, before the window is released! 12 | */ 13 | @property (nonatomic, assign) NSWindow *sheetWindow; 14 | + (instancetype)sharedInstance; 15 | @end 16 | -------------------------------------------------------------------------------- /Source/GPGKeyserver.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGKeyserver.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 09.07.13. 6 | // 7 | // 8 | 9 | @class GPGKeyserver; 10 | 11 | typedef void (^gpg_ks_finishedHandler)(GPGKeyserver *server); 12 | 13 | @interface GPGKeyserver : NSObject { 14 | NSString *keyserver; 15 | NSDictionary *userInfo; 16 | BOOL isRunning; 17 | SEL lastOperation; 18 | NSError *_error; 19 | gpg_ks_finishedHandler finishedHandler; 20 | NSUInteger timeout; 21 | NSHTTPURLResponse *_response; 22 | 23 | NSMutableData *receivedData; 24 | NSURLConnection *connection; 25 | BOOL _cancelled; 26 | dispatch_once_t _finishedHandlerOnceToken; 27 | } 28 | 29 | @property (retain, nonatomic) NSString *keyserver; 30 | @property (readonly, retain, nonatomic) NSData *receivedData; 31 | @property (retain, nonatomic) NSDictionary *userInfo; 32 | @property (readonly, nonatomic) BOOL isRunning; 33 | @property (readonly, nonatomic) SEL lastOperation; 34 | @property (readonly, retain, nonatomic) NSError *error; 35 | @property (nonatomic) NSUInteger timeout; 36 | @property (readonly, retain, nonatomic) NSHTTPURLResponse *response; 37 | 38 | @property (nonatomic, copy) gpg_ks_finishedHandler finishedHandler; 39 | 40 | 41 | - (void)getKey:(NSString *)keyID; 42 | - (void)searchKey:(NSString *)pattern; 43 | - (void)uploadKeys:(NSString *)armored; 44 | 45 | - (void)cancel; 46 | 47 | - (id)initWithFinishedHandler:(gpg_ks_finishedHandler)finishedHandler; 48 | 49 | 50 | @end 51 | 52 | -------------------------------------------------------------------------------- /Source/GPGLinesSetting.h: -------------------------------------------------------------------------------- 1 | /* 2 | GPGLinesSetting.h 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGStdSetting.h" 23 | 24 | // Represents an option which can be set over multiple lines in .conf. 25 | // E.g., "comment Some comment goes here" 26 | @interface GPGLinesSetting : GPGStdSetting 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Source/GPGLinesSetting.m: -------------------------------------------------------------------------------- 1 | /* 2 | GPGLinesSetting.m 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import "GPGLinesSetting.h" 22 | 23 | @implementation GPGLinesSetting 24 | 25 | - (id) initForKey:(NSString *)key { 26 | if ((self = [super initForKey:key])) { 27 | value_ = [[NSMutableArray arrayWithCapacity:0] retain]; 28 | } 29 | return self; 30 | } 31 | 32 | - (void) setValue:(id)value { 33 | if (!value) { 34 | [raw_ release]; 35 | raw_ = nil; 36 | [value_ removeAllObjects]; 37 | self.isActive = FALSE; 38 | } 39 | else if ([value isKindOfClass:[NSArray class]]) { 40 | [raw_ release]; 41 | raw_ = nil; 42 | NSMutableArray *sanitizedValue = [NSMutableArray array]; 43 | for(id v in value) { 44 | if([v isKindOfClass:[NSString class]]) 45 | v = [self sanitizedValueForValue:v]; 46 | [sanitizedValue addObject:v]; 47 | } 48 | [value_ removeAllObjects]; 49 | [value_ addObjectsFromArray:sanitizedValue]; 50 | self.isActive = TRUE; 51 | } 52 | } 53 | 54 | - (NSString *) encodeValue { 55 | NSMutableString *result = [NSMutableString stringWithCapacity:0]; 56 | if (value_ && [value_ count] > 0) { 57 | for (id line in value_) { 58 | if (!self.isActive) 59 | [result appendString:@"#"]; 60 | [result appendFormat:@"%@ %@\n", self.key, line]; 61 | } 62 | } 63 | else { 64 | [result appendFormat:@"#%@\n", self.key]; 65 | } 66 | return result; 67 | } 68 | 69 | - (void) incorporate:(NSString *)setting forFullKey:fullKey { 70 | if (setting) { 71 | [value_ addObject:setting]; 72 | isActive_ = TRUE; 73 | } 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Source/GPGMemoryStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGMemoryStream.h 3 | // Libmacgpg 4 | // 5 | // Created by Chris Fraire on 5/21/12. 6 | // Copyright (c) 2012 Chris Fraire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // you can call the read methods of GPGStream on a writeable 12 | // GPGFileStream, at which point it will convert to a readable 13 | // stream (from offset 0) and no longer be writeable 14 | @interface GPGMemoryStream : GPGStream { 15 | NSMutableData *_data; 16 | NSData *_readableData; 17 | NSUInteger _readPos; 18 | const UInt8 *_readableBytes; 19 | NSUInteger _readableLength; 20 | } 21 | 22 | // return a new, autoreleased memory stream 23 | + (id)memoryStream; 24 | // return a new, autoreleased memory stream atop the specified data 25 | + (id)memoryStreamForReading:(NSData *)data; 26 | 27 | - (id)initForReading:(NSData *)data; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Source/GPGPacket/COPYING.pgpdump: -------------------------------------------------------------------------------- 1 | Copyright of pgpdump, it does NOT apply to Libmacgpg. 2 | For the original source see: https://github.com/kazu-yamamoto/pgpdump 3 | 4 | Copyright (C) 1998 Kazuhiko Yamamoto 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. Neither the name of the author nor the names of its contributors 17 | may be used to endorse or promote products derived from this software 18 | without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 29 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 30 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGCompressedDataPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGCompressedDataPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @class GPGPacketParser, GPGDecompressStream; 25 | 26 | /** 27 | This packet is normally only used by GPGPacketParser. 28 | Use GPGPacketParser to get it's content. 29 | */ 30 | @interface GPGCompressedDataPacket : GPGPacket { 31 | NSInteger compressAlgorithm; 32 | GPGDecompressStream *decompressStream; 33 | GPGPacketParser *subParser; 34 | } 35 | 36 | @property (nonatomic, readonly) NSInteger compressAlgorithm; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGCompressedDataPacket_Private.h: -------------------------------------------------------------------------------- 1 | /* GPGCompressedDataPacket_Private.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGCompressedDataPacket.h" 23 | 24 | @interface GPGCompressedDataPacket () 25 | - (BOOL)canDecompress; 26 | - (GPGPacket *)nextPacket; 27 | @end 28 | 29 | 30 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGIgnoredPackets.h: -------------------------------------------------------------------------------- 1 | /* GPGIgnoredPackets.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | 25 | // Ignore the content of these packets. 26 | // Still use a real subclass and report the right tag. 27 | @interface GPGIgnoredPacket : GPGPacket 28 | @end 29 | 30 | @interface GPGEncryptedDataPacket : GPGIgnoredPacket 31 | @end 32 | 33 | @interface GPGMarkerPacket : GPGIgnoredPacket 34 | @end 35 | 36 | @interface GPGTrustPacket : GPGIgnoredPacket 37 | @end 38 | 39 | @interface GPGEncryptedProtectedDataPacket : GPGIgnoredPacket 40 | @end 41 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGIgnoredPackets.m: -------------------------------------------------------------------------------- 1 | /* GPGIgnoredPackets.m 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGIgnoredPackets.h" 23 | #import "GPGPacket_Private.h" 24 | 25 | 26 | @implementation GPGIgnoredPacket 27 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length { 28 | self = [super init]; 29 | if (!self) { 30 | return nil; 31 | } 32 | 33 | [parser skip:length]; 34 | cancelInitOnEOF(); 35 | return self; 36 | } 37 | @end 38 | 39 | @implementation GPGEncryptedDataPacket 40 | - (GPGPacketTag)tag { 41 | return 9; 42 | } 43 | @end 44 | 45 | @implementation GPGMarkerPacket 46 | - (GPGPacketTag)tag { 47 | return 10; 48 | } 49 | @end 50 | 51 | @implementation GPGTrustPacket 52 | - (GPGPacketTag)tag { 53 | return 12; 54 | } 55 | @end 56 | 57 | @implementation GPGEncryptedProtectedDataPacket 58 | - (GPGPacketTag)tag { 59 | return 18; 60 | } 61 | @end 62 | 63 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGKeyMaterialPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGKeyMaterialPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @interface GPGPublicKeyPacket : GPGPacket { 25 | NSInteger publicAlgorithm; 26 | NSInteger version; 27 | NSInteger validDays; 28 | NSUInteger creationTime; 29 | NSString *fingerprint; 30 | NSString *keyID; 31 | } 32 | 33 | /** 34 | Public-Key Algorithm used. See: https://tools.ietf.org/html/rfc4880#section-9.1 35 | */ 36 | @property (nonatomic, readonly) NSInteger publicAlgorithm; 37 | @property (nonatomic, readonly) NSInteger version; 38 | @property (nonatomic, readonly) NSInteger validDays; // Only set on old keys. 39 | @property (nonatomic, readonly) NSUInteger creationTime; 40 | @property (nonatomic, strong, readonly) NSString *fingerprint; 41 | @property (nonatomic, strong, readonly) NSString *keyID; 42 | 43 | 44 | @end 45 | 46 | @interface GPGPublicSubkeyPacket : GPGPublicKeyPacket 47 | @end 48 | 49 | 50 | @interface GPGSecretKeyPacket : GPGPublicKeyPacket 51 | @end 52 | 53 | 54 | @interface GPGSecretSubkeyPacket : GPGSecretKeyPacket 55 | @end 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGLiteralDataPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGLiteralDataPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | /** 25 | See: https://tools.ietf.org/html/rfc4880#section-5.9 26 | */ 27 | @interface GPGLiteralDataPacket : GPGPacket { 28 | NSInteger format; 29 | NSString *filename; 30 | NSUInteger time; 31 | NSData *content; 32 | } 33 | 34 | @property (nonatomic, readonly) NSInteger format; 35 | @property (nonatomic, strong, readonly) NSString *filename; // "_CONSOLE" means "for your eyes only". 36 | @property (nonatomic, readonly) NSUInteger time; 37 | @property (nonatomic, copy, readonly) NSData *content; 38 | 39 | @end 40 | 41 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGLiteralDataPacket.m: -------------------------------------------------------------------------------- 1 | /* GPGLiteralDataPacket.m 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGLiteralDataPacket.h" 23 | #import "GPGPacket_Private.h" 24 | 25 | @interface GPGLiteralDataPacket () 26 | @property (nonatomic, readwrite) NSInteger format; 27 | @property (nonatomic, strong, readwrite) NSString *filename; 28 | @property (nonatomic, readwrite) NSUInteger time; 29 | @property (nonatomic, copy, readwrite) NSData *content; 30 | @end 31 | 32 | 33 | @implementation GPGLiteralDataPacket 34 | @synthesize format, filename, time, content; 35 | 36 | 37 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length { 38 | self = [super init]; 39 | if (!self) { 40 | return nil; 41 | } 42 | 43 | // 'b': binary, 't': text (convert line-endings), 'u': like 't' but UTF8. 44 | self.format = parser.byte; 45 | 46 | // filename could be empty. 47 | NSUInteger filenameLength = parser.byte; 48 | self.filename = [parser stringWithLength:filenameLength]; 49 | 50 | self.time = parser.time; 51 | 52 | // Decrement by the number of bytes read. 53 | length = length - 6 - filenameLength; 54 | 55 | cancelInitOnEOF(); 56 | 57 | // Read the content bytes of the packet. 58 | NSMutableData *tempData = [NSMutableData data]; 59 | NSUInteger i = 0; 60 | while (length > 0) { 61 | tempData.length += length; 62 | UInt8 *bytes = tempData.mutableBytes; 63 | 64 | for (NSUInteger j = 0; j < length; j++) { 65 | bytes[i++] = (UInt8)parser.byte; 66 | cancelInitOnEOF(); 67 | } 68 | 69 | if (parser.partial) { 70 | length = parser.nextPartialLength; 71 | } else { 72 | length = 0; 73 | } 74 | } 75 | 76 | self.content = tempData; 77 | 78 | cancelInitOnEOF(); 79 | return self; 80 | } 81 | 82 | - (GPGPacketTag)tag { 83 | return 11; 84 | } 85 | 86 | - (void)dealloc { 87 | self.filename = nil; 88 | self.content = nil; 89 | [super dealloc]; 90 | } 91 | 92 | 93 | @end 94 | 95 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGOnePassSignaturePacket.h: -------------------------------------------------------------------------------- 1 | /* GPGOnePassSignaturePacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @interface GPGOnePassSignaturePacket : GPGPacket { 25 | NSInteger publicAlgorithm; 26 | NSInteger hashAlgorithm; 27 | NSInteger type; 28 | NSInteger version; 29 | NSString *keyID; 30 | } 31 | 32 | /** 33 | Public-Key Algorithm used. See: https://tools.ietf.org/html/rfc4880#section-9.1 34 | */ 35 | @property (nonatomic, readonly) NSInteger publicAlgorithm; 36 | /** 37 | Hash Algorithm used. See: https://tools.ietf.org/html/rfc4880#section-9.4 38 | */ 39 | @property (nonatomic, readonly) NSInteger hashAlgorithm; 40 | @property (nonatomic, readonly) NSInteger type; 41 | @property (nonatomic, readonly) NSInteger version; 42 | @property (nonatomic, strong, readonly) NSString *keyID; 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGOnePassSignaturePacket.m: -------------------------------------------------------------------------------- 1 | /* GPGOnePassSignaturePacket.m 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGOnePassSignaturePacket.h" 23 | #import "GPGPacket_Private.h" 24 | 25 | @interface GPGOnePassSignaturePacket () 26 | @property (nonatomic, readwrite) NSInteger publicAlgorithm; 27 | @property (nonatomic, readwrite) NSInteger hashAlgorithm; 28 | @property (nonatomic, readwrite) NSInteger type; 29 | @property (nonatomic, readwrite) NSInteger version; 30 | @property (nonatomic, strong, readwrite) NSString *keyID; 31 | @end 32 | 33 | 34 | @implementation GPGOnePassSignaturePacket 35 | @synthesize publicAlgorithm, hashAlgorithm, type, version, keyID; 36 | 37 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length { 38 | self = [super init]; 39 | if (!self) { 40 | return nil; 41 | } 42 | 43 | self.version = parser.byte; 44 | self.type = parser.byte; 45 | self.hashAlgorithm = parser.byte; 46 | self.publicAlgorithm = parser.byte; 47 | self.keyID = parser.keyID; 48 | 49 | [parser byte]; // Ignore (0 means the next packet is another one-pass signature) 50 | 51 | cancelInitOnEOF(); 52 | return self; 53 | } 54 | 55 | - (GPGPacketTag)tag { 56 | return 4; 57 | } 58 | 59 | - (void)dealloc { 60 | self.keyID = nil; 61 | [super dealloc]; 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | 23 | 24 | // Every subclass of GPGPacket returns one of these tags. 25 | typedef NS_ENUM(NSInteger, GPGPacketTag) { 26 | GPGPublicKeyEncryptedSessionKeyPacketTag = 1, 27 | GPGSignaturePacketTag = 2, 28 | GPGSymmetricEncryptedSessionKeyPacketTag = 3, 29 | GPGOnePassSignaturePacketTag = 4, 30 | GPGSecretKeyPacketTag = 5, 31 | GPGPublicKeyPacketTag = 6, 32 | GPGSecretSubkeyPacketTag = 7, 33 | GPGCompressedDataPacketTag = 8, 34 | GPGEncryptedDataPacketTag = 9, 35 | GPGMarkerPacketTag = 10, 36 | GPGLiteralDataPacketTag = 11, 37 | GPGTrustPacketTag = 12, 38 | GPGUserIDPacketTag = 13, 39 | GPGPublicSubkeyPacketTag = 14, 40 | GPGUserAttributePacketTag = 17, 41 | GPGEncryptedProtectedDataPacketTag = 18, 42 | }; 43 | 44 | 45 | /** 46 | GPGPacket is an abstract super-class and should never be used directly. 47 | */ 48 | @interface GPGPacket : NSObject { 49 | NSData *_data; 50 | } 51 | @property (readonly) GPGPacketTag tag; 52 | @property (nonatomic, copy, readonly) NSData *data; 53 | 54 | 55 | 56 | + (NSDictionary *)capabilitiesOfPackets:(NSArray *)packets; 57 | 58 | + (id)packetsWithData:(NSData *)data; 59 | + (void)enumeratePacketsWithData:(NSData *)theData block:(void (^)(GPGPacket *packet, BOOL *stop))block; 60 | 61 | 62 | // Old methods, only for compatibility: 63 | 64 | - (NSInteger)type UNAVAILABLE_ATTRIBUTE; 65 | - (NSString *)keyID UNAVAILABLE_ATTRIBUTE; 66 | - (NSInteger)signatureType UNAVAILABLE_ATTRIBUTE; 67 | 68 | + (NSData *)unArmor:(NSData *)data DEPRECATED_ATTRIBUTE; 69 | + (NSData *)unArmor:(NSData *)data clearText:(NSData **)clearText DEPRECATED_ATTRIBUTE; 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGPacketParser.h: -------------------------------------------------------------------------------- 1 | /* GPGPacketParser.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | @class GPGStream; 23 | @class GPGPacket; 24 | @class GPGCompressedDataPacket; 25 | 26 | typedef void (^ByteCallback)(NSInteger); 27 | 28 | 29 | @interface GPGPacketParser : NSObject { 30 | 31 | // Properties 32 | GPGStream *stream; 33 | NSError *error; 34 | 35 | ByteCallback byteCallback; 36 | GPGCompressedDataPacket *compressedPacket; 37 | 38 | BOOL partial; 39 | NSUInteger packetLength; 40 | 41 | 42 | // Private 43 | BOOL eofReached; 44 | NSMutableData *packetData; 45 | } 46 | 47 | @property (nonatomic, readonly, strong) NSError *error; 48 | 49 | 50 | + (instancetype)packetParserWithStream:(GPGStream *)stream; 51 | 52 | - (instancetype)initWithStream:(GPGStream *)stream; 53 | /** 54 | Get the next packet from the stream. 55 | Sets error if an error occurred. 56 | @returns The next packet (subclass of GPGPacket) or nil if an error occurred or it was the last packet. 57 | */ 58 | - (GPGPacket *)nextPacket; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGPacketParser_Private.h: -------------------------------------------------------------------------------- 1 | /* GPGPacketParser_Private.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGPacketParser.h" 23 | 24 | 25 | 26 | @interface GPGPacketParser () 27 | 28 | @property (nonatomic, copy) ByteCallback byteCallback; // Called every time a byte is read. 29 | 30 | - (NSInteger)byte; 31 | - (void)skip:(NSUInteger)count; 32 | - (void)skipRemaining; 33 | - (BOOL)eofReached; 34 | 35 | - (NSUInteger)nextPartialLength; 36 | - (BOOL)partial; 37 | 38 | - (NSString *)keyID; 39 | - (id)multiPrecisionInteger; 40 | - (NSUInteger)time; 41 | - (UInt16)uint16; 42 | - (NSString *)stringWithLength:(NSUInteger)length; 43 | - (NSArray *)signatureSubpacketsWithLength:(NSUInteger)fullLength; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGPacket_Private.h: -------------------------------------------------------------------------------- 1 | /* GPGPacket_Private.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGPacketParser_Private.h" 23 | 24 | // If the end of file is reached during init, the packet 25 | // is invalid: Release it and return nil. 26 | #define cancelInitOnEOF() if (parser.eofReached) {[self release]; return nil;} 27 | 28 | 29 | @class GPGPacketParser; 30 | 31 | @interface GPGPacket () 32 | @property (nonatomic, copy, readwrite) NSData *data; 33 | 34 | // This is the designated initializer of the sub-classes. 35 | // This method may read up to length bytes from parser, 36 | // it could read more, if it's a partial packet. 37 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGPublicKeyEncryptedSessionKeyPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGPublicKeyEncryptedSessionKeyPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @interface GPGPublicKeyEncryptedSessionKeyPacket : GPGPacket { 25 | NSInteger publicAlgorithm; 26 | NSInteger version; 27 | NSString *keyID; 28 | } 29 | 30 | @property (nonatomic, readonly) NSInteger publicAlgorithm; 31 | @property (nonatomic, readonly) NSInteger version; 32 | @property (nonatomic, strong, readonly) NSString *keyID; 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGPublicKeyEncryptedSessionKeyPacket.m: -------------------------------------------------------------------------------- 1 | /* GPGPublicKeyEncryptedSessionKeyPacket.m 2 | Based on pgpdump (https://github.com/kazu-yamamoto/pgpdump) from Kazuhiko Yamamoto. 3 | Copyright © Roman Zechmeister, 2017 4 | 5 | This file is part of Libmacgpg. 6 | 7 | Libmacgpg is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | Libmacgpg is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | 02111-1307, USA 21 | */ 22 | 23 | #import "GPGPublicKeyEncryptedSessionKeyPacket.h" 24 | #import "GPGPacket_Private.h" 25 | 26 | @interface GPGPublicKeyEncryptedSessionKeyPacket () 27 | @property (nonatomic, readwrite) NSInteger publicAlgorithm; 28 | @property (nonatomic, readwrite) NSInteger version; 29 | @property (nonatomic, strong, readwrite) NSString *keyID; 30 | @end 31 | 32 | 33 | @implementation GPGPublicKeyEncryptedSessionKeyPacket 34 | @synthesize publicAlgorithm, version, keyID; 35 | 36 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length { 37 | self = [super init]; 38 | if (!self) { 39 | return nil; 40 | } 41 | 42 | self.version = parser.byte; 43 | self.keyID = parser.keyID; 44 | self.publicAlgorithm = parser.byte; 45 | 46 | // We ignore the MPIs at the moment. 47 | switch (publicAlgorithm) { 48 | case 1: 49 | case 2: 50 | case 3: 51 | [parser multiPrecisionInteger]; // "RSA m^e mod n" 52 | break; 53 | case 16: 54 | case 20: 55 | [parser multiPrecisionInteger]; // "ElGamal g^k mod p" 56 | [parser multiPrecisionInteger]; // "ElGamal m * y^k mod p" 57 | break; 58 | case 17: 59 | [parser multiPrecisionInteger]; // "DSA ?" 60 | [parser multiPrecisionInteger]; // "DSA ?" 61 | break; 62 | default: 63 | [parser skip:length - 10]; 64 | break; 65 | } 66 | 67 | cancelInitOnEOF(); 68 | return self; 69 | } 70 | 71 | - (GPGPacketTag)tag { 72 | return 1; 73 | } 74 | 75 | - (void)dealloc { 76 | self.keyID = nil; 77 | [super dealloc]; 78 | } 79 | 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGSignaturePacket.h: -------------------------------------------------------------------------------- 1 | /* GPGSignaturePacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | 25 | // Subpacket tags. 26 | typedef NS_ENUM (NSInteger, GPGSubpacketTag) { 27 | GPGSignatureCreationTimeTag = 2, 28 | GPGSignatureExpirationTimeTag = 3, 29 | GPGExportableCertificationTag = 4, 30 | GPGTrustSignatureTag = 5, 31 | GPGRegularExpressionTag = 6, 32 | GPGRevocableTag = 7, 33 | GPGKeyExpirationTimeTag = 9, 34 | GPGPreferredSymmetricAlgorithmsTag = 11, 35 | GPGRevocationKeyTag = 12, 36 | GPGIssuerTag = 16, 37 | GPGNotationDataTag = 20, 38 | GPGPreferredHashAlgorithmsTag = 21, 39 | GPGPreferredCompressionAlgorithmsTag = 22, 40 | GPGKeyServerPreferencesTag = 23, 41 | GPGPreferredKeyServerTag = 24, 42 | GPGPrimaryUserIDTag = 25, 43 | GPGPolicyURITag = 26, 44 | GPGKeyFlagsTag = 27, 45 | GPGSignersUserIDTag = 28, 46 | GPGReasonForRevocationTag = 29, 47 | GPGFeaturesTag = 30, 48 | GPGSignatureTargetTag = 31, 49 | GPGEmbeddedSignatureTag = 32 50 | }; 51 | 52 | 53 | 54 | @interface GPGSignaturePacket : GPGPacket { 55 | NSInteger publicAlgorithm; 56 | NSInteger hashAlgorithm; 57 | NSInteger type; 58 | NSInteger version; 59 | UInt16 hashStart; 60 | NSString *keyID; 61 | NSUInteger creationTime; 62 | NSArray *hashedSubpackets; 63 | NSArray *unhashedSubpackets; 64 | NSArray *subpackets; 65 | } 66 | 67 | @property (nonatomic, readonly) NSInteger publicAlgorithm; 68 | @property (nonatomic, readonly) NSInteger hashAlgorithm; 69 | /** 70 | Type of the signature. See: https://tools.ietf.org/html/rfc4880#section-5.2.1 71 | */ 72 | @property (nonatomic, readonly) NSInteger type; 73 | @property (nonatomic, readonly) NSInteger version; 74 | @property (nonatomic, readonly) UInt16 hashStart; 75 | @property (nonatomic, copy, readonly) NSString *keyID; 76 | @property (nonatomic, readonly) NSUInteger creationTime; 77 | /** 78 | The hashed subpackets of the GPGSignaturePacket. 79 | @returns List of NSDictionarys, this can change at any time, so you're required to test for it. 80 | */ 81 | @property (nonatomic, copy, readonly) NSArray *hashedSubpackets; 82 | /** 83 | The unhashed subpackets of the GPGSignaturePacket. They are NOT secured by the signature. 84 | @returns List of NSDictionarys, this can change at any time, so you're required to test for it. 85 | */ 86 | @property (nonatomic, copy, readonly) NSArray *unhashedSubpackets; 87 | /** 88 | Array containing all elements of unhashedSubpackets and hashedSubpackets. 89 | @returns List of NSDictionarys, this can change at any time, so you're required to test for it. 90 | */ 91 | @property (nonatomic, copy, readonly) NSArray *subpackets; // Combination of unhashedSubpackets and hashedSubpackets. Order is undefined! 92 | 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGSymmetricEncryptedSessionKeyPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGSymmetricEncryptedSessionKeyPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @interface GPGSymmetricEncryptedSessionKeyPacket : GPGPacket { 25 | NSInteger symmetricAlgorithm; 26 | NSInteger version; 27 | NSString *keyID; 28 | } 29 | 30 | /** 31 | Symmetric-Key Algorithm used. See: https://tools.ietf.org/html/rfc4880#section-9.2 32 | */ 33 | @property (nonatomic, readonly) NSInteger symmetricAlgorithm; 34 | @property (nonatomic, readonly) NSInteger version; 35 | @property (nonatomic, strong, readonly) NSString *keyID; 36 | 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGSymmetricEncryptedSessionKeyPacket.m: -------------------------------------------------------------------------------- 1 | /* GPGSymmetricEncryptedSessionKeyPacket.m 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGSymmetricEncryptedSessionKeyPacket.h" 23 | #import "GPGPacket_Private.h" 24 | 25 | @interface GPGSymmetricEncryptedSessionKeyPacket () 26 | @property (nonatomic, readwrite) NSInteger symmetricAlgorithm; 27 | @property (nonatomic, readwrite) NSInteger version; 28 | @property (nonatomic, strong, readwrite) NSString *keyID; 29 | @end 30 | 31 | 32 | @implementation GPGSymmetricEncryptedSessionKeyPacket 33 | @synthesize symmetricAlgorithm, version, keyID; 34 | 35 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length { 36 | self = [super init]; 37 | if (!self) { 38 | return nil; 39 | } 40 | 41 | self.version = parser.byte; 42 | self.symmetricAlgorithm = parser.byte; 43 | 44 | 45 | // TODO: parse string-to-key. 46 | 47 | 48 | [parser skipRemaining]; 49 | 50 | cancelInitOnEOF(); 51 | return self; 52 | } 53 | 54 | - (GPGPacketTag)tag { 55 | return 3; 56 | } 57 | 58 | - (void)dealloc { 59 | self.keyID = nil; 60 | [super dealloc]; 61 | } 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGUserAttributePacket.h: -------------------------------------------------------------------------------- 1 | /* GPGUserAttributePacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @interface GPGUserAttributePacket : GPGPacket { 25 | NSArray *subpackets; 26 | } 27 | 28 | @property (nonatomic, copy, readonly) NSArray *subpackets; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGUserIDPacket.h: -------------------------------------------------------------------------------- 1 | /* GPGUserIDPacket.h 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import 23 | 24 | @interface GPGUserIDPacket : GPGPacket { 25 | NSString *userID; 26 | } 27 | 28 | @property (nonatomic, strong, readonly) NSString *userID; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Source/GPGPacket/GPGUserIDPacket.m: -------------------------------------------------------------------------------- 1 | /* GPGUserIDPacket.m 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | This file is part of Libmacgpg. 5 | 6 | Libmacgpg is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Libmacgpg is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA 20 | */ 21 | 22 | #import "GPGUserIDPacket.h" 23 | #import "GPGPacket_Private.h" 24 | 25 | @interface GPGUserIDPacket () 26 | @property (nonatomic, strong, readwrite) NSString *userID; 27 | @end 28 | 29 | 30 | @implementation GPGUserIDPacket 31 | @synthesize userID; 32 | 33 | 34 | - (instancetype)initWithParser:(GPGPacketParser *)parser length:(NSUInteger)length { 35 | self = [super init]; 36 | if (!self) { 37 | return nil; 38 | } 39 | 40 | self.userID = [parser stringWithLength:length]; 41 | 42 | cancelInitOnEOF(); 43 | return self; 44 | } 45 | 46 | - (GPGPacketTag)tag { 47 | return 13; 48 | } 49 | 50 | - (NSString *)description { 51 | return [NSString stringWithFormat:@"%@: \"%@\"", self.className, self.userID]; 52 | } 53 | 54 | - (void)dealloc { 55 | self.userID = nil; 56 | [super dealloc]; 57 | } 58 | 59 | 60 | @end 61 | 62 | -------------------------------------------------------------------------------- /Source/GPGRemoteKey.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | 22 | 23 | @interface GPGRemoteKey : NSObject 24 | 25 | @property (nonatomic, readonly) GPGPublicKeyAlgorithm algorithm; 26 | @property (nonatomic, readonly) NSUInteger length; 27 | @property (nonatomic, readonly) BOOL expired; 28 | @property (nonatomic, readonly) BOOL revoked; 29 | @property (nonatomic, readonly) BOOL fromVKS; 30 | @property (nonatomic, readonly, strong) NSString *fingerprint; 31 | @property (nonatomic, readonly, strong) NSString *keyID; 32 | @property (nonatomic, readonly, strong) NSDate *creationDate; 33 | @property (nonatomic, readonly, strong) NSDate *expirationDate; 34 | @property (nonatomic, readonly, strong) NSArray *userIDs; 35 | 36 | 37 | + (NSArray *)keysWithListing:(NSString *)listing fromVKS:(BOOL)fromVKS; 38 | + (NSArray *)keysWithListing:(NSString *)listing; 39 | + (id)keyWithListing:(NSArray *)listing fromVKS:(BOOL)fromVKS; 40 | + (id)keyWithListing:(NSArray *)listing; 41 | - (id)initWithListing:(NSArray *)listing fromVKS:(BOOL)fromVKS; 42 | - (id)initWithListing:(NSArray *)listing; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Source/GPGRemoteUserID.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | 22 | @interface GPGRemoteUserID : NSObject { 23 | NSString *userIDDescription; 24 | NSString *name; 25 | NSString *email; 26 | NSString *comment; 27 | NSDate *creationDate; 28 | NSDate *expirationDate; 29 | } 30 | 31 | @property (nonatomic, retain) NSString *userIDDescription; 32 | @property (nonatomic, retain) NSString *name; 33 | @property (nonatomic, retain) NSString *email; 34 | @property (nonatomic, retain) NSString *comment; 35 | @property (nonatomic, readonly, retain) NSDate *creationDate; 36 | @property (nonatomic, readonly, retain) NSDate *expirationDate; 37 | @property (nonatomic, readonly) NSImage *image; 38 | 39 | 40 | + (id)userIDWithListing:(NSString *)listing; 41 | - (id)initWithListing:(NSString *)listing; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Source/GPGRemoteUserID.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import "GPGRemoteUserID.h" 21 | 22 | 23 | @interface GPGRemoteUserID () 24 | 25 | @property (nonatomic, retain) NSDate *creationDate; 26 | @property (nonatomic, retain) NSDate *expirationDate; 27 | 28 | @end 29 | 30 | 31 | @implementation GPGRemoteUserID 32 | @synthesize userIDDescription, name, email, comment, creationDate, expirationDate; 33 | 34 | 35 | + (id)userIDWithListing:(NSString *)listing { 36 | return [[[self alloc] initWithListing:listing] autorelease]; 37 | } 38 | 39 | - (id)initWithListing:(NSString *)listing { 40 | if (self = [super init]) { 41 | NSArray *splitedLine = [listing componentsSeparatedByString:@":"]; 42 | 43 | if (splitedLine.count < 2 || ![splitedLine[0] isEqualToString:@"uid"]) { 44 | [self release]; 45 | return nil; 46 | } 47 | 48 | 49 | NSString *decodedString = [splitedLine[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 50 | 51 | if (!decodedString) { 52 | int encodings[] = {NSISOLatin1StringEncoding, NSISOLatin2StringEncoding, NSASCIIStringEncoding, 0}; 53 | int i = 0; 54 | 55 | while (encodings[i]) { 56 | decodedString = [splitedLine[1] stringByReplacingPercentEscapesUsingEncoding:encodings[i]]; 57 | if (decodedString) { 58 | break; 59 | } 60 | i++; 61 | } 62 | } 63 | 64 | self.userIDDescription = decodedString; 65 | 66 | if (splitedLine.count >= 3) { 67 | self.creationDate = [NSDate dateWithGPGString:splitedLine[2]]; 68 | } 69 | if (splitedLine.count >= 4) { 70 | self.expirationDate = [NSDate dateWithGPGString:splitedLine[3]]; 71 | } 72 | } 73 | return self; 74 | } 75 | 76 | - (void)setUserIDDescription:(NSString *)value { 77 | if (value != userIDDescription) { 78 | [userIDDescription release]; 79 | userIDDescription = [value retain]; 80 | 81 | NSDictionary *dict = [value splittedUserIDDescription]; 82 | self.name = dict[@"name"]; 83 | self.email = dict[@"email"]; 84 | self.comment = dict[@"comment"]; 85 | } 86 | } 87 | 88 | -(NSImage *)image { 89 | return nil; 90 | } 91 | 92 | - (void)dealloc { 93 | self.userIDDescription = nil; 94 | self.name = nil; 95 | self.email = nil; 96 | self.comment = nil; 97 | self.creationDate = nil; 98 | self.expirationDate = nil; 99 | [super dealloc]; 100 | } 101 | 102 | 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Source/GPGSignature.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister und Lukas Pitschl (@lukele), 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | #import 22 | #import 23 | 24 | @class GPGKey; 25 | 26 | 27 | @interface GPGSignature : NSObject { 28 | GPGValidity _trust; 29 | GPGErrorCode _status; 30 | 31 | NSString *_fingerprint; 32 | NSDate *_creationDate; 33 | NSDate *_expirationDate; 34 | int _signatureClass; 35 | int _version; 36 | GPGPublicKeyAlgorithm _publicKeyAlgorithm; 37 | GPGHashAlgorithm _hashAlgorithm; 38 | 39 | GPGKey *_key; 40 | } 41 | 42 | - (instancetype)init; 43 | - (instancetype)initWithFingerprint:(NSString *)fingerprint status:(GPGErrorCode)status; 44 | - (NSString *)humanReadableDescription; 45 | // really for unit-testing 46 | - (NSString *)humanReadableDescriptionShouldLocalize:(BOOL)shouldLocalize; 47 | 48 | @property (nonatomic, readonly) GPGValidity trust; 49 | @property (nonatomic, readonly) GPGErrorCode status; 50 | @property (nonatomic, readonly) NSString *fingerprint; 51 | @property (nonatomic, readonly) NSDate *creationDate; 52 | @property (nonatomic, readonly) NSDate *expirationDate; 53 | @property (nonatomic, readonly) int version; 54 | @property (nonatomic, readonly) GPGPublicKeyAlgorithm publicKeyAlgorithm; 55 | @property (nonatomic, readonly) GPGHashAlgorithm hashAlgorithm; 56 | @property (nonatomic, readonly) int signatureClass; 57 | 58 | @property (nonatomic, readonly) GPGKey *primaryKey; 59 | @property (atomic, retain, readwrite) GPGKey *key; 60 | @property (nonatomic, readonly) NSString *primaryFingerprint; 61 | 62 | @property (nonatomic, readonly) NSString *userIDDescription; 63 | @property (nonatomic, readonly) NSString *name; 64 | @property (nonatomic, readonly) NSString *email; 65 | @property (nonatomic, readonly) NSString *comment; 66 | @property (nonatomic, readonly) NSImage *image; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Source/GPGStatusLine.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGStatusLine.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 30.05.18. 6 | // 7 | 8 | @interface GPGStatusLine : NSObject 9 | @property (readonly, nonatomic) NSString *keyword; 10 | @property (readonly, nonatomic) NSInteger code; 11 | @property (readonly, nonatomic) NSArray *parts; 12 | 13 | + (instancetype)statusLineWithKeyword:(NSString *)keyword code:(NSInteger)code parts:(NSArray *)parts; 14 | - (instancetype)initWithKeyword:(NSString *)keyword code:(NSInteger)code parts:(NSArray *)parts; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Source/GPGStatusLine.m: -------------------------------------------------------------------------------- 1 | // 2 | // GPGStatusLine.m 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 30.05.18. 6 | // 7 | 8 | #import "GPGStatusLine.h" 9 | 10 | @implementation GPGStatusLine 11 | 12 | + (instancetype)statusLineWithKeyword:(NSString *)keyword code:(NSInteger)code parts:(NSArray *)parts { 13 | return [[[self alloc] initWithKeyword:keyword code:code parts:parts] autorelease]; 14 | } 15 | 16 | - (instancetype)initWithKeyword:(NSString *)keyword code:(NSInteger)code parts:(NSArray *)parts { 17 | self = [super init]; 18 | if (!self) { 19 | return nil; 20 | } 21 | 22 | _keyword = [keyword copy]; 23 | _code = code; 24 | _parts = [parts copy]; 25 | 26 | return self; 27 | } 28 | 29 | - (void)dealloc { 30 | [_keyword release]; 31 | [_parts release]; 32 | [super dealloc]; 33 | } 34 | 35 | - (NSString *)description { 36 | return [NSString stringWithFormat:@"%li %@ %@", (long)self.code, self.keyword, self.parts]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Source/GPGStdSetting.h: -------------------------------------------------------------------------------- 1 | /* 2 | GPGStdSetting.h 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | 23 | @class GPGConfReader; 24 | 25 | // Represents an options line from .conf for a boolean or simple string option. 26 | // E.g., "no-auto-key-locate" 27 | // E.g., "compress-level 5" 28 | @interface GPGStdSetting : NSObject { 29 | BOOL isActive_; 30 | NSMutableString * firstComment_; 31 | BOOL endComments_; 32 | NSMutableString * raw_; // as read from .conf 33 | id value_; 34 | NSString *key_; 35 | } 36 | 37 | // Get or set the option key 38 | @property (nonatomic, copy, readwrite) NSString *key; 39 | 40 | // Get or set a value indicating whether the option is active; 41 | // (If not active, the option may still exist in configuration, but in a deactivated 42 | // state—e.g., prefixed by a '#') 43 | @property (nonatomic, setter=setIsActive:) BOOL isActive; 44 | 45 | // Designated initializer. isActive will be FALSE 46 | - (id) initForKey:(NSString *)key; 47 | 48 | // Get a new block of text encoding the setting. If no change 49 | // has been made via setComment or setValue, then this should reflect 50 | // the raw configuration as read from .conf; otherwise, it will return 51 | // a block of configuration text built from comment and encodeValue. 52 | // 53 | // The value includes line breaks and a trailing line break. 54 | - (NSString *) description; 55 | 56 | // Set a comment for the instance, overwriting any comments read while parsing 57 | - (void) setComment:(NSString *)comment; 58 | 59 | // Get the value (possibly nil) for the setting 60 | - (id) value; 61 | 62 | // Set a value for the instance, overwriting any value read while parsing. 63 | // Subclasses should implement for their specific value type. 64 | // isActive will be set to TRUE. 65 | - (void) setValue:(id)value; 66 | 67 | // Get a new block of text encoding the value. 68 | // 69 | // E.g., "#no-encrypt-to" 70 | // E.g., "keyserver hkp://blahblah.com 71 | // 72 | // Subclasses should implement for their specific value type 73 | - (NSString *) encodeValue; 74 | 75 | // Used when parsing .conf to add a configuration line to the setting 76 | - (void) appendLine:(NSString *)line withReader:(GPGConfReader *)reader; 77 | 78 | // Used when parsing .conf to incorporate the split elements of a configuration line. 79 | // Called by appendLine:withReader:; shouldn't be used directly. 80 | // Subclasses should implement for their specific value type 81 | - (void) incorporate:(NSString *)setting forFullKey:(NSString *)fullKey; 82 | 83 | // Values may not contain \n chars, so those are replaced. 84 | // Other invalid chars might also be removed at a later point. 85 | - (NSString *)sanitizedValueForValue:(NSString *)value; 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Source/GPGStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGStream.h 3 | // Libmacgpg 4 | // 5 | // Created by Chris Fraire on 5/21/12. 6 | // Copyright (c) 2012 Chris Fraire. All rights reserved. 7 | // 8 | 9 | 10 | 11 | // Abstract class for writing buffered data to a managed location 12 | @interface GPGStream : NSObject 13 | 14 | // append the specified data to the stream 15 | - (void)writeData:(NSData *)data; 16 | 17 | // read in to memory all the data from the current position to the end 18 | - (NSData *)readDataToEndOfStream; 19 | // read in to memory from the current position up to the specified length 20 | - (NSData *)readDataOfLength:(NSUInteger)length; 21 | // (re)read all data from the stream 22 | - (NSData *)readAllData; 23 | /** 24 | Read the next byte from the stream. 25 | @returns The next byte or EOF. 26 | */ 27 | - (NSInteger)readByte; 28 | // return the character at the next position, without advancing position 29 | - (char)peekByte; 30 | 31 | // close the stream's underlying representation, when applicable 32 | - (void)close; 33 | // flush the underlying representation, when applicable 34 | - (void)flush; 35 | // seek the underlying representation back to the beginning; 36 | // for a writeable stream, this truncates all data 37 | - (void)seekToBeginning; 38 | // seek the underlying representation to the given offset; 39 | // for a writeable stream, this truncates to the given offeset 40 | - (void)seekToOffset:(NSUInteger)offset; 41 | // the current offset in the stream. 42 | - (NSUInteger)offset; 43 | 44 | // readable streams may indicate total length; 45 | // writeable streams may indicate length written; 46 | - (unsigned long long)length; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Source/GPGStream.m: -------------------------------------------------------------------------------- 1 | // 2 | // GPGStream.m 3 | // Libmacgpg 4 | // 5 | // Created by Chris Fraire on 5/21/12. 6 | // Copyright (c) 2012 Chris Fraire. All rights reserved. 7 | // 8 | 9 | #import "GPGStream.h" 10 | 11 | @implementation GPGStream 12 | 13 | - (void)writeData:(NSData *)data { 14 | // nothing 15 | } 16 | 17 | - (NSData *)readDataToEndOfStream { 18 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 19 | } 20 | 21 | - (NSData *)readDataOfLength:(NSUInteger)length { 22 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 23 | } 24 | 25 | - (NSData *)readAllData { 26 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 27 | } 28 | 29 | - (NSInteger)readByte { 30 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 31 | } 32 | 33 | - (char)peekByte { 34 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 35 | } 36 | 37 | - (void)close { 38 | // nothing 39 | } 40 | 41 | - (void)flush { 42 | // nothing 43 | } 44 | 45 | - (void)seekToBeginning { 46 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 47 | } 48 | - (void)seekToOffset:(NSUInteger)offset { 49 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 50 | } 51 | - (NSUInteger)offset { 52 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 53 | return NSIntegerMax; 54 | } 55 | 56 | - (unsigned long long)length { 57 | @throw [NSException exceptionWithName:@"NotImplementedException" reason:@"abstract method" userInfo:nil]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Source/GPGTaskOrder.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | 22 | 23 | enum { 24 | NoDefaultAnswer = 0, 25 | YesToAll, 26 | NoToAll 27 | }; 28 | typedef uint8_t BoolAnswer; 29 | 30 | @interface GPGTaskOrder : NSObject { 31 | uint8_t defaultBoolAnswer; 32 | 33 | NSMutableArray *items; 34 | NSUInteger index; 35 | } 36 | 37 | @property (nonatomic) uint8_t defaultBoolAnswer; 38 | 39 | // prompt is an NSString or NSArray! 40 | - (void)addCmd:(NSString *)cmd prompt:(id)prompt; 41 | - (void)addInt:(NSInteger)cmd prompt:(id)prompt; 42 | - (void)addOptionalCmd:(NSString *)cmd prompt:(id)prompt; 43 | - (void)addOptionalInt:(NSInteger)cmd prompt:(id)prompt; 44 | - (void)addCmd:(NSString *)cmd prompt:(id)prompt optional:(BOOL)optional; 45 | - (void)addInt:(NSInteger)cmd prompt:(id)prompt optional:(BOOL)optional; 46 | 47 | - (NSString *)cmdForPrompt:(id)prompt statusCode:(NSInteger)statusCode; 48 | 49 | + (id)order; 50 | + (id)orderWithYesToAll; 51 | + (id)orderWithNoToAll; 52 | - (id)initWithYesToAll; 53 | - (id)initWithNoToAll; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Source/GPGTaskOrder.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import "GPGTaskOrder.h" 21 | #import "GPGGlobals.h" 22 | 23 | @implementation GPGTaskOrder 24 | @synthesize defaultBoolAnswer; 25 | 26 | 27 | + (id)order { 28 | return [[[self alloc] init] autorelease]; 29 | } 30 | + (id)orderWithYesToAll { 31 | return [[[self alloc] initWithYesToAll] autorelease]; 32 | } 33 | + (id)orderWithNoToAll { 34 | return [[[self alloc] initWithNoToAll] autorelease]; 35 | } 36 | 37 | - (id)initWithDefaultBoolAnswer:(uint8_t)answer { 38 | if (self = [super init]) { 39 | items = [[NSMutableArray alloc] init]; 40 | self.defaultBoolAnswer = answer; 41 | } 42 | return self; 43 | } 44 | 45 | - (id)initWithYesToAll { 46 | return [self initWithDefaultBoolAnswer:YesToAll]; 47 | } 48 | - (id)initWithNoToAll { 49 | return [self initWithDefaultBoolAnswer:NoToAll]; 50 | } 51 | - (id)init { 52 | return [self initWithDefaultBoolAnswer:NoDefaultAnswer]; 53 | } 54 | 55 | - (void)dealloc { 56 | [items release]; 57 | [super dealloc]; 58 | } 59 | 60 | 61 | - (void)addCmd:(NSString *)cmd prompt:(id)prompt { 62 | [self addCmd:cmd prompt:prompt optional:NO]; 63 | } 64 | - (void)addInt:(NSInteger)cmd prompt:(id)prompt { 65 | [self addInt:cmd prompt:prompt optional:NO]; 66 | } 67 | - (void)addOptionalCmd:(NSString *)cmd prompt:(id)prompt { 68 | [self addCmd:cmd prompt:prompt optional:YES]; 69 | } 70 | - (void)addOptionalInt:(NSInteger)cmd prompt:(id)prompt { 71 | [self addInt:cmd prompt:prompt optional:YES]; 72 | } 73 | - (void)addCmd:(NSString *)cmd prompt:(id)prompt optional:(BOOL)optional { 74 | [items addObject:[NSDictionary dictionaryWithObjectsAndKeys:cmd ? cmd : @"", @"cmd", prompt, @"prompt", [NSNumber numberWithBool:optional], @"optional", nil]]; 75 | } 76 | - (void)addInt:(NSInteger)cmd prompt:(id)prompt optional:(BOOL)optional { 77 | [items addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%li\n", (long)cmd], @"cmd", prompt, @"prompt", [NSNumber numberWithBool:optional], @"optional", nil]]; 78 | } 79 | 80 | 81 | 82 | - (NSString *)cmdForPrompt:(NSString *)prompt statusCode:(NSInteger)statusCode { 83 | Class stringClass = [NSString class]; 84 | Class arrayClass = [NSArray class]; 85 | 86 | NSUInteger count = [items count]; 87 | for (NSUInteger i = index; i < count; i++) { 88 | NSDictionary *item = [items objectAtIndex:i]; 89 | id myPrompt = [item objectForKey:@"prompt"]; 90 | 91 | if (([myPrompt isKindOfClass:stringClass] && [myPrompt isEqualToString:prompt]) || ([myPrompt isKindOfClass:arrayClass] && [myPrompt containsObject:prompt])) { 92 | index = i + 1; 93 | return [item objectForKey:@"cmd"]; 94 | } else if ([[item objectForKey:@"optional"] boolValue] == NO) { 95 | break; 96 | } 97 | } 98 | if (statusCode == GPG_STATUS_GET_BOOL) { 99 | switch (defaultBoolAnswer) { 100 | case YesToAll: 101 | return @"y\n"; 102 | case NoToAll: 103 | return @"n\n"; 104 | } 105 | } 106 | return nil; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Source/GPGTask_Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGTask_Private.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 12.06.18. 6 | // 7 | 8 | @interface GPGTask () 9 | 10 | @property (nonatomic, retain) NSData *errData; 11 | @property (nonatomic, retain) NSData *statusData; 12 | @property (nonatomic, retain) NSData *attributeData; 13 | @property (nonatomic) int errorCode; 14 | 15 | - (void)unsetErrorCode:(int)value; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /Source/GPGTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | 22 | 23 | @interface GPGKeyAlgorithmNameTransformer : NSValueTransformer { 24 | BOOL _keepUnlocalized; // default NO; used for Unit Testing 25 | } 26 | // default NO 27 | @property (nonatomic, assign) BOOL keepUnlocalized; 28 | 29 | - (id)transformedIntegerValue:(NSInteger)value; 30 | @end 31 | 32 | @interface GPGHashAlgorithmNameTransformer : NSValueTransformer { 33 | BOOL _keepUnlocalized; // default NO; used for Unit Testing 34 | } 35 | // default NO 36 | @property (nonatomic, assign) BOOL keepUnlocalized; 37 | 38 | - (id)transformedIntegerValue:(NSInteger)value; 39 | @end 40 | 41 | @interface GPGValidityDescriptionTransformer : NSValueTransformer { 42 | BOOL _keepUnlocalized; // default NO; used for Unit Testing 43 | } 44 | // default NO 45 | @property (nonatomic, assign) BOOL keepUnlocalized; 46 | @end 47 | 48 | @interface GPGFingerprintTransformer : NSValueTransformer { 49 | BOOL _keepUnlocalized; // default NO; used for Unit Testing 50 | } 51 | // default NO 52 | @property (nonatomic, assign) BOOL keepUnlocalized; 53 | @end 54 | 55 | @interface GPGNoBreakFingerprintTransformer : GPGFingerprintTransformer 56 | + (id)sharedInstance; 57 | @end 58 | 59 | 60 | DEPRECATED_ATTRIBUTE @interface SplitFormatter : NSFormatter { 61 | NSInteger blockSize; 62 | } 63 | @property (nonatomic) NSInteger blockSize; 64 | @end 65 | 66 | 67 | @interface NSNumber (GPGValidityCompare) 68 | // Compare two GPGValidity NSNumbers. 69 | - (NSComparisonResult)compareGPGValidity:(NSNumber *)otherNumber; 70 | @end 71 | 72 | -------------------------------------------------------------------------------- /Source/GPGUTF8Argument.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGUTF8Argument.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 25.07.18. 6 | // 7 | 8 | #import 9 | 10 | @interface GPGUTF8Argument : NSString 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Source/GPGUTF8Argument.m: -------------------------------------------------------------------------------- 1 | // 2 | // GPGUTF8Argument.m 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 25.07.18. 6 | // 7 | 8 | #import "GPGUTF8Argument.h" 9 | 10 | @interface GPGUTF8Argument () 11 | @property (nonatomic, strong) NSString *realString; 12 | @end 13 | 14 | @implementation GPGUTF8Argument 15 | - (const char *)fileSystemRepresentation { 16 | // Return the string as a utf-8 encoded string, because gpg wants utf-8 encoded umlauts. 17 | return self.realString.UTF8String; 18 | } 19 | - (instancetype)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer { 20 | self = [super init]; 21 | if (self) { 22 | self.realString = [[[NSString alloc] initWithCharactersNoCopy:characters length:length freeWhenDone:freeBuffer] autorelease]; 23 | } 24 | return self; 25 | } 26 | - (NSUInteger)length { 27 | return self.realString.length; 28 | } 29 | - (unichar)characterAtIndex:(NSUInteger)index { 30 | return [self.realString characterAtIndex:index]; 31 | } 32 | - (void)dealloc { 33 | self.realString = nil; 34 | [super dealloc]; 35 | } 36 | @end 37 | -------------------------------------------------------------------------------- /Source/GPGUnArmor.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | 6 | 7 | @interface GPGUnArmor : NSObject { 8 | GPGStream *stream; 9 | 10 | // Cache 11 | NSMutableData *cacheData; 12 | const UInt8 *cacheBytes; 13 | NSUInteger cacheIndex; 14 | NSUInteger cacheEnd; 15 | NSUInteger streamOffset; 16 | NSUInteger maxBytesToRead; 17 | 18 | // State vars for parsing. 19 | NSMutableData *base64Data; 20 | NSMutableIndexSet *possibleStarts; 21 | BOOL preferAlternative; 22 | NSUInteger alternativeStart; 23 | BOOL invalidCharInLine; 24 | 25 | NSInteger equalsAdded; 26 | BOOL haveCRC; 27 | UInt8 crcBytes[4]; 28 | BOOL crLineEnding; 29 | 30 | 31 | // Properties 32 | NSError *error; 33 | NSData *clearText; 34 | NSData *data; 35 | BOOL eof; 36 | } 37 | 38 | @property (nonatomic, readonly, strong) NSError *error; 39 | @property (nonatomic, readonly, strong) NSData *clearText; 40 | @property (nonatomic, readonly, strong) NSData *data; 41 | @property (nonatomic, readonly) BOOL eof; 42 | 43 | 44 | /** 45 | * Decodes and returns all packets in the stream. 46 | * If the input is not armored, it returns the original data from the stream. 47 | * 48 | * @param clear Upon return contains the clear-text, if any. Pass NULL if you do not want the clear-text. 49 | * @param error If an error occurs, upon return contains an NSError object that describes the problem. Pass NULL if you do not want error information. 50 | * @return A GPGStream containing the decoded data or the original stream, if the input wasn't armored. 51 | */ 52 | + (GPGStream *)unArmor:(GPGStream *)stream clearText:(NSData **)clearText error:(NSError **)error; 53 | 54 | /** 55 | * Decodes and returns all packets in the stream. 56 | * If the input is not armored, it returns the original data from the stream. 57 | * 58 | * @param clear Upon return contains the clear-text, if any. Pass NULL if you do not want the clear-text. 59 | * @return A GPGStream containing the decoded data or the original stream, if the input wasn't armored. 60 | */ 61 | + (GPGStream *)unArmor:(GPGStream *)stream clearText:(NSData **)clearText; 62 | 63 | /** 64 | * Decodes and returns all packets in the stream. 65 | * If the input is not armored, it returns the original data from the stream. 66 | * 67 | * @return A GPGStream containing the decoded data or the original stream, if the input wasn't armored. 68 | */ 69 | + (GPGStream *)unArmor:(GPGStream *)stream; 70 | 71 | 72 | 73 | 74 | 75 | + (instancetype)unArmorWithGPGStream:(GPGStream *)theStream; 76 | - (instancetype)initWithGPGStream:(GPGStream *)stream; 77 | 78 | /** 79 | * Decodes and returns the next armored packet in the stream. 80 | * 81 | * @return The decoded data or NULL if the input wasn't armored. 82 | */ 83 | - (NSData *)decodeNext; 84 | 85 | /** 86 | * Decodes and returns all packets in the stream. 87 | * 88 | * @return The decoded data or NULL if the input wasn't armored. 89 | */ 90 | - (NSData *)decodeAll; 91 | 92 | /** 93 | * Decodes and returns only the beginning of the stream. 94 | * Do not call this method before or after another decode method. 95 | * 96 | * @return The decoded data or NULL if the input wasn't armored. 97 | */ 98 | - (NSData *)decodeHeader; 99 | 100 | 101 | @end 102 | 103 | @interface GPGStream (IsArmoredExtension) 104 | - (BOOL)isArmored; 105 | @end 106 | @interface NSData (IsArmoredExtension) 107 | - (BOOL)isArmored; 108 | @end 109 | 110 | -------------------------------------------------------------------------------- /Source/GPGUpdateController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateController.h 3 | // GPGPreferences 4 | // 5 | // Created by Mento on 26.04.2013 6 | // 7 | // 8 | 9 | @class GPGOptions; 10 | @interface GPGUpdateController : NSObject { 11 | GPGOptions *_options; 12 | } 13 | @property BOOL automaticallyChecksForUpdates; 14 | @property BOOL downloadBetaUpdates; 15 | 16 | - (IBAction)checkForUpdates:(id)sender; 17 | - (IBAction)showReleaseNotes:(id)sender; 18 | 19 | + (instancetype)sharedInstance; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Source/GPGUserDefaults.h: -------------------------------------------------------------------------------- 1 | /* GPGUserDefaults.h created by Lukas Pitschl (@lukele) on Thu 25-Apr-2014 */ 2 | 3 | /* 4 | * Copyright (c) 2000-2017, GPGTools Team 5 | * All rights reserved. 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of GPGTools Team nor the names of GPGMail 15 | * contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE GPGTools Team ``AS IS'' AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE GPGTools Project Team BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | @interface GPGUserDefaults : NSObject { 33 | NSUserDefaults *_target; 34 | } 35 | 36 | + (GPGUserDefaults *)standardUserDefaults; 37 | - (NSDictionary *)persistentDomainForName:(NSString *)domainName; 38 | - (void)setPersistentDomain:(NSDictionary *)domain forName:(NSString *)domainName; 39 | 40 | @property (nonatomic, retain) NSUserDefaults *target; 41 | 42 | @end 43 | 44 | @interface GPGUserDefaults (NotImplemented) 45 | 46 | - (id)objectForKey:(id)key; 47 | - (void)setObject:(id)object forKey:(id)key; 48 | - (void)synchronize; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Source/GPGUserDefaults.m: -------------------------------------------------------------------------------- 1 | /* GPGUserDefaults.m created by Lukas Pitschl (@lukele) on Thu 25-Apr-2014 */ 2 | 3 | /* 4 | * Copyright (c) 2000-2017, GPGTools Team 5 | * All rights reserved. 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of GPGTools Team nor the names of GPGMail 15 | * contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE GPGTools Team ``AS IS'' AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE GPGTools Project Team BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSBundle+Sandbox.h" 31 | #import "GPGTaskHelper.h" 32 | #import "GPGTaskHelperXPC.h" 33 | #import "GPGUserDefaults.h" 34 | #import "GPGTask.h" 35 | 36 | @implementation GPGUserDefaults 37 | 38 | @synthesize target=_target; 39 | 40 | + (GPGUserDefaults *)standardUserDefaults { 41 | static GPGUserDefaults *_sharedInstance; 42 | static dispatch_once_t onceToken; 43 | dispatch_once(&onceToken, ^{ 44 | _sharedInstance = [[GPGUserDefaults alloc] init]; 45 | }); 46 | return _sharedInstance; 47 | } 48 | 49 | - (id)init { 50 | self = [super init]; 51 | if(self) { 52 | _target = [NSUserDefaults standardUserDefaults]; 53 | } 54 | return self; 55 | } 56 | 57 | - (id)forwardingTargetForSelector:(SEL)aSelector { 58 | return _target; 59 | } 60 | 61 | - (NSDictionary *)persistentDomainForName:(NSString *)domainName { 62 | // Sandbox is not enabled? No need to go through the XPC. 63 | if(![GPGTask sandboxed]) 64 | return [_target persistentDomainForName:domainName]; 65 | 66 | // Otherwise, no way around it. XPC is necessary, but no 67 | // big deal either. 68 | GPGTaskHelperXPC *taskHelper = [[GPGTaskHelperXPC alloc] init]; 69 | 70 | NSDictionary *defaults = nil; 71 | 72 | @try { 73 | defaults = [taskHelper loadUserDefaultsForName:domainName]; 74 | } 75 | @catch (NSException *exception) { 76 | } 77 | @finally { 78 | [taskHelper release]; 79 | } 80 | 81 | return defaults; 82 | } 83 | 84 | - (void)setPersistentDomain:(NSDictionary *)domain forName:(NSString *)domainName { 85 | // Sandbox is not enabled? No need to go through the XPC. 86 | if(![GPGTask sandboxed]) { 87 | [_target setPersistentDomain:domain forName:domainName]; 88 | return; 89 | } 90 | 91 | GPGTaskHelperXPC *taskHelper = [[GPGTaskHelperXPC alloc] init]; 92 | 93 | @try { 94 | [taskHelper setUserDefaults:domain forName:domainName]; 95 | } 96 | @catch (NSException *exception) { 97 | } 98 | @finally { 99 | [taskHelper release]; 100 | } 101 | } 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /Source/GPGUserID.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister und Lukas Pitschl (@lukele), 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | 22 | @class GPGKey, NSImage, GPGUserIDSignature; 23 | 24 | 25 | @protocol GPGUserIDProtocol 26 | @property (nonatomic, readonly) NSString *userIDDescription; 27 | @property (nonatomic, readonly) NSString *name; 28 | @property (nonatomic, readonly) NSString *email; 29 | @property (nonatomic, readonly) NSString *comment; 30 | @property (nonatomic, readonly) NSImage *image; 31 | @end 32 | 33 | 34 | @interface GPGUserID : NSObject { 35 | NSString *_userIDDescription; 36 | NSString *_name; 37 | NSString *_email; 38 | NSString *_comment; 39 | NSString *_hashID; 40 | NSImage *_image; 41 | NSDate *_creationDate; 42 | NSDate *_expirationDate; 43 | GPGValidity _validity; 44 | 45 | GPGKey *_primaryKey; 46 | NSArray *_signatures; 47 | GPGUserIDSignature *_revocationSignature; 48 | 49 | } 50 | 51 | - (instancetype)init; 52 | - (instancetype)initWithUserIDDescription:(NSString *)userIDDescription; 53 | 54 | @property (nonatomic, readonly) NSString *userIDDescription; 55 | @property (nonatomic, readonly) NSString *name; 56 | @property (nonatomic, readonly) NSString *email; 57 | @property (nonatomic, readonly) NSString *comment; 58 | @property (nonatomic, readonly) NSString *hashID; 59 | @property (nonatomic, readonly) NSImage *image; 60 | @property (nonatomic, readonly) NSDate *creationDate; 61 | @property (nonatomic, readonly) NSDate *expirationDate; 62 | @property (nonatomic, readonly) GPGValidity validity; 63 | 64 | @property (nonatomic, readonly) NSArray *signatures; 65 | @property (nonatomic, readonly) GPGUserIDSignature *selfSignature; 66 | @property (nonatomic, readonly) GPGUserIDSignature *revocationSignature; 67 | @property (nonatomic, readonly) GPGKey *primaryKey; 68 | 69 | @property (nonatomic, readonly) BOOL mdcSupport; 70 | @property (nonatomic, readonly) BOOL isUat; 71 | 72 | @end 73 | 74 | -------------------------------------------------------------------------------- /Source/GPGUserIDSignature.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister und Lukas Pitschl (@lukele), 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @class GPGKey; 24 | 25 | 26 | @interface GPGUserIDSignature : NSObject { 27 | NSString *_keyID; 28 | GPGPublicKeyAlgorithm _algorithm; 29 | GPGHashAlgorithm _hashAlgorithm; 30 | NSDate *_creationDate; 31 | NSDate *_expirationDate; 32 | NSString *_reason; 33 | int _signatureClass; 34 | BOOL _revocation; 35 | BOOL _local; 36 | 37 | GPGKey *_primaryKey; 38 | 39 | NSUInteger _hash; 40 | } 41 | 42 | - (instancetype)init; 43 | - (instancetype)initWithKeyID:(NSString *)keyID; 44 | 45 | @property (nonatomic, readonly) NSString *keyID; 46 | @property (nonatomic, readonly) GPGPublicKeyAlgorithm algorithm; 47 | @property (nonatomic, readonly) GPGHashAlgorithm hashAlgorithm; 48 | @property (nonatomic, readonly) NSDate *creationDate; 49 | @property (nonatomic, readonly) NSDate *expirationDate; 50 | @property (nonatomic, readonly) NSString *reason; 51 | @property (nonatomic, readonly) int signatureClass; 52 | @property (nonatomic, readonly) BOOL revocation; 53 | @property (nonatomic, readonly) BOOL local; 54 | @property (nonatomic, readonly) BOOL mdcSupport; 55 | @property (nonatomic, readonly) GPGValidity validity; 56 | @property (nonatomic, readonly) BOOL selfSignature; 57 | 58 | 59 | @property (nonatomic, readonly) GPGKey *primaryKey; 60 | 61 | @property (nonatomic, readonly) NSString *userIDDescription; 62 | @property (nonatomic, readonly) NSString *name; 63 | @property (nonatomic, readonly) NSString *email; 64 | @property (nonatomic, readonly) NSString *comment; 65 | @property (nonatomic, readonly) NSImage *image; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Source/GPGVerifyingKeyserver.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGVerifyingKeyserver.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 24.06.19. 6 | // 7 | 8 | #import 9 | 10 | // Callbacks for the different methods. If error is set, all other arguments are nil. 11 | typedef void (^GPGVKSUploadCallback)(NSArray *fingerprints, NSDictionary *status, NSString *token, NSError *error); 12 | typedef void (^GPGVKSSearchCallback)(NSArray *foundKeys, NSError *error); 13 | typedef void (^GPGVKSDownloadCallback)(NSData *keyData, NSError *error); 14 | 15 | 16 | // Possible states of an userIDs on the server. 17 | extern NSString * const GPGVKSStateUnpublished; 18 | extern NSString * const GPGVKSStatePending; 19 | extern NSString * const GPGVKSStatePublished; 20 | extern NSString * const GPGVKSStateRevoked; 21 | 22 | 23 | @interface GPGVerifyingKeyserver : NSObject 24 | @property (strong, nonatomic) NSString *keyserver; // Default keyserver is @"https://keys.openpgp.org". 25 | @property (nonatomic) NSUInteger timeout; // Default timeout is 20 seconds. 26 | 27 | 28 | /** 29 | * Upload a key to the keyserver. 30 | * 31 | * @param armored contains a single ASCII-armored key. (If more the one key is passed, the email verification will not work) 32 | * @param callback is called when the upload has finished or failed 33 | */ 34 | 35 | - (void)uploadKey:(NSString *)armored callback:(GPGVKSUploadCallback)callback; 36 | 37 | 38 | /** 39 | * Request the server to verify some email-addresses. 40 | * 41 | * @param emailAddresses is a list of email-addresses to verify 42 | * @param token is the token returned by the callback from -uploadKey:callback: 43 | * @param callback is called when the request has finished or failed 44 | */ 45 | - (void)requestVerification:(NSArray *)emailAddresses token:(NSString *)token callback:(GPGVKSUploadCallback)callback; 46 | 47 | 48 | /** 49 | * Searches for one or more keys on the server. 50 | * 51 | * @param searchTerms is a list of e-mail-addresses, fingerprints or keyIDs. 52 | * @param callback is called when the search has finished or failed 53 | */ 54 | - (void)searchKeys:(NSArray *)searchTerms callback:(GPGVKSSearchCallback)callback; 55 | 56 | 57 | /** 58 | * Downloads for one or more keys from the server. 59 | * 60 | * @param identifiers is a list of e-mail-addresses, fingerprints or keyIDs. 61 | * @param callback is called when the search has finished or failed 62 | */ 63 | - (void)downloadKeys:(NSArray *)identifiers callback:(GPGVKSDownloadCallback)callback; 64 | 65 | 66 | @end 67 | 68 | -------------------------------------------------------------------------------- /Source/GPGWatcher.h: -------------------------------------------------------------------------------- 1 | #import "JailfreeProtocol.h" 2 | #import "DirectoryWatcher.h" 3 | 4 | extern NSString * const GPGKeysChangedNotification; 5 | 6 | @interface GPGWatcher : NSObject = 1080 8 | , Jail 9 | #endif 10 | > { 11 | DirectoryWatcher *dirWatcher; 12 | // for pubring and secring 13 | NSTimeInterval lastKnownChange; // Zeitpunkt der letzten Änderung durch eine Libmacgpg instanz. 14 | // for .conf 15 | NSTimeInterval lastConfKnownChange; 16 | 17 | NSString *identifier; 18 | NSMutableDictionary *changeDates; 19 | NSDictionary *filesToWatch; 20 | NSString *gpgSpecifiedHome; 21 | 22 | NSTimeInterval toleranceBefore; 23 | NSTimeInterval toleranceAfter; 24 | #if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 25 | NSXPCConnection *jailfree; 26 | #endif 27 | BOOL _checkForSandbox; 28 | } 29 | 30 | // default is 1.0 31 | @property (nonatomic, assign) NSTimeInterval toleranceBefore; 32 | // default is 1.0 33 | @property (nonatomic, assign) NSTimeInterval toleranceAfter; 34 | #if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 35 | @property (nonatomic, retain) NSXPCConnection *jailfree; 36 | #endif 37 | + (id)sharedInstance; 38 | + (void)activate; 39 | 40 | // really for unit testing. Use sharedInstance normally! 41 | - (id)initWithGpgHome:(NSString *)directoryPath; 42 | 43 | @property (nonatomic, assign) BOOL checkForSandbox; 44 | 45 | + (void)activateWithXPCConnection:(id)connection; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Source/JailfreeProtocol.h: -------------------------------------------------------------------------------- 1 | /* JailfreeProtocol.h created by Lukas Pitschl (@lukele) on Tue 23-Apr-2014 */ 2 | 3 | /* 4 | * Copyright (c) 2000-2017, GPGTools Team 5 | * All rights reserved. 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of GPGTools Team nor the names of GPGMail 15 | * contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE GPGTools Team ``AS IS'' AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE GPGTools Project Team BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | @protocol Jailfree 33 | 34 | - (void)testConnection:(void (^)(BOOL))reply; 35 | - (void)launchGPGWithArguments:(NSArray *)arguments data:(NSData *)data readAttributes:(BOOL)readAttributes closeInput:(BOOL)closeInput reply:(void (^)(NSDictionary *))reply; 36 | - (void)launchGeneralTask:(NSString *)path withArguments:(NSArray *)arguments wait:(BOOL)wait reply:(void (^)(BOOL))reply; 37 | 38 | - (void)startGPGWatcher; 39 | - (void)loadConfigFileAtPath:(NSString *)path reply:(void (^)(NSString *))reply; 40 | - (void)loadUserDefaultsForName:(NSString *)domainName reply:(void (^)(NSDictionary *))reply; 41 | - (void)setUserDefaults:(NSDictionary *)domain forName:(NSString *)domainName reply:(void (^)(BOOL result))reply; 42 | - (void)isPassphraseForKeyInGPGAgentCache:(NSString *)key reply:(void (^)(BOOL result))reply; 43 | - (void)validSupportContractAvailableForProduct:(NSString *)identifier reply:(void (^)(BOOL, NSDictionary *))reply; 44 | - (void)startTrialWithReply:(void (^)(BOOL))reply; 45 | - (void)activateProductWithEmail:(NSString *)email activationCode:(NSString *)activationCode reply:(void (^)(BOOL, NSError *))reply; 46 | - (void)deactivateSupportPlanWithCompletion:(void (^)(BOOL, NSError *))reply; 47 | 48 | - (void)showGPGSuitePreferencesWithArguments:(NSDictionary *)arguments reply:(void (^)(BOOL result))reply; 49 | 50 | @end 51 | 52 | @protocol Jail 53 | 54 | @optional 55 | - (void)processStatusWithKey:(NSString *)keyword value:(NSString *)value reply:(void (^)(NSData *response))reply; 56 | - (void)progress:(NSUInteger)processedBytes total:(NSUInteger)total; 57 | - (void)postNotificationName:(NSString *)name object:(NSString *)object; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Source/Libmacgpg.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © Roman Zechmeister, 2017 3 | 4 | Diese Datei ist Teil von Libmacgpg. 5 | 6 | Libmacgpg ist freie Software. Sie können es unter den Bedingungen 7 | der GNU General Public License, wie von der Free Software Foundation 8 | veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß 9 | Version 3 der Lizenz oder (nach Ihrer Option) jeder späteren Version. 10 | 11 | Die Veröffentlichung von Libmacgpg erfolgt in der Hoffnung, daß es Ihnen 12 | von Nutzen sein wird, aber ohne irgendeine Garantie, sogar ohne die implizite 13 | Garantie der Marktreife oder der Verwendbarkeit für einen bestimmten Zweck. 14 | Details finden Sie in der GNU General Public License. 15 | 16 | Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem 17 | Programm erhalten haben. Falls nicht, siehe . 18 | */ 19 | 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | #import 54 | #import 55 | 56 | -------------------------------------------------------------------------------- /Source/Libmacgpg_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Libmacgpg' target in the 'Libmacgpg' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Source/NSBundle+GPGLocalization.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGLocalizationBundle.h 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 02.02.2017 6 | // 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSBundle (GPGLocalization) 13 | 14 | /** 15 | * By default a sub-bundle only uses those localizations which are also in the main bundle. 16 | * Call this method on a sub-bundle to allow more localizations. 17 | */ 18 | - (void)useGPGLocalizations; 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /Source/NSBundle+GPGLocalization.m: -------------------------------------------------------------------------------- 1 | // 2 | // GPGLocalizationBundle.m 3 | // Libmacgpg 4 | // 5 | // Created by Mento on 02.02.2017 6 | // 7 | // 8 | 9 | #import "NSBundle+GPGLocalization.h" 10 | #import 11 | 12 | @interface GPGLocalizationBundle : NSBundle 13 | @end 14 | @implementation GPGLocalizationBundle 15 | 16 | /* 17 | * By default GPGMail is not able to use any localization nor present in Mail.app. 18 | * This method uses the ser preferred localization available in GPGMail, ignoring the default behavior. 19 | */ 20 | - (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName { 21 | static dispatch_once_t onceToken; 22 | static NSBundle *localizationBundle = nil; 23 | dispatch_once(&onceToken, ^{ 24 | NSArray *preferredLocalizations = [NSBundle preferredLocalizationsFromArray:[self localizations] forPreferences:nil]; 25 | NSArray *usedLocalizations = [self preferredLocalizations]; 26 | 27 | if (preferredLocalizations.count > 0 && usedLocalizations.count > 0 && ![preferredLocalizations[0] isEqualToString:usedLocalizations[0]]) { 28 | localizationBundle = [NSBundle bundleWithPath:[self pathForResource:preferredLocalizations[0] ofType:@"lproj"]]; 29 | } 30 | }); 31 | 32 | NSString *localizedString; 33 | if (localizationBundle) { 34 | localizedString = [localizationBundle localizedStringForKey:key value:value table:tableName]; 35 | } else { 36 | localizedString = [super localizedStringForKey:key value:value table:tableName]; 37 | } 38 | 39 | return localizedString; 40 | } 41 | 42 | @end 43 | 44 | @implementation NSBundle (GPGLocalization) 45 | 46 | - (void)useGPGLocalizations { 47 | object_setClass(self, [GPGLocalizationBundle class]); 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Source/NSBundle+Sandbox.h: -------------------------------------------------------------------------------- 1 | /* NSBundle+Sandbox.h created by Lukas Pitschl (@lukele) on Sut 29-Sep-2012 */ 2 | 3 | /* 4 | * Copyright (c) 2000-2017, GPGTools Team 5 | * All rights reserved. 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of GPGTools Project Team nor the names of GPGMail 15 | * contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE GPGTools Project Team ``AS IS'' AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE GPGTools Project Team BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | typedef enum { 33 | OBCodeSignStateUnsigned = 1, 34 | OBCodeSignStateSignatureValid, 35 | OBCodeSignStateSignatureInvalid, 36 | OBCodeSignStateSignatureNotVerifiable, 37 | OBCodeSignStateSignatureUnsupported, 38 | OBCodeSignStateError 39 | } OBCodeSignState; 40 | 41 | @interface NSBundle (OBCodeSigningInfo) 42 | 43 | - (BOOL)ob_comesFromAppStore; 44 | - (BOOL)ob_isSandboxed; 45 | - (OBCodeSignState)ob_codeSignState; 46 | - (BOOL)isValidSigned; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Source/NSPipe+NoSigPipe.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSPipe+NoSigPipe.h 3 | // Libmacgpg 4 | // 5 | // Created by Lukas Pitschl on 03.06.12. 6 | // Copyright (c) 2014 Lukas Pitschl. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // a little category to fcntl F_SETNOSIGPIPE on each fd 12 | @interface NSPipe (SetNoSIGPIPE) 13 | - (NSPipe *)noSIGPIPE; 14 | @end 15 | -------------------------------------------------------------------------------- /Source/NSPipe+NoSigPipe.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSPipe+NoSigPipe.m 3 | // Libmacgpg 4 | // 5 | // Created by Lukas Pitschl on 03.06.12. 6 | // Copyright (c) 2014 Lukas Pitschl. All rights reserved. 7 | // 8 | 9 | #import "NSPipe+NoSigPipe.h" 10 | 11 | @implementation NSPipe (SetNoSIGPIPE) 12 | 13 | #ifndef F_SETNOSIGPIPE 14 | #define F_SETNOSIGPIPE 73 /* No SIGPIPE generated on EPIPE */ 15 | #endif 16 | #define FCNTL_SETNOSIGPIPE(fd) (fcntl(fd, F_SETNOSIGPIPE, 1)) 17 | 18 | - (NSPipe *)noSIGPIPE 19 | { 20 | FCNTL_SETNOSIGPIPE([[self fileHandleForReading] fileDescriptor]); 21 | FCNTL_SETNOSIGPIPE([[self fileHandleForWriting] fileDescriptor]); 22 | return self; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Source/PLWeakCompatibilityStubs.h: -------------------------------------------------------------------------------- 1 | // 2 | // PLWeakCompatibilityStubs.h 3 | // PLWeakCompatibility 4 | // 5 | // Created by Michael Ash on 3/28/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // A typedef used in place of id to prevent ARC from getting its hands dirty with 12 | // our object pointers. Even with __unsafe_unretained, ARC likes to do things like 13 | // retain and release intermediate values, which gets us into serious trouble. 14 | typedef void *PLObjectPtr; 15 | 16 | 17 | // These are prototypes of the various runtime functions the compiler calls to handle 18 | // __weak variables. If you import this header and these prototypes interfere with 19 | // the official ones (due to using PLObjectPtr instead of id), simply do 20 | // #define EXCLUDE_STUB_PROTOTYPES 1 immediately before the import statement to 21 | // exclude these. 22 | #if !EXCLUDE_STUB_PROTOTYPES 23 | PLObjectPtr objc_loadWeakRetained(PLObjectPtr *location); 24 | PLObjectPtr objc_initWeak(PLObjectPtr *addr, PLObjectPtr val); 25 | void objc_destroyWeak(PLObjectPtr *addr); 26 | void objc_copyWeak(PLObjectPtr *to, PLObjectPtr *from); 27 | void objc_moveWeak(PLObjectPtr *to, PLObjectPtr *from); 28 | PLObjectPtr objc_loadWeak(PLObjectPtr *location); 29 | PLObjectPtr objc_storeWeak(PLObjectPtr *location, PLObjectPtr obj); 30 | #endif 31 | 32 | // Enable or disable the use of MAZeroingWeakRef. If enabled is YES, then 33 | // MAZeroingWeakRef is used to implement the __weak functionality if present. 34 | // If MAZWR is not present in your process, then it falls back to its simpler 35 | // internal implementation. MAZWR use is enabled by default. Note that 36 | // changing this value after weak references have been manipulated is 37 | // extremely forbidden and will cause no end to havoc. 38 | void PLWeakCompatibilitySetMAZWREnabled(BOOL enabled); 39 | 40 | // Check whether MAZeroingWeakRef is in use. Returns YES if and only if 41 | // MAZeroingWeakRef is present in the process and its use is not disabled 42 | // with the above function. Returns NO if MAZWR is not present or its 43 | // use has been explicitly disabled. 44 | BOOL PLWeakCompatibilityHasMAZWR(void); 45 | 46 | // Enable or disable the use of native fallthroughs to built-in runtime functions 47 | // when present. When enabled, if the necessary weak reference functions are 48 | // present in the Objective-C runtime, they are called instead of the third-party 49 | // weak reference implementation. When disabled, the third-party implementation 50 | // is always used. This is enabled by default, and should not be disabled except 51 | // for testing purposes. Do not change this value after weak references have been 52 | // manipulated, or you will severely regret it. 53 | void PLWeakCompatibilitySetFallthroughEnabled(BOOL enabled); 54 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/GSPaddle: -------------------------------------------------------------------------------- 1 | Versions/Current/GSPaddle -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Modules: -------------------------------------------------------------------------------- 1 | Versions/Current/Modules -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/GSPaddle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/GSPaddle -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/Headers/GSPaddle.h: -------------------------------------------------------------------------------- 1 | // 2 | // GSPaddle.h 3 | // GSPaddle 4 | // 5 | // Created by Lukas Pitschl on 29.01.18. 6 | // Copyright © 2018 Lukas Pitschl. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for GSPaddle. 12 | FOUNDATION_EXPORT double GSPaddleVersionNumber; 13 | 14 | //! Project version string for GSPaddle. 15 | FOUNDATION_EXPORT const unsigned char GSPaddleVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | 23 | // Recereate missing headers for PaddleAnalytics to disable Analytics. 24 | 25 | @interface PaddleAnalyticsKit : NSObject 26 | 27 | + (void)disableTracking; 28 | + (BOOL)isOptedIn; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/Headers/GSPaddleErrorCodes.h: -------------------------------------------------------------------------------- 1 | // 2 | // GSPaddleErrorCodes.h 3 | // GSPaddle 4 | // 5 | // Created by Lukas Pitschl on 27.09.18. 6 | // Copyright © 2018 Lukas Pitschl. All rights reserved. 7 | // 8 | 9 | #ifndef GSPaddleErrorCodes_h 10 | #define GSPaddleErrorCodes_h 11 | 12 | typedef enum { 13 | GSPaddleErrorCodeNetworkError = 99, 14 | GSPaddleErrorCodeActivationCodeNotFound = 100, 15 | GSPaddleErrorCodeActivationCodeAlreadyUsed = 104 16 | } GSPaddleErrorCodes; 17 | 18 | #endif /* GSPaddleErrorCodes_h */ 19 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/Headers/PADApi+GSPaddle.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADApi+GSPaddle.h 3 | // GSPaddle 4 | // 5 | // Created by Lukas Pitschl on 27.09.18. 6 | // Copyright © 2018 Lukas Pitschl. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PADApi_GSPaddle : NSObject 12 | 13 | @end 14 | 15 | @interface Paddle (GSPaddleMore) 16 | 17 | - (NSError *)activationErrorForActivationCode:(NSString *)activationCode; 18 | - (void)setActivationError:(NSError *)error forActivationCode:(NSString *)activationCode; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/Headers/Paddle+CustomBundleIdentifier.h: -------------------------------------------------------------------------------- 1 | // 2 | // Paddle+CustomBundleIdentifier.h 3 | // GSPaddle 4 | // 5 | // Created by Lukas Pitschl on 29.01.18. 6 | // Copyright © 2018 Lukas Pitschl. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSFileManager (CustomBundleIdentifier) 13 | 14 | - (id)GSCustomBundleIdentifier; 15 | - (void)GSSetCustomBundleIdentifier:(NSString *)customBundleIdentifier; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module GSPaddle { 2 | umbrella header "GSPaddle.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 17G65 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | GSPaddle 11 | CFBundleIdentifier 12 | org.gpgtools.GSPaddle 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | GSPaddle 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.1 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 10B61 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 18B71 35 | DTSDKName 36 | macosx10.14 37 | DTXcode 38 | 1010 39 | DTXcodeBuild 40 | 10B61 41 | NSHumanReadableCopyright 42 | Copyright © 2018 Lukas Pitschl. All rights reserved. 43 | 44 | 45 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/GSPaddle.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | $(PRODUCT_BUNDLE_IDENTIFIER) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | XPCService 24 | 25 | ServiceType 26 | Application 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/JailfreeTask.h: -------------------------------------------------------------------------------- 1 | // 2 | // GPGXPCTask.h 3 | // Libmacgpg 4 | // 5 | // Created by Lukas Pitschl on 28.09.12. 6 | // 7 | // 8 | #import "JailfreeProtocol.h" 9 | #import 10 | 11 | @class Paddle; 12 | 13 | @interface JailfreeTask : NSObject { 14 | NSXPCConnection * __weak _xpcConnection; 15 | Paddle *_paddle; 16 | } 17 | 18 | - (void)testConnection:(void (^)(BOOL))reply; 19 | 20 | #pragma mark - GPGTaskHelper RPC methods 21 | - (void)launchGPGWithArguments:(NSArray *)arguments data:(NSData *)data readAttributes:(BOOL)readAttributes closeInput:(BOOL)closeInput reply:(void (^)(NSDictionary *))reply; 22 | - (void)launchGeneralTask:(NSString *)path withArguments:(NSArray *)arguments wait:(BOOL)wait reply:(void (^)(BOOL))reply; 23 | 24 | #pragma mark - GPGWatcher RPC methods 25 | - (void)startGPGWatcher; 26 | 27 | #pragma mark - Methods read from 28 | - (void)loadConfigFileAtPath:(NSString *)path reply:(void (^)(NSString *))reply; 29 | - (void)loadUserDefaultsForName:(NSString *)domainName reply:(void (^)(NSDictionary *))reply; 30 | - (void)setUserDefaults:(NSDictionary *)domain forName:(NSString *)domainName reply:(void (^)(BOOL result))reply; 31 | 32 | - (void)isPassphraseForKeyInGPGAgentCache:(NSString *)key reply:(void (^)(BOOL))reply; 33 | - (void)validSupportContractAvailableForProduct:(NSString *)identifier reply:(void (^)(BOOL, NSDictionary *))reply; 34 | 35 | @property (nonatomic, weak) NSXPCConnection *xpcConnection; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Modules: -------------------------------------------------------------------------------- 1 | Versions/Current/Modules -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Paddle: -------------------------------------------------------------------------------- 1 | Versions/Current/Paddle -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Headers/PADAlert.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADAlert.h 3 | // Paddle 4 | // 5 | // Created by Paddle on 31/01/2018. 6 | // Introduced in v4.0. 7 | // Copyright © 2018 Paddle. All rights reserved. 8 | // 9 | 10 | #import "PADProduct.h" 11 | #import 12 | 13 | /** 14 | * @discussion The following constants describe the possible types of alerts. 15 | */ 16 | typedef NS_ENUM(NSInteger, PADAlertType) { 17 | /** 18 | * @discussion Specify that an action has successfully been completed. 19 | */ 20 | PADAlertSuccess, 21 | 22 | /** 23 | * @discussion Specify that an action has not successfully been completed. 24 | */ 25 | PADAlertError, 26 | 27 | /** 28 | * @discussion Specify that an action has not been completely successful, or that 29 | * there may be unexpected side-effects. 30 | */ 31 | PADAlertWarning 32 | }; 33 | 34 | /** 35 | * @discussion PADAlert represents a message the SDK would show to the Buyer. These can be suppressed via the Paddle delegate. 36 | */ 37 | @interface PADAlert : NSObject 38 | 39 | /** 40 | * @discussion The type of the alert, which influences the style of the displayed alert. 41 | */ 42 | @property (readonly, assign) PADAlertType alertType; 43 | 44 | /** 45 | * @discussion The main heading text of the alert. 46 | */ 47 | @property (nonnull, readonly, copy) NSString *title; 48 | 49 | /** 50 | * @discussion The body of the alert. 51 | */ 52 | @property (nonnull, readonly, copy) NSString *message; 53 | 54 | /** 55 | * @discussion The product that was relevant when the alert was created. The product is included 56 | * so that it can be passed to UI control methods. 57 | */ 58 | @property (nonnull, readonly, nonatomic) PADProduct *product; 59 | 60 | /** 61 | * @discussion Create a new PADAlert with all properties specified. 62 | */ 63 | - (nullable instancetype)init:(PADAlertType)alertType title:(nonnull NSString *)title message:(nonnull NSString *)message product:(nonnull PADProduct *)product; 64 | 65 | /** 66 | * @brief Display the alert to the user. 67 | * @discussion The alert is only displayed if the delegate either does not respond to willShowPaddleAlert: 68 | * or if the delegate returns YES from willShowPaddleAlert: for this alert. This allows the delegate to 69 | * disable specific alerts. 70 | * @discussion Because the alert is a UI element, this method must be called on the main dispatch queue. 71 | */ 72 | - (void)show; 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Headers/PADCheckoutOptions.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADCheckoutOptions.h 3 | // Paddle 4 | // 5 | // Created by Paddle on 09/10/2017. 6 | // Introduced in v4.0. 7 | // Copyright © 2018 Paddle. All rights reserved. 8 | // 9 | 10 | #import "PADPriceOverride.h" 11 | #import 12 | 13 | /** 14 | * @brief PADCheckoutOptions describes the options that can be passed to the 15 | * Paddle checkout. 16 | * @discussion This interface contains the most common options to customize the checkout. 17 | * To specify additional options, add them to the \c additionalCheckoutParameters property. 18 | * See the reference documentation for Paddle.js for all possible checkout configuration options. 19 | */ 20 | @interface PADCheckoutOptions : NSObject 21 | 22 | /** 23 | * @discussion The user's email address. 24 | */ 25 | @property (copy, nullable) NSString *email; 26 | 27 | /** 28 | * @discussion The country of the user represented as a ISO 3166-1 alpha-2 country code, 29 | * e.g. @"US". 30 | */ 31 | @property (copy, nullable) NSString *country; 32 | 33 | /** 34 | * @discussion The postcode of the user. 35 | */ 36 | @property (copy, nullable) NSString *postcode; 37 | 38 | /** 39 | * @discussion The number of the same product that the user wishes to buy. 40 | */ 41 | @property (copy, nullable) NSNumber *quantity; 42 | 43 | /** 44 | * @discussion Specifies whether the user can change the quantity on the checkout. 45 | * By default this property is set to YES. 46 | */ 47 | @property BOOL allowQuantity; 48 | 49 | /** 50 | * @discussion The domain from which the checkout is started. 51 | */ 52 | @property (copy, nullable) NSString *referringDomain; 53 | 54 | /** 55 | * @discussion Specifies that users should be not be able to log out on the checkout, 56 | * preventing them from changing the email on checkout. By default this option is set 57 | * to NO. 58 | */ 59 | @property BOOL disableLogout; 60 | 61 | /** 62 | * @discussion The opaque value that we pass through the checkout process. 63 | */ 64 | @property (copy, nullable) NSString *passthrough; 65 | 66 | /** 67 | * @discussion The coupon code to use on the checkout. 68 | */ 69 | @property (copy, nullable) NSString *coupon; 70 | 71 | /** 72 | * @discussion The locale code of the user, if you would prefer to override the checkout's auto-detection. 73 | */ 74 | @property (copy, nullable) NSString *locale; 75 | 76 | /** 77 | * @discussion The short title of the checkout, typically the product name. 78 | */ 79 | @property (copy, nullable) NSString *title; 80 | 81 | /** 82 | * @discussion The message of the checkout, typically a short description of 83 | * the product. 84 | */ 85 | @property (copy, nullable) NSString *message; 86 | 87 | /** 88 | * @discussion The price overrides of the checkout. 89 | */ 90 | @property (nonatomic, nullable) PADPriceOverride *priceOverride; 91 | 92 | /** 93 | * @discussion The additional checkout options. 94 | */ 95 | @property (nonatomic, nullable) NSDictionary *additionalCheckoutParameters; 96 | 97 | /** 98 | * @discussion The checkout options prepared for transmission to the checkout 99 | * window or UI element. 100 | */ 101 | @property (readonly, nonnull) NSDictionary *formattedOptions; 102 | 103 | /** 104 | * @brief Create an empty checkout options object. 105 | */ 106 | + (instancetype)options; 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Headers/PADDisplayConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADDisplayConfiguration.h 3 | // Paddle 4 | // 5 | // Created by Paddle on 09/10/2017. 6 | // Introduced in v4.0. 7 | // Copyright © 2018 Paddle. All rights reserved. 8 | // 9 | 10 | #import 11 | #import 12 | 13 | /** 14 | * @discussion The following constants describe the possible ways in which Paddle UI 15 | * elements may be displayed. 16 | */ 17 | typedef NS_ENUM(NSInteger, PADDisplayType) { 18 | /** 19 | * @discussion Display the dialog as a window. 20 | */ 21 | PADDisplayTypeWindow, 22 | 23 | /** 24 | * @discussion Display the dialog as a sheet. 25 | */ 26 | PADDisplayTypeSheet, 27 | 28 | /** 29 | * @discussion Display the dialog as an alert. 30 | */ 31 | PADDisplayTypeAlert, 32 | 33 | /** 34 | * @discussion Display the dialog using a custom method. 35 | */ 36 | PADDisplayTypeCustom, 37 | 38 | /** 39 | * @discussion Display the dialog in an external browser. 40 | */ 41 | PADDisplayTypeExternalBrowser 42 | }; 43 | 44 | /** 45 | * @discussion PADDisplayConfiguration is used to specify how a Paddle dialog should be displayed 46 | */ 47 | @interface PADDisplayConfiguration : NSObject 48 | 49 | /** 50 | * @discussion Indicate how the Paddle UI element should be displayed. 51 | */ 52 | @property (readonly) PADDisplayType displayType; 53 | 54 | /** 55 | * @brief Specifies which window the sheet should be attached to. 56 | * @discussion The parent window is only required if the display type is PADDisplayTypeSheet. 57 | */ 58 | @property (nullable, assign, readonly) NSWindow *parentWindow; 59 | 60 | /** 61 | * @brief Hide buttons on dialogs that navigate to other dialogs. By default this option 62 | * is disabled. 63 | */ 64 | @property (readonly) BOOL hideNavigationButtons; 65 | 66 | /** 67 | * @discussion Initialize the display configuration with type and optional parent window. 68 | */ 69 | - (nullable instancetype)initWithDisplayType:(PADDisplayType)displayType 70 | hideNavigationButtons:(BOOL)hideNavigationButtons 71 | parentWindow:(NSWindow *_Nullable)parentWindow; 72 | 73 | /** 74 | * @discussion Initialize a new display configuration with type and optional parent window. 75 | */ 76 | + (nullable instancetype)configuration:(PADDisplayType)displayType 77 | hideNavigationButtons:(BOOL)hideNavigationButtons 78 | parentWindow:(NSWindow *_Nullable)parentWindow; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Headers/PADLicenseMigrate.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADLicenseMigrate.h 3 | // FIXME: explain purpose of file. 4 | // 5 | // Created by Paddle on 01/09/2018. 6 | // Introduced in v4.0. 7 | // Copyright © 2018 Paddle. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | /** 13 | * @discussion The following constants describe the possible product verification states. 14 | */ 15 | typedef NS_ENUM(NSInteger, PADExistingLicenseType) { 16 | /** 17 | * @discussion Specifies that the license is a standard user license 18 | */ 19 | PADUserLicense, 20 | 21 | /** 22 | * @discussion Specifies that the license is a v3 style site license 23 | */ 24 | PADSiteLicense 25 | }; 26 | 27 | /** 28 | * @discussion The license migrate delegate is called when an existing v3 style license is found. Returning YES will allow the SDK to migrate this license to v4. 29 | */ 30 | @protocol PADLicenseMigrateDelegate 31 | 32 | @optional 33 | 34 | /** 35 | * @brief Should the product for ID be migrated from a v3 license to a v4 license 36 | * 37 | * @param productId An NSString containing the productId of the product license being migrated. 38 | * @param existingLicenseType a PADExistingLicenseType ENUM indicating the type of license trying to be migrated 39 | * 40 | * @return BOOL to indicate if the license should be migrated to v4 41 | */ 42 | - (BOOL)shouldMigrateExistingV3License:(nonnull NSString *)productId type:(PADExistingLicenseType)existingLicenseType; 43 | 44 | /** 45 | * @brief The product for ID has been migrated from v3 to v4 46 | * 47 | * @param productId An NSString containing the productId of the product license that was migrated. 48 | * @param existingLicenseType a PADExistingLicenseType ENUM indicating the type of license migrated 49 | */ 50 | - (void)v3LicenseMigrated:(nonnull NSString *)productId type:(PADExistingLicenseType)existingLicenseType; 51 | 52 | @end 53 | 54 | @interface PADLicenseMigrate : NSObject 55 | 56 | @property (weak, nullable) id delegate; 57 | 58 | - (void)locateAndMigrateExistingV3License:(nonnull NSString *)productId; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Headers/PADPriceOverride.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADPriceOverride.h 3 | // Paddle 4 | // 5 | // Created by Paddle on 13/02/2018. 6 | // Introduced in v4.0. 7 | // Copyright © 2018 Paddle. All rights reserved. 8 | // 9 | 10 | #import "PADProduct.h" 11 | #import 12 | 13 | /** 14 | * @brief A PADPrice object describes a pre-authorized price override for the checkout. 15 | * @discussion The auth value should be calculated beforehand and preferably statically 16 | * included in the application binary to increase the difficulty of inspection. 17 | * 18 | * @discussion You'll need to supply at least one of these to \c PriceOverride if you wish 19 | * to override the dashboard checkout price for a product. 20 | */ 21 | @interface PADPrice : NSObject 22 | 23 | /** 24 | * @discussion The amount of the price, e.g. @10.15 25 | */ 26 | @property (nonnull, nonatomic) NSNumber *price; 27 | 28 | /** 29 | * @discussion The currency of the overridden price, e.g. @"USD". The specified currency must be enabled on the dashboard. 30 | */ 31 | @property (nonnull, copy) NSString *currency; 32 | 33 | /** 34 | * @discussion The authorization string used to validate the price override, calculated ahead of time. 35 | */ 36 | @property (nonnull, copy) NSString *auth; 37 | 38 | /** 39 | * @discussion Creates a new price with all required properties set. 40 | */ 41 | - (nullable instancetype)init:(nonnull NSNumber *)price currency:(nonnull NSString *)currency auth:(nonnull NSString *)auth; 42 | 43 | @end 44 | 45 | /** 46 | * @discussion PADPriceOverride collects all price overrides for the checkout. 47 | * 48 | * @discussion You must include a \c PADPrice object per currency that you wish to override 49 | * and pass a \c PriceOverride to \c CheckoutOptions and subsequently to the \c Checkout. 50 | */ 51 | @interface PADPriceOverride : NSObject 52 | 53 | /** 54 | * @discussion Collection of all purchase price overrides. These prices will be used 55 | * to determine the price of the checkout, but not to determine the recurring price 56 | * of the product. For non-subscription products, this is the only collection that 57 | * should be added to (if necessary). 58 | */ 59 | @property (nonnull, readonly, nonatomic) NSMutableArray *prices; 60 | 61 | /** 62 | * @discussion Collection of all recurring price overrides. These prices will be used 63 | * to determine the recurring price of the product and will be displayed on the checkout 64 | * to indicate the recurring nature of the product. These prices do not to influence the 65 | * price of the checkout. 66 | */ 67 | @property (nonnull, readonly, nonatomic) NSMutableArray *recurringPrices; 68 | 69 | /** 70 | * @discussion Add a price override to the prices array. 71 | */ 72 | - (void)addPrice:(nonnull PADPrice *)price; 73 | 74 | /** 75 | * @discussion Add a recurring price override to the recurring prices array. 76 | */ 77 | - (void)addRecurringPrice:(nonnull PADPrice *)price; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Headers/PADProductConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // PADProductConfiguration.h 3 | // Paddle 4 | // 5 | // Created by Paddle on 09/10/2017. 6 | // Introduced in v4.0. 7 | // Copyright © 2018 Paddle. All rights reserved. 8 | // 9 | 10 | @import Foundation; 11 | 12 | /** 13 | * @brief The following constants describe the possible types of trial of a product. 14 | */ 15 | typedef NS_ENUM(NSInteger, PADProductTrialType) { 16 | /** 17 | * @brief Specifies that the product has no trial and that we should not track the trial start 18 | * date. 19 | */ 20 | PADProductTrialNone, 21 | 22 | /** 23 | * @brief Specifies that the product trial should continue regardless of trial start date. 24 | */ 25 | PADProductTrialUnlimited, 26 | 27 | /** 28 | * @brief Specifies that the product trial is limited to a fixed number of days. 29 | */ 30 | PADProductTrialTimeLimited, 31 | }; 32 | 33 | /** 34 | * @discussion PADProductConfiguration represents the configuration of 35 | * a product for the first launch of the app, before we are able to retrieve 36 | * the remote configuration of the product. 37 | */ 38 | @interface PADProductConfiguration : NSObject 39 | 40 | /** 41 | * @brief Initialise a new product configuration object with the product and vendor name. 42 | */ 43 | + (instancetype)configuration:(nonnull NSString *)productName 44 | vendorName:(nonnull NSString *)vendorName; 45 | 46 | /** 47 | * @discussion The name of the product. This property is typically shown to users of the application. 48 | */ 49 | @property (copy, nonnull) NSString *productName; 50 | 51 | /** 52 | * @discussion The name of the seller. This property is typically shown to users of the application. 53 | */ 54 | @property (copy, nonnull) NSString *vendorName; 55 | 56 | /** 57 | * @discussion Specifies whether the product has a trial. If it does, we will track the start date of the trial 58 | * and report the number of days remaining in the trial period. 59 | * @discussion The type of trial as defined on the Paddle dashboard takes predence over this setting. This allows 60 | * for early-access products to be released with an unlimited trial and then later changed to time-limited trial. 61 | * @discussion By default the trial type is NONE. 62 | */ 63 | @property PADProductTrialType trialType; 64 | 65 | /** 66 | * @brief The maximum length of the product trial. 67 | * @discussion The trial length only takes effect for products with time-limited trials. 68 | */ 69 | @property (nonatomic, nullable) NSNumber *trialLength; 70 | 71 | /** 72 | * @brief Specifies the text displayed to the user of the application, explaining the trial policy of the product. 73 | * @discussion The trial text only takes effect for products with a trial, either limited or unlimited. 74 | */ 75 | @property (copy, nullable) NSString *trialText; 76 | 77 | /** 78 | * @brief The local file path of the product image. The image size must be at least 154x154 pixels. 79 | * @discussion When trying to display an image for the product, the local file path will be 80 | * loaded first. This order ensures that the user is shown a product image as soon as possible. 81 | * If the image URL has been retrieved from the remote configuration, then the image URL is 82 | * loaded next to provide an up to date version of the product image. 83 | */ 84 | @property (copy, nullable) NSString *imagePath; 85 | 86 | /** 87 | * @discussion The base price of the product before any sales. 88 | */ 89 | @property (nonatomic, nullable) NSNumber *price; 90 | 91 | /** 92 | * @brief The currency of the product. 93 | * @discussion The currency should be in the ISO 4217 format. 94 | */ 95 | @property (copy, nullable) NSString *currency; 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Paddle { 2 | header "Paddle.h" 3 | header "PADProduct.h" 4 | header "PADError.h" 5 | header "PADAlert.h" 6 | header "PADCheckoutOptions.h" 7 | header "PADProductConfiguration.h" 8 | header "PADDisplayConfiguration.h" 9 | header "PADPriceOverride.h" 10 | header "PADLicenseMigrate.h" 11 | export * 12 | } 13 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Paddle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Paddle -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 17D102 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | Paddle 11 | CFBundleIdentifier 12 | com.paddle.Paddle 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | Paddle 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 4.0 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 4.0.1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 9F2000 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 17E189 35 | DTSDKName 36 | macosx10.13 37 | DTXcode 38 | 0941 39 | DTXcodeBuild 40 | 9F2000 41 | NSHumanReadableCopyright 42 | Copyright © 2017 Paddle. All rights reserved. 43 | 44 | 45 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADActivateWindow.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADActivateWindow.nib -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADCheckoutWindow.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADCheckoutWindow.nib -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADProductNoTrialWindow.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADProductNoTrialWindow.nib -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADProductWindow.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADProductWindow.nib -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADWebPopWindowController.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/A/Resources/PADWebPopWindowController.nib -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/Paddle.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // jailfree-service 4 | // 5 | // Created by Lukas Pitschl on 28.09.12. 6 | // 7 | // 8 | 9 | #include 10 | #include "GPGGlobals.h" 11 | #include "JailfreeTask.h" 12 | 13 | @interface JailfreeService : NSObject 14 | @end 15 | 16 | @implementation JailfreeService 17 | 18 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 19 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(Jailfree)]; 20 | 21 | 22 | JailfreeTask *exportedObject = [[JailfreeTask alloc] init]; 23 | newConnection.exportedObject = exportedObject; 24 | 25 | newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(Jail)]; 26 | exportedObject.xpcConnection = newConnection; 27 | 28 | [newConnection resume]; 29 | return YES; 30 | } 31 | 32 | @end 33 | 34 | int main(int argc, const char *argv[]) 35 | { 36 | NSXPCListener *serviceListener = [[NSXPCListener alloc] initWithMachServiceName:JAILFREE_XPC_MACH_NAME]; 37 | 38 | JailfreeService *delegate = [[JailfreeService alloc] init]; 39 | serviceListener.delegate = delegate; 40 | 41 | [serviceListener resume]; 42 | [[NSRunLoop currentRunLoop] run]; 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Source/org.gpgtools.Libmacgpg.xpc/org.gpgtools.Libmacgpg.xpc.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | KeepAlive 6 | 7 | EnableTransactions 8 | 9 | Label 10 | org.gpgtools.Libmacgpg.xpc 11 | MachServices 12 | 13 | JAILFREE_XPC_NAME 14 | Something-will-be-replaced 15 | 16 | ProgramArguments 17 | 18 | JAILFREE_PATH 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /UnitTests/GPGArraySettingTest.m: -------------------------------------------------------------------------------- 1 | /* 2 | GPGArraySettingTest.m 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGArraySetting.h" 23 | #import "GPGConfReader.h" 24 | 25 | @interface GPGArraySettingTest : XCTestCase { 26 | NSString *key; 27 | NSArray *testwords; 28 | } 29 | 30 | @end 31 | 32 | @implementation GPGArraySettingTest 33 | 34 | - (void) setUp { 35 | key = @"auto-key-locate"; 36 | testwords = [NSArray arrayWithObjects:@"cert", @"pka", nil]; 37 | } 38 | 39 | - (void) tearDown { 40 | testwords = nil; 41 | } 42 | 43 | - (void) testSetValue { 44 | GPGArraySetting *setting = [[GPGArraySetting alloc] initForKey:key]; 45 | [setting setValue:testwords]; 46 | 47 | id value = [setting value]; 48 | XCTAssertNotNil(value, @"Unexpectedly nil!"); 49 | XCTAssertTrue([value count] == [testwords count], @"Incorrect count!"); 50 | } 51 | 52 | - (void) testSetNil { 53 | GPGArraySetting *setting = [[GPGArraySetting alloc] initForKey:key]; 54 | [setting setValue:testwords]; 55 | [setting setValue:nil]; 56 | 57 | id value = [setting value]; 58 | XCTAssertNotNil(value, @"Unexpectedly nil!"); 59 | XCTAssertTrue([value count] == 0, @"Incorrect count!"); 60 | } 61 | 62 | - (void) testGetValue { 63 | GPGArraySetting *setting = [[GPGArraySetting alloc] initForKey:key]; 64 | [setting setValue:testwords]; 65 | NSString* desc = [setting description]; 66 | XCTAssertEqualObjects(@"auto-key-locate cert pka\n", desc, @"description not as expected!"); 67 | } 68 | 69 | - (void) testAppendLine { 70 | GPGConfReader *reader = [GPGConfReader readerForDomain:GPGDomain_gpgConf]; 71 | GPGArraySetting *setting = [[GPGArraySetting alloc] initForKey:key]; 72 | [setting appendLine:@"auto-key-locate cert,pka" withReader:reader]; 73 | setting.isActive = FALSE; 74 | NSString* desc = [setting description]; 75 | XCTAssertEqualObjects(@"#auto-key-locate cert pka\n", desc, @"description not as expected!"); 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /UnitTests/GPGDictSettingTest.m: -------------------------------------------------------------------------------- 1 | /* 2 | GPGDictSettingTest.m 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGDictSetting.h" 23 | #import "GPGConfReader.h" 24 | 25 | @interface GPGDictSettingTest : XCTestCase { 26 | NSString *key; 27 | NSDictionary *testdict; 28 | } 29 | 30 | @end 31 | 32 | @implementation GPGDictSettingTest 33 | 34 | - (void) setUp { 35 | key = @"keyserver-options"; 36 | testdict = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"abc", @"def", nil], @"keyserver1", nil]; 37 | } 38 | 39 | 40 | - (void) testSetValue { 41 | GPGDictSetting *setting = [[GPGDictSetting alloc] initForKey:key]; 42 | [setting setValue:testdict]; 43 | 44 | id value = [setting value]; 45 | XCTAssertNotNil(value, @"Unexpectedly nil!"); 46 | XCTAssertTrue([value count] == [testdict count], @"Incorrect count!"); 47 | } 48 | 49 | - (void) testSetNil { 50 | GPGDictSetting *setting = [[GPGDictSetting alloc] initForKey:key]; 51 | [setting setValue:testdict]; 52 | [setting setValue:nil]; 53 | 54 | id value = [setting value]; 55 | XCTAssertNotNil(value, @"Unexpectedly nil!"); 56 | XCTAssertTrue([value count] == 0, @"Incorrect count!"); 57 | } 58 | 59 | - (void) testGetValue { 60 | 61 | GPGDictSetting *setting = [[GPGDictSetting alloc] initForKey:key]; 62 | [setting setValue:testdict]; 63 | NSString* desc = [setting description]; 64 | XCTAssertEqualObjects(@"keyserver-options keyserver1=abc def\n", desc, @"description not as expected!"); 65 | 66 | } 67 | 68 | - (void) testAppendLine { 69 | GPGConfReader *reader = [GPGConfReader readerForDomain:GPGDomain_gpgConf]; 70 | GPGDictSetting *setting = [[GPGDictSetting alloc] initForKey:key]; 71 | [setting appendLine:@"keyserver-options keyserver1=a, b" withReader:reader]; 72 | [setting appendLine:@"keyserver-options keyserver1=c, d" withReader:reader]; 73 | setting.isActive = FALSE; 74 | NSString* desc = [setting description]; 75 | XCTAssertEqualObjects(@"#keyserver-options keyserver1=c d\n", desc, @"description not as expected!"); 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /UnitTests/GPGLinesSettingTest.m: -------------------------------------------------------------------------------- 1 | /* 2 | GPGLinesSettingTest.m 3 | Libmacgpg 4 | 5 | Copyright (c) 2012 Chris Fraire. All rights reserved. 6 | 7 | Libmacgpg is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #import 22 | #import "GPGLinesSetting.h" 23 | #import "GPGConfReader.h" 24 | 25 | @interface GPGLinesSettingTest : XCTestCase { 26 | NSString *key; 27 | NSArray *testlines; 28 | } 29 | 30 | @end 31 | 32 | @implementation GPGLinesSettingTest 33 | 34 | - (void) setUp { 35 | key = @"comment"; 36 | testlines = [NSArray arrayWithObjects:@"abc", @"def", nil]; 37 | } 38 | 39 | - (void) testSetValue { 40 | GPGLinesSetting *setting = [[GPGLinesSetting alloc] initForKey:key]; 41 | [setting setValue:testlines]; 42 | 43 | id value = [setting value]; 44 | XCTAssertNotNil(value, @"Unexpectedly nil!"); 45 | XCTAssertTrue([value count] == [testlines count], @"Incorrect count!"); 46 | } 47 | 48 | - (void) testSetNil { 49 | GPGLinesSetting *setting = [[GPGLinesSetting alloc] initForKey:key]; 50 | [setting setValue:testlines]; 51 | [setting setValue:nil]; 52 | 53 | id value = [setting value]; 54 | XCTAssertNotNil(value, @"Unexpectedly nil!"); 55 | XCTAssertTrue([value count] == 0, @"Incorrect count!"); 56 | } 57 | 58 | - (void) testGetValue { 59 | GPGLinesSetting *setting = [[GPGLinesSetting alloc] initForKey:key]; 60 | [setting setValue:testlines]; 61 | NSString* desc = [setting description]; 62 | XCTAssertEqualObjects(@"comment abc\ncomment def\n", desc, @"description not as expected!"); 63 | 64 | } 65 | 66 | - (void) testAppendLine { 67 | GPGConfReader *reader = [GPGConfReader readerForDomain:GPGDomain_gpgConf]; 68 | GPGLinesSetting *setting = [[GPGLinesSetting alloc] initForKey:key]; 69 | [setting appendLine:@"comment line 1." withReader:reader]; 70 | [setting appendLine:@"comment line 2." withReader:reader]; 71 | setting.isActive = FALSE; 72 | NSString* desc = [setting description]; 73 | XCTAssertEqualObjects(@"#comment line 1.\n#comment line 2.\n", desc, @"description not as expected!"); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /UnitTests/GPGOptionsTest.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPGOptions.h" 3 | 4 | @interface GPGOptionsTest : XCTestCase 5 | 6 | @end 7 | 8 | @implementation GPGOptionsTest 9 | 10 | - (void)testDomainForKey1 { 11 | 12 | GPGOptions *options = [GPGOptions sharedOptions]; 13 | GPGOptionsDomain domain = [options domainForKey:@"marginals-needed"]; 14 | XCTAssertEqual(domain, GPGDomain_gpgConf, @"unexpected domain"); 15 | } 16 | 17 | - (void)testDomainForKey2 { 18 | 19 | GPGOptions *options = [GPGOptions sharedOptions]; 20 | GPGOptionsDomain domain = [options domainForKey:@"min-passphrase-nonalpha"]; 21 | XCTAssertEqual(domain, GPGDomain_gpgAgentConf, @"unexpected domain"); 22 | } 23 | 24 | - (void)testDomainForKey3 { 25 | 26 | GPGOptions *options = [GPGOptions sharedOptions]; 27 | GPGOptionsDomain domain = [options domainForKey:@"ShowPassphrase"]; 28 | XCTAssertEqual(domain, GPGDomain_common, @"unexpected domain"); 29 | } 30 | 31 | - (void)testDomainForKey4 { 32 | 33 | GPGOptions *options = [GPGOptions sharedOptions]; 34 | GPGOptionsDomain domain = [options domainForKey:@"nameserver"]; 35 | XCTAssertEqual(domain, GPGDomain_dirmngrConf, @"unexpected domain"); 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /UnitTests/GPGPacketTest.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPGUnitTest.h" 3 | 4 | 5 | @interface GPGPacketTest : XCTestCase 6 | @end 7 | 8 | @implementation GPGPacketTest 9 | 10 | 11 | - (void)testKey1 { 12 | GPGStream *stream = [GPGUnitTest streamForResource:@"key1.gpg"]; 13 | GPGPacketParser *parser = [GPGPacketParser packetParserWithStream:stream]; 14 | GPGPacket *packet; 15 | NSUInteger i = 0; 16 | 17 | NSArray *conditionList = @[ 18 | @{@"fingerprint": @"77270A31BEE39087C6B7E771F988A4590DB03A7D", 19 | @"keyID": @"F988A4590DB03A7D", 20 | @"version": @4, 21 | @"creationTime": @1313104392, 22 | @"publicAlgorithm": @1}, 23 | @{@"userID": @"GPGTools Test Key (For testing purposes only!) "}, 24 | @{@"keyID": @"F988A4590DB03A7D", 25 | @"version": @4, 26 | @"creationTime": @1313104392, 27 | @"publicAlgorithm": @1, 28 | @"hashStart": @65285, 29 | @"type": @19, 30 | @"hashAlgorithm": @2}, 31 | @{@"fingerprint": @"30BD46FC8599CB334466CFC5526B09F10AA3DA82", 32 | @"keyID": @"526B09F10AA3DA82", 33 | @"version": @4, 34 | @"creationTime": @1313104392, 35 | @"publicAlgorithm": @1}, 36 | @{@"keyID": @"F988A4590DB03A7D", 37 | @"version": @4, 38 | @"creationTime": @1313104392, 39 | @"publicAlgorithm": @1, 40 | @"hashStart": @63416, 41 | @"type": @24, 42 | @"hashAlgorithm": @2} 43 | ]; 44 | 45 | 46 | 47 | while ((packet = [parser nextPacket])) { 48 | if (i >= conditionList.count) { 49 | XCTFail(@"Too many packets parsed! (%lu > %lu)", i+1, conditionList.count); 50 | break; 51 | } 52 | 53 | NSDictionary *conditions = conditionList[i]; 54 | for (NSString *key in conditions) { 55 | id expectedValue = conditions[key]; 56 | id value = [packet valueForKey:key]; 57 | 58 | XCTAssertEqualObjects(expectedValue, value, @"Wrong value returned by GPGPacket."); 59 | } 60 | 61 | i++; 62 | } 63 | 64 | if (i < conditionList.count) { 65 | XCTFail(@"Not enough packets parsed! (%lu < %lu)", i, conditionList.count); 66 | } 67 | } 68 | 69 | 70 | - (void)testCompressed { 71 | GPGStream *stream = [GPGUnitTest streamForResource:@"compressed1.gpg"]; 72 | GPGPacketParser *parser = [GPGPacketParser packetParserWithStream:stream]; 73 | GPGPacket *packet; 74 | NSUInteger i = 0; 75 | 76 | NSArray *conditionList = @[ 77 | @{@"format": @98, 78 | @"filename": @"tv", 79 | @"time": @1436958747, 80 | @"content": [NSData dataWithBytes:"ok\n" length:3]}, 81 | ]; 82 | 83 | while ((packet = [parser nextPacket])) { 84 | if (i >= conditionList.count) { 85 | XCTFail(@"Too many packets parsed! (%lu > %lu)", i+1, conditionList.count); 86 | break; 87 | } 88 | 89 | NSDictionary *conditions = conditionList[i]; 90 | for (NSString *key in conditions) { 91 | id expectedValue = conditions[key]; 92 | id value = [packet valueForKey:key]; 93 | 94 | XCTAssertEqualObjects(expectedValue, value, @"Wrong value returned by GPGPacket."); 95 | } 96 | 97 | i++; 98 | } 99 | 100 | if (i < conditionList.count) { 101 | XCTFail(@"Not enough packets parsed! (%lu < %lu)", i, conditionList.count); 102 | } 103 | 104 | } 105 | 106 | 107 | 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /UnitTests/GPGUnarmorTest.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "GPGUnitTest.h" 3 | #import "GPGUnArmor.h" 4 | 5 | 6 | @interface GPGUnArmorTest : XCTestCase 7 | @end 8 | 9 | @implementation GPGUnArmorTest 10 | 11 | 12 | - (void)testGPGUnArmor { 13 | // UnArmor every "Unarmor*.txt" file and compares it with "Unarmor*.res". 14 | 15 | NSString *resourcePath = [[NSBundle bundleForClass:[self class]] resourcePath]; 16 | NSFileManager *fileManager = [NSFileManager defaultManager]; 17 | 18 | NSArray *files = [fileManager contentsOfDirectoryAtPath:resourcePath error:nil]; 19 | XCTAssertNotNil(files, @"Unable to find test files!"); 20 | 21 | 22 | for (NSString *filename in files) { 23 | if (filename.length >= 11 && [[filename substringToIndex:7] isEqualToString:@"Unarmor"]) { 24 | if ([[filename substringWithRange:NSMakeRange(filename.length - 4, 4)] isEqualToString:@".txt"]) { 25 | NSString *filePath = [resourcePath stringByAppendingPathComponent:filename]; 26 | NSString *resPath = [[filePath substringToIndex:filePath.length - 3] stringByAppendingString:@"res"]; 27 | NSData *expectedData = [NSData dataWithContentsOfFile:resPath]; 28 | 29 | NSString *clearPath = [[filePath substringToIndex:filePath.length - 3] stringByAppendingString:@"clear"]; 30 | NSData *expectedClearData = nil; 31 | if ([fileManager fileExistsAtPath:clearPath]) { 32 | expectedClearData = [NSData dataWithContentsOfFile:clearPath]; 33 | if (expectedClearData == nil) { 34 | XCTFail(@"Unable to read %@!", clearPath); 35 | } 36 | } 37 | 38 | GPGStream *stream = [GPGFileStream fileStreamForReadingAtPath:filePath]; 39 | 40 | 41 | 42 | GPGUnArmor *unArmor = [GPGUnArmor unArmorWithGPGStream:stream]; 43 | 44 | // The method to test 45 | NSData *unArmored = [unArmor decodeAll]; 46 | 47 | 48 | 49 | 50 | BOOL passed = YES; 51 | if (expectedClearData) { 52 | NSData *clearData = unArmor.clearText; 53 | if (![expectedClearData isEqualToData:clearData]) { 54 | passed = NO; 55 | XCTFail(@"Clear-text %@ failed!", filename); 56 | } 57 | } 58 | 59 | if (unArmored.length == 0 || ![unArmored isEqualToData:expectedData]) { 60 | passed = NO; 61 | XCTFail(@"Test %@ failed!", filename); 62 | } 63 | 64 | if (passed) { 65 | printf("%s\n", [[NSString stringWithFormat:@"Test %@ passed.", filename] UTF8String]); 66 | } 67 | } 68 | } 69 | } 70 | } 71 | 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /UnitTests/GPGUnitTest.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "Libmacgpg.h" 3 | 4 | 5 | extern NSString *testKey; 6 | extern NSString *testKey2; 7 | extern NSString *testSubkey; 8 | extern NSString *unitTestHome; 9 | 10 | extern GPGController *gpgc; 11 | extern GPGKeyManager *manager; 12 | 13 | 14 | @interface GPGUnitTest : NSObject 15 | 16 | + (void)setUpTestDirectory; 17 | + (NSData *)dataForResource:(NSString *)name; 18 | + (GPGStream *)streamForResource:(NSString *)name; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /UnitTests/GPGUnitTest.m: -------------------------------------------------------------------------------- 1 | #import "GPGUnitTest.h" 2 | 3 | NSString *testKey = @"77270A31BEE39087C6B7E771F988A4590DB03A7D"; 4 | NSString *testKey2 = @"672730F976B5D34B21FE47EBFFF63006274090B4"; 5 | NSString *testSubkey = @"30BD46FC8599CB334466CFC5526B09F10AA3DA82"; 6 | NSString *unitTestHome = @"/tmp/Libmacgpg_UnitTest"; 7 | GPGController *gpgc = nil; 8 | GPGKeyManager *manager = nil; 9 | 10 | 11 | 12 | @implementation GPGUnitTest 13 | 14 | + (void)setUpTestDirectory { 15 | static BOOL didSetUp = NO; 16 | 17 | if (!didSetUp) { 18 | didSetUp = YES; 19 | 20 | NSFileManager *fileManager = [NSFileManager defaultManager]; 21 | BOOL isDirectory; 22 | 23 | if ([fileManager fileExistsAtPath:unitTestHome isDirectory:&isDirectory] && isDirectory) { 24 | [fileManager removeItemAtPath:unitTestHome error:nil]; 25 | } 26 | [fileManager createDirectoryAtPath:unitTestHome withIntermediateDirectories:NO attributes:nil error:nil]; 27 | 28 | 29 | manager = [GPGKeyManager sharedInstance]; 30 | manager.homedir = unitTestHome; 31 | 32 | gpgc = [[GPGController alloc] init]; 33 | gpgc.gpgHome = unitTestHome; 34 | gpgc.passphrase = @"123"; 35 | 36 | NSData *data = [self dataForResource:@"OpenPGP.asc"]; 37 | [gpgc importFromData:data fullImport:TRUE]; 38 | } 39 | } 40 | 41 | + (NSData *)dataForResource:(NSString *)name { 42 | NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]]; 43 | NSString *path = [unitTestBundle pathForResource:name ofType:@""]; 44 | NSData *data = [NSData dataWithContentsOfFile:path]; 45 | if (!data) { 46 | @throw [NSException exceptionWithName:@"ApplicationException" reason:@"missing resource" userInfo:nil]; 47 | } 48 | return data; 49 | } 50 | 51 | + (GPGStream *)streamForResource:(NSString *)name { 52 | NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]]; 53 | NSString *path = [unitTestBundle pathForResource:name ofType:@""]; 54 | GPGFileStream *stream = [GPGFileStream fileStreamForReadingAtPath:path]; 55 | if (!stream) { 56 | @throw [NSException exceptionWithName:@"ApplicationException" reason:@"missing resource" userInfo:nil]; 57 | } 58 | return stream; 59 | } 60 | 61 | 62 | @end 63 | 64 | 65 | -------------------------------------------------------------------------------- /UnitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.gpgtools.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /UnitTests/Resources/Decrypt/LiteralAfterCustomEncrypted.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: Ths encrypted part of this message contains only a privat packet (60). 3 | Comment: After the encrypted packet, there is a literal packet containing a string. 4 | Comment: See https://neopg.io/blog/encryption-spoof/ 5 | 6 | hQIMAwIHl0OujQWmARAApsGD9ABTj5Z+7musV+hJ4JSGoSjaEWsOAiL5Y0MExvaq 7 | juh+2cy2PxA6txarr8VMPuoV1viGIkhmdfqof8f+Q8Dr24DMR4j9xGjlP+fUvQ53 8 | yDxoEhKHA36PUSMqBYVFmR3w0wh1XT3kbS2YuQLTDZdjA4j4AIRLwb+dY691s2E6 9 | 3ib/0wQTBG1Em3eeLbD/6lnThVh5RO4pwfH9ivJBW11lZS2/R3QmETVukSCYO3mi 10 | RaL2sP4CdBYJsJTHM26LL9FF4VMaZen1bX+fWngdqVblB2TtlgGPLI1UyBD0NU+7 11 | NKKDtTb4xKZqxC2khFp7tmXTdF4cpZiP75DvReelscd9u9vGGNkZphv82IlZZvZN 12 | Tsp+fIHUyopjZbTEseMKe3NsKSJdqGqmiKf9lmpExRPvO1iKKbHbsOdFs1sZBek7 13 | YYKkgTaDJRgj1TC0WvbF/te1ZjHW40J6UuC31D9ZlqyUKzqKssHLiu6Gbf+OJb19 14 | 02m9IABaLwSFb3qeURq0yNkT0ivGk45+Sdpvb8qOxoeNLoecC5UHv+O/I1cv+qjC 15 | hpc3T+C4pjk93JEOlCAqFlyEKcnaz/QMIfJ3HZIJJcv7sbnaaM9/LljH+bGOvgO/ 16 | 2l/hlmSPPxGVREHxpnMFS+rm3YmABoQtZsx6TnA42/9MKdkY0S3IGqUqqGDS2oHS 17 | LgHqYMjlraWsHNiIC6cQNz44Ss7x6e0gkDtv6Fqvo8K585BgejgKVNR8zOZPAInL 18 | FGIAAAAAAFRoaXMgaXMgZmluZSEK 19 | =sMxI 20 | -----END PGP MESSAGE----- 21 | -------------------------------------------------------------------------------- /UnitTests/Resources/Decrypt/LiteralAfterCustomEncrypted.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Decrypt/LiteralAfterCustomEncrypted.res -------------------------------------------------------------------------------- /UnitTests/Resources/Decrypt/LiteralAfterEmptyEncrypted.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: Ths encrypted part of this message contains nothing. 3 | Comment: After the encrypted packet, there is a literal packet containing a string. 4 | Comment: See https://neopg.io/blog/encryption-spoof/ 5 | 6 | hQIMAwIHl0OujQWmAQ//SRqSZ0iLS7RX8FMdU45RkxQLZ7rQpzdZ2XTU+A7KlVNH 7 | PRqOR6D+ATZUdRCmkfq0j2bTsdzyngCfes33d33teC4uD4VOL9k5BY4A05nbcrZs 8 | +iCTXPYzmrAK+sJ4Jv3SppRUUYEkyqc/ve0GLm+PHFc5XavidHJUQWwLI5ikmmx5 9 | r3g7+ZbtcBXtYR085ZvU0NJj5iYAQCKsKkm3x/SLe6+1sLRMXeBWHIRlsDNgSd3J 10 | DUjNj/NXPk8CtBGcRtd7dGliDcgbSlO72GEgbwnKwhFBS6Ahqqe2hyPU7jL98C7h 11 | 4VAZnNUhT8gL9/47kP3sYGE55aU467F2c8ne9VwDE2H07HHfIxYkxq6hVGpHTPD9 12 | VGVZlykP0iTYnKztAtkPYP6cQ6e035IOKrRhc9TVE+/avraMqKEmDPtI5mjwBMLp 13 | xNPdyOsiWyMTsdjGilW+XyDFsyQvsoXA4kLvA4a00QyhTeU/Wl9lezgFrT86M5sL 14 | PylBr36CMuxStDzmzr8S4T9P0t01ippZYlw2fWhHxkqbv/+zsAq24wuO/2zvxPcS 15 | ZJP0op4HVRLT8ShXBs/hF7MSuAPffPT6GwGdOGNl2b0SJxGTOfZdrjuoHc28LKST 16 | bZtou0LMG1ycwqSdJda95+E30RCTzTyK0CVsdgjrSE4c4++9lWsYZfMvoGMsmhDS 17 | KQEKMbPZfWAFlmhiHBKCrm0A7U9lwfeFVhaJ+69Ds3i9k93LCEL3gG/6yxRiAAAA 18 | AABUaGlzIGlzIGZpbmUhCg== 19 | =x4Gi 20 | -----END PGP MESSAGE----- 21 | -------------------------------------------------------------------------------- /UnitTests/Resources/Decrypt/LiteralAfterEmptyEncrypted.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Decrypt/LiteralAfterEmptyEncrypted.res -------------------------------------------------------------------------------- /UnitTests/Resources/Decrypt/Normal.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: This is a normal and valid encrypted message. 3 | 4 | hQIMAwIHl0OujQWmARAAwdWKQm5qOU4hAJ5EJzjkhwsyM5F8g0p6pW8Rpnvf6hPQ 5 | ARR50wPLMKCVj/2ofMWogZ3wGEWS5h9cfU0bSsw2KynbtEg/A+qkxfVtfEc/Octp 6 | 1PRziwFSPkbRzut20zkEcfsDxoww03WcbpBkujZSZe7vwq9y6HvaUhTN8aa3mlpL 7 | zTKL/cWSnmqdT9kefqEBp1vrRB8uL4tglEHYwNJ1mWuNNdsRJ2Hm1s/INpGAq/rh 8 | a/HhCBSIP/U72+CDvrNjckRl30Sbly0SCEV1FHCARcVMauPIPkpit0nEqfXC/tX5 9 | nhvy6dYeWigQVjzYUrS7QlExxfgI6zDOMdo1+8RXqK6a2NmR5jDvtynm8oTTMXUY 10 | lYGiIqEQE5HIZEUvWRuXpL3KtlgEvoA3F5BkKdxhwny6jK/tM7Kfp3Z64oDtizma 11 | yAJUB2Mr4A7U75HRgU3ZXl7Vby4DLQ/G3ZJfP2k0e+0GPkLSHICW8kdPbT8Qb9Fv 12 | xXEF49tVpLzp8novpNj9eTo8/mMVSGM1710hdB3YY3aAGA6TcV3eWUvXu3uLiYp9 13 | nX8tQn+1gV5IDDKj4gXQCtwfJiNf7nTX2UA9E3Xh9DF3h0bUDX3LNnRZMkXynH9F 14 | Nb37VBZiVlzM/yH30XioFOWuO3s/KJVQ9RY+an00WfHPiZon/8Gb1FyVoc05GTfS 15 | RwFP+u+tHSEeZhFL51HBegnkp814/LJC3iGsYy4zdT0jjPj3aageTzmk7HLQwpuE 16 | YlrjpYN0G4DUCXGijmc+N1DmMNaScFja 17 | =5kHr 18 | -----END PGP MESSAGE----- 19 | -------------------------------------------------------------------------------- /UnitTests/Resources/Decrypt/Normal.res: -------------------------------------------------------------------------------- 1 | This is fine! 2 | -------------------------------------------------------------------------------- /UnitTests/Resources/Encrypted.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Encrypted.gpg -------------------------------------------------------------------------------- /UnitTests/Resources/GPGPacket/compressed1.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/GPGPacket/compressed1.gpg -------------------------------------------------------------------------------- /UnitTests/Resources/GPGPacket/key1.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/GPGPacket/key1.gpg -------------------------------------------------------------------------------- /UnitTests/Resources/NoMDC.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: This message was created with --disable-mdc 3 | 4 | hQIMAwIHl0OujQWmAQ/9FPhCTiFZ4JAQgBENr9xnF97AATFzxi2BKSV/etf1M6SP 5 | X1ct2qbzVqvdM+TKfgUzuHE7gNky3WLGbwL/J3hxog2OGS20EKSOUvvfzkPHDJlq 6 | 9Men5RCzuxNChxosamuzeUx9F8Z57A73DquoIt6jRhSya5UMroA24RvzIkH/pfzD 7 | zbadCWFYvUijir7TPseU9k9RLNV0OETbqQmEb3V+mMbDpk0TdubnjkuH5OvRimuG 8 | z/KRqDg4p9GFnbsMZixL3YCcvhmpNzcQrLZb3Nl9kCtCsxkVZVJdt1KoAF/HQWqr 9 | MXj6a2HBaIcUG5PfvQM2Kqk+fAEBy6gl0KmcNhYJbyzs/+04hSVva22rbRUMbMw7 10 | GfjiQwkhWtUQRD3Q9JVnN26Ke4jqJmlBNTJpZHUmUMgga4flwiuy0lA264+OrJxV 11 | ntdEjTyGDhHnGElcFhbC/NJfPd59fCQf9PIiJvF/FCFFvB50yPeMW0LCbh/urHdI 12 | fq6YDNWb9Uw7FPotvpYU1mSaVKtxGMQHFQpxknoSxOBTKAvtCEflda8FSqO4l+nQ 13 | NiZMy1Kzd947fVjxLAyU+CZvmzYFhVkYEEEoTVGoUHR/JPdxxDsu2oyaQNkIuf6S 14 | UnCnDVKCTXQqOzL7DF+0UKbfhsBdQPQjGir3ZZZHm87dOW1n+Ib273gFd3dNYE3J 15 | OKKW9gKbbK/+frJucd5qm0FKLZl2AwSTdeP7DIKZ4TpOoj648XK6yeSyibvhCA5Y 16 | MffOo9VgSs78 17 | =zUAJ 18 | -----END PGP MESSAGE----- 19 | -------------------------------------------------------------------------------- /UnitTests/Resources/NoSecKey.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: There is no secret key, to decrypt this message. 3 | 4 | hQEMA5lJlEyCBLrrAQgAsDbQ0yuek0rG40m4L18D6mpTC6nq0kKQXwybPgYgKq2Y 5 | e0h37Q2p2xZ0rGh+WsTP8O5YUJT/y1Zf5r7KQXh8HzFAR6I4npwftpH/w0+Jti6h 6 | gXaoi7MBujxWqON/nshj8BuhkC27Tb5Xsb6Vxzco4AWiZUJEyh5CwUZAdWuXOcVE 7 | a3XQ8C7AnJetskoKfow5eIVXr5Z8zx262Qm/x/JgCq8R17yQ95aLBFSwo3iTUGh6 8 | 5AH2Py0VX/+dp5/TR7l4t1EZEUEO/x2Li4RISILZAA0LlzCjE+HrxAFBOTWsTFdZ 9 | KVfr0eOt7MZ+Z4Eyz82epxhmvjHf8aXNOjaD4CJmUdJPAfO+7eNOl4cGIc4yBNlV 10 | LgsVjiG5JOS4RtK68TW/7G5Kwy/qtPvYae2YbQSZXteULIfxM1tI29CHsC9V7RuL 11 | 5p7bma/GFvLteuOY+i8aAw== 12 | =pYXj 13 | -----END PGP MESSAGE----- 14 | -------------------------------------------------------------------------------- /UnitTests/Resources/SignedInputStringCR.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA1 3 | 4 | The quick brown fox.... 5 | -----BEGIN PGP SIGNATURE----- 6 | Version: GnuPG/MacGPG2 v2.0.17 (Darwin) 7 | Comment: GPGTools - http://gpgtools.org 8 | 9 | iQEcBAEBAgAGBQJPa8pVAAoJEFJrCfEKo9qCcesH/31pEzov8rgYb6g6cBHKprhO 10 | maVm7GV6+pAukSk3gTd6oYaFzhW2/DYp+ccfma1WrEMpF76uELE1feY8j0kowdA3 11 | 7lkud3dYwNHafYMkYwxjhjpi4Cnz16XEStXyop5oNsZdJX0Cx9H7TaproBEo7wCH 12 | 25yecnBDVjGMWjJ/IDE9iBgG0BuNnVzv+sSCSkaXcqSTabkjQfOS/PD2Egv4PkVJ 13 | sA2AWCTFFJKeAmP6UW0KuI6EgpoBMF3PNvQKlId9DmUhrOqDWSKlz8r7Y88rmNAt 14 | kNLecUam+3alP8ToMsZovjIlufVA/6wQDc+TRmg3R86SSj4Y1TBC9zorDRO3BwQ= 15 | =V3dW 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /UnitTests/Resources/SignedInputStringCRLF.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA1 3 | 4 | The 5 | quick 6 | brown 7 | fox.... 8 | -----BEGIN PGP SIGNATURE----- 9 | Version: GnuPG/MacGPG2 v2.0.17 (Darwin) 10 | Comment: GPGTools - http://gpgtools.org 11 | 12 | iQEcBAEBAgAGBQJPa8pfAAoJEFJrCfEKo9qCFqkH+QFGA6EQmPJKKv4yfJ4KfrRj 13 | /Sp+lrT/DNklVuzXrkHio2hHMdBkZF5nsu/otMvsUaca8se8pXVJO1fZ3UXriYli 14 | xXzdc+x0MLQRsN811tVncaqOIeTCWB05iswOx4VeB1C+s6HxVkNAP5BV373JmgOx 15 | EKKkndkp1Wvr9bQ3FDM89UAyOgfbsiBy0ziNJNmYOF2VYFCJl5KAd0K3SWlJAR/R 16 | 4b4NjnauP4HEH/RHyvhF53qBTsJ4iLrWRVpmtbjVJjnjiOU+DDhdjmwQLg5YtyqI 17 | xzFZ6UAZzSwGnuON1QZUAIlDBWFmZUEuh+g6orokmAjp4UU9P/9mfJImCvmS3f4= 18 | =9kF4 19 | -----END PGP SIGNATURE----- 20 | -------------------------------------------------------------------------------- /UnitTests/Resources/SignedInputStringLF.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA1 3 | 4 | The 5 | quick 6 | brown 7 | fox.... 8 | -----BEGIN PGP SIGNATURE----- 9 | Version: GnuPG/MacGPG2 v2.0.17 (Darwin) 10 | Comment: GPGTools - http://gpgtools.org 11 | 12 | iQEcBAEBAgAGBQJPa8pqAAoJEFJrCfEKo9qCXVMIAIn6027g6S22wtesBwacTq3+ 13 | fENAthM2gr66t/qIjiTbxYz52kgN2IUJiSbuHfzeMEQtGMy/zYjaL0YRc4T200u3 14 | uaC8nVM38+2iScdrANetyMfQd1+u3r7upW0zEWX0onTAyNY+fI/ELosIFlfSUdc/ 15 | NslTTTSYqkTzAgDjMgpxS6bXxCfHExdEPpMS4dRrBfROlQIbbbklrYvCeVYyU/wx 16 | e9evJ9YpbSO4Menc25+cY96tcKmQq94F917KDFywlKaB2SFHjRzG7bAcjhLEA1qk 17 | julSGGTbOzFcR1qpLY+rfpAXDHFQDHxnMmMW9C7kVSiQkCdp4MmGQh4r+ZmvMRc= 18 | =UKtB 19 | -----END PGP SIGNATURE----- 20 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_2Messages.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_2Messages.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_2Messages.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | 3 | hQEMA1JrCfEKo9qCAQf/QkNGbOLcMMPcA5wrfSNIkRpdbVQT5lze1QxAF0ESS075 4 | BMeQa45jXOklV4+B002SYrnL5pHDfgVEUaolSwlMK5CmToLbwrZwFOR5u5G/T2eK 5 | U+uB2eB8kRdsZNbZEG13wwBQybelfVeTXm2N0KBQiv/SmPmdW6a5BZtXjeTQfCWw 6 | +jcj6a2PvaaNT66xoMzpN2VGWeBpt0+9TU3bYL8wpnAfoBiiOmNUttM9GH07EAQM 7 | yVGEjcFtJr4x0ndo521mnBCbFgnuYrhaXAgh02s66o/nOvtb6JInJ1WWLOOYVfBL 8 | m4yn6QAcEHtb6L5Yi0MWXJ3GgG1jtv3gw56IY9CNLdJBAU03EcFa+dgUKSjmOCbv 9 | rYBM305B4ng91P1rDreEb6n0oGYitvY0g5W6oq55I5SP77kAw61Z2xRXQ2Rn5wG+ 10 | Z14= 11 | =Iq8w 12 | -----END PGP MESSAGE----- 13 | -----BEGIN PGP MESSAGE----- 14 | 15 | hQEMA1JrCfEKo9qCAQgAvlP++M1eWbhsvKu90lhJvXVY2bq39qlhh5WODFJs11Zy 16 | pvrq5in1lp13xBSx7PoLpA2H4T0zrq4+hReU53L++IM8pcewvRRV+aRIJfpKtJwM 17 | TlE7OfIeK9vD6teOsqecvLUq4DoKWRxI9RrM0qDQj68CUrlzAKhe1ei9NInCe0An 18 | dFX7glCgck1yGOr0q+ENXnExM7CF/NKq/bbSCz5lAn7EN445f/lWjZBytOGaVFw4 19 | qPszk9VytfvSoGUJ+g78fkXnikjYvAdT6A7hPPsdUw/8eCJ11seigK5L6n2HrkPe 20 | BCDQsjjBtnTdO7pM5WQCaUUHIYsDVLUAH51GYCykRNJBAe1evQxCENDJJTdRnLfx 21 | VNNoSqqIBV3HtygecdzHv1K+cA57YIYqGintO1F+Vm0eWhxhNIVQk3QTUuSLiTtn 22 | 4TE= 23 | =BIqD 24 | -----END PGP MESSAGE----- -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignComplicated.clear: -------------------------------------------------------------------------------- 1 | Some complicated text. 2 | 3 | 4 | 5 | 6 | ----Hey---- 7 | Unicode: äö@‘±Œ’˙\¯^£#£\^˜\·¯˜·\^fi£ 8 | Much more Unicode: °·ØÛ\™¸fiˇÇ˝◊Ûˇ‹Ø·˜\^fi™„Á˝Û\ˇØ·˙ÅÍÇ∏fl∏ıfl±æπ¿≠{≠|][{¢]¶|]{?)=)(=&/)%&$(æ±πøºª©⁄fi^Ç^\ÌÓ·ı∏ıÓÌÏ™fi£Ì\˜·¯˙ˆ¯Á˜·\^fiÇ\£„™^Ϙ\Ì^·¯ˆ∏·ıÓ‹˝^ fi‰^\^˜\·˜¯ı·°˘ˆÆÆ’—Æ—÷˛ØÛ˝\ÏÅÍ^Á◊ 9 | 10 | and some 11 | toher text 12 | over 13 | multiple 14 | lines. 15 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignComplicated.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_ClearsignComplicated.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignComplicated.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA512 3 | 4 | Some complicated text. 5 | 6 | 7 | - 8 | 9 | - ----Hey---- 10 | Unicode: äö@‘±Œ’˙\¯^£#£\^˜\·¯˜·\^fi£ 11 | Much more Unicode: °·ØÛ\™¸fiˇÇ˝◊Ûˇ‹Ø·˜\^fi™„Á˝Û\ˇØ·˙ÅÍÇ∏fl∏ıfl±æπ¿≠{≠|][{¢]¶|]{?)=)(=&/)%&$(æ±πøºª©⁄fi^Ç^\ÌÓ·ı∏ıÓÌÏ™fi£Ì\˜·¯˙ˆ¯Á˜·\^fiÇ\£„™^Ϙ\Ì^·¯ˆ∏·ıÓ‹˝^ fi‰^\^˜\·˜¯ı·°˘ˆÆÆ’—Æ—÷˛ØÛ˝\ÏÅÍ^Á◊ 12 | 13 | and some 14 | - toher text 15 | over 16 | multiple 17 | lines. 18 | - 19 | -----BEGIN PGP SIGNATURE----- 20 | Comment: GPGTools - https://gpgtools.org 21 | 22 | iQEcBAEBCgAGBQJVrLitAAoJEFJrCfEKo9qCy+IIAJg/Qc+rrN3bnEXz/bCoocRv 23 | v+goAN+Ey+8LS2rZ7sz8qJ3thXJ8gz1r+NLX9fnqg/hJz0qPn4JzeiAWaK9H4kMO 24 | I5f8jtRt2GsC0kUKI/kM1xDPbYqpG+vNwThfckH7BM7h6l28V6tVS6qIGyEfSHYw 25 | Vg6DlSF67wrx2niHpWEvm/4qcImrmUHqEu8e8xPNxi49yzKNk++1xGq/KKD7/kvG 26 | RFqBmGMwuytM2V0OpjlROr7RJlDAHVgtTgkV4wV1cWxN3qAIOk9uzyMKd1TUxPIH 27 | 9hUTpId+gtRCfsuPY8Yv5IgrNIv9LsGyzVWLHUkdEZh5Zl3ubClau8MwiN1JS1g= 28 | =YSWB 29 | -----END PGP SIGNATURE----- 30 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignNoLF.clear: -------------------------------------------------------------------------------- 1 | One line of text. No Newline. -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignNoLF.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_ClearsignNoLF.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignNoLF.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA512 3 | 4 | One line of text. No Newline. 5 | -----BEGIN PGP SIGNATURE----- 6 | Comment: GPGTools - https://gpgtools.org 7 | 8 | iQEcBAEBCgAGBQJVrLeaAAoJEFJrCfEKo9qCLY4IAKOSsop+TAGc1FoM7MRiO9v/ 9 | p4ALLsh6X+mjIskyY/0Bein1QQbwbRYXE2J5ZK0zcFPBO+sVAX6BFiFVkiV0GUyz 10 | GvMydj0XxY71WurbyT7ZPCyRyq2S5GznuSSTtxBYzeg+keeg6dzoDM6fcfG6g21T 11 | 1RBBTOXIR1aGTsXkoDzQvRiW7YnTL+61Mgi79gIqwj5Xj59n5VPKwFayO1GuepNz 12 | 3uOX7mHXG1a3HBHMOpTqFrvGJPA1h3fK0bdhJw9DLJR2HgTrux48HaVsgIjAGDor 13 | 4cTzmllFXVTG8tQRGdqO4pbsSxzICCWoNrJCmJ6xawO5vwuaa81G8bC8k0YGviQ= 14 | =y+Nv 15 | -----END PGP SIGNATURE----- 16 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignOneLF.clear: -------------------------------------------------------------------------------- 1 | One line of text. One newline. 2 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignOneLF.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_ClearsignOneLF.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignOneLF.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA512 3 | 4 | One line of text. One newline. 5 | 6 | -----BEGIN PGP SIGNATURE----- 7 | Comment: GPGTools - https://gpgtools.org 8 | 9 | iQEcBAEBCgAGBQJVrLfaAAoJEFJrCfEKo9qCbBkH/jJ3qkC7Src655KOP3urUavy 10 | hQzX7N/yKNtpRJdgw6IBzGkBuyqMhY1SECSiUhgn/WhDPy4a7Wn6TzllH26GCwet 11 | UPjBo5Q3ZpJULFPuTxda2tPOkto23saaihZ43cfpsS4ZcAcnEFxa+tF24PNgMLaH 12 | VnjfH2suZ8hSdsxyB8YTFpJI1PShniH83su2W89ReGdgQcoKLTcPTU4FH4LSdb7+ 13 | x9VV46/qUlDMVgM0UuV5ppXJtSAKlN1OFh1OrZgFV6K5jGfRzXLi8Y0uB2qNmvZY 14 | VykFX8zbZdd8wZkgdvOT/1lD8zzu9TvXjzCYgSd5Cy+Durz/cN9izPrA9crU24c= 15 | =33oJ 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignTwoLF.clear: -------------------------------------------------------------------------------- 1 | One line of text. Two newlines. 2 | 3 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignTwoLF.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_ClearsignTwoLF.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_ClearsignTwoLF.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNED MESSAGE----- 2 | Hash: SHA512 3 | 4 | One line of text. Two newlines. 5 | 6 | 7 | -----BEGIN PGP SIGNATURE----- 8 | Comment: GPGTools - https://gpgtools.org 9 | 10 | iQEcBAEBCgAGBQJVrLgWAAoJEFJrCfEKo9qCIGUIAISmsNnY9IjDW5CFqyDY7dwe 11 | 2SYt6IYi3knbrfh1a8kznwNAr3hTpD2BFe6jAxWCRQ1kyER/6zHhRDNj7uhy+MgZ 12 | weVCd59D+gnpXRQ9B2HBXK9oyY2u1qCDNFZHibezqBHBTjwVnBSSyQkSfsgtGgSA 13 | M01lyYna74JziLKSo/ffXhXYrc/kGsJf91pMZ+jCYXAN4Pf+vIhgGge6Ua+IV3g9 14 | VIcVloZ3zRtpm7iwCwYpMH83sDIWblY8nV8t1KSqb71eNqDCaTm+oLVYpdwN9ex6 15 | UiMuO22WHuRKM47OsZTsipVHqG/O92wu0SVOUVHqA16GhD63l0qJrb+QfcUxOIk= 16 | =zz0M 17 | -----END PGP SIGNATURE----- 18 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_DoubleNewline.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_DoubleNewline.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_DoubleNewline.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | 3 | Comment: GPGTools - https://gpgtools.org 4 | 5 | 6 | 7 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 8 | 9 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 10 | 11 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 12 | 13 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 14 | 15 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 16 | 17 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 18 | 19 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 20 | 21 | =Pp5D 22 | 23 | -----END PGP MESSAGE----- 24 | 25 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_InvalidComment.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_InvalidComment.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_InvalidComment.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment GPGTools - https://gpgtools.org 3 | 4 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 5 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 6 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 7 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 8 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 9 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 10 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 11 | =Pp5D 12 | -----END PGP MESSAGE----- 13 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_InvalidVersion.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_InvalidVersion.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_InvalidVersion.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Version GnuPG v2 3 | 4 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 5 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 6 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 7 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 8 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 9 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 10 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 11 | =Pp5D 12 | -----END PGP MESSAGE----- 13 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_MissingNewline.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_MissingNewline.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_MissingNewline.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: GPGTools - https://gpgtools.org 3 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 4 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 5 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 6 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 7 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 8 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 9 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 10 | =Pp5D 11 | -----END PGP MESSAGE----- 12 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_NoNewline.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_NoNewline.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_NoNewline.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- Comment: GPGTools - https://gpgtools.org hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= =Pp5D -----END PGP MESSAGE----- -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_Normal.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_Normal.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_Normal.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Comment: GPGTools - https://gpgtools.org 3 | 4 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 5 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 6 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 7 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 8 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 9 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 10 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 11 | =Pp5D 12 | -----END PGP MESSAGE----- 13 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_UnicodeDashes.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_UnicodeDashes.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_UnicodeDashes.txt: -------------------------------------------------------------------------------- 1 | 2 | –––BEGIN PGP MESSAGE---— Version: GnuPG v2 3 | 4 | hQIOAwfq5Jrby+ZxEAf+OElk+bSaj6cu6+q8Q9eJgGHVXslKJlymtVmdmNQYi96l 5 | FC5Mj/Op10nDEpHsDMg9qBQI5EIm2Gi+wezGPFcDGF8Fg/7zeb60IJ9bWbV7MPpi 6 | sCBYR6W6EFysKUhKMOZnLaVMw2w25G511xG7X1NWXF83u2AlWTH2mgQUvZlviXPI 7 | zLQNpnrBqHUfL6PznNQzjMzRNoTWHcflBmgnNB1PATEBh39uuKo8xHeIGPIejNYQ 8 | lses5sSAkGGkyKQ3UePK/qO+1dzlcL1BPWFo8321X6/7UXvL3iuITD2WHFfv/XxZ 9 | FOTAv2BpdST4IxZAr9YAWWZov0tURgRk+dgufB8cRgf/b3x4H7M1dEtMGMpJf5E7 10 | jXMJF4xvB2rFAbMzjgCTNkFQcX/SIi0JDsilH1vOBYDEBC0I67Pxv+So7RAH7CHK 11 | zA1sfVJ8R4/qcIBFiqNfR3ML5XNE8FNzvgiQ3iFT32S1H+6L/kBjTaYMA96hHshC 12 | eAikwiDPdhZkAKkAvKlk5hD7uu1QHNk2k6l7xU5oLwp8HRV7n1QZmPuux00QjXbK 13 | XEqPI4ZC6N0j5yDatKrRiAHBgtrO2q/T278DtIQWvk0MARAYEOSmPVs+T8kys8XR 14 | BIuShBA/0LT9ZqWVE6tHxI5n3hAeDq759MPGf78iEmlIJAPjF/0rWseGd/defHSK 15 | QNI+AenEna+icWyUZEVUvADO7EKikUgo/wNbXn1p6vGJTlSHSzgrxwCSwbMchaUt 16 | YIt2yepm69K1uA5zx0R5Na8= 17 | =tTc0 —–-END PGP MESSAGE---— 18 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_Version.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_Version.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_Version.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Version: GnuPG v2 3 | 4 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 5 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 6 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 7 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 8 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 9 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 10 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 11 | =Pp5D 12 | -----END PGP MESSAGE----- 13 | -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_VersionOnline.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macgpg/libmacgpg-free/c6a463e03443c4d2f3cf87d6003a885d7ccc1f39/UnitTests/Resources/Unarmor/Unarmor_VersionOnline.res -------------------------------------------------------------------------------- /UnitTests/Resources/Unarmor/Unarmor_VersionOnline.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- Version: OpenPGP.js v.1.20121015 2 | 3 | Comment: http://openpgpjs.org 4 | 5 | hQEMA1JrCfEKo9qCAQgAkpBbn3vMZLbiCTNInC52N/lQ2fMjUfSkEAVi55axmVKd 6 | WeFYkjIwSYYxkPsdhQamJKmWazfxGiubL4IKYjLLt7IEHYV7gO0zIQw1o4Co/QFO 7 | vExkgWv+JC0CRsa/uiSepmZT3mqDPLwgiMGr501J4DWB71UjvaxjNP4oNKYZB8zo 8 | tOX9eZaQ7S1xfZZGydNcTZTuJ/l3oiKR/HocPBV0NwoQ9iH26KH/L+xPE1cKqg0W 9 | BwK+y694cZMR6bmwpoqolwTHT8v1cV2JqX4V2afVcOdqAQyk4ZdVOYBbSL+2mt+C 10 | ESdIdp3V8zT6+Y6MgzusjdicumXop1KGGvpbpxSYJdI+ASGXpCWJRv01UODdtB5B 11 | xYZxy+Z6GfdVmC0NHHcFQ2JtHIqPbl9ponr95FBybxksz8AdItTJ4Ez+ptc8cVY= 12 | -----END PGP MESSAGE----- 13 | -------------------------------------------------------------------------------- /Version.config: -------------------------------------------------------------------------------- 1 | MAJOR=1 2 | MINOR=0 3 | #REVISION=8 4 | #PRERELEASE=b1 5 | 6 | VERSION="${MAJOR}.${MINOR}${REVISION:+.$REVISION}${PRERELEASE}" 7 | --------------------------------------------------------------------------------