Skip to content

Commit

Permalink
Release 0.99.1 Update
Browse files Browse the repository at this point in the history
Add Carthage manifest file
  • Loading branch information
krzyzanowskim committed Jan 31, 2022
1 parent 9570331 commit 534781b
Show file tree
Hide file tree
Showing 93 changed files with 1,743 additions and 115 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 0.99.1
- Fix ED25119 signature calculation. #192
- Generate ECC keys. #190
- Support compression in siguature packet. #191

Version 0.99.0
- Elliptic-Curves support (RFC6637 https://datatracker.ietf.org/doc/html/rfc6637). #141
- Elliptic-curve Diffie–Hellman.
Expand Down
2 changes: 1 addition & 1 deletion Config/Defaults.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// We support iOS and macOS
MARKETING_VERSION = 0.99.0
MARKETING_VERSION = 0.99.1
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator
TARGETED_DEVICE_FAMILY = 1,2,3,4
CODE_SIGNING_REQUIRED = NO
Expand Down
14 changes: 7 additions & 7 deletions Frameworks/ObjectivePGP.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_armv7</string>
<string>ios-arm64_i386_x86_64-simulator</string>
<key>LibraryPath</key>
<string>ObjectivePGP.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>armv7</string>
<string>i386</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
Expand All @@ -32,19 +35,16 @@
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_i386_x86_64-simulator</string>
<string>ios-arm64_armv7</string>
<key>LibraryPath</key>
<string>ObjectivePGP.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>i386</string>
<string>x86_64</string>
<string>armv7</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (BOOL)verify:(NSData *)data withSignature:(nullable NSData *)signature usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey *key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error;

+ (BOOL)verify:(NSData *)data withSignature:(nullable NSData *)signature usingKeys:(NSArray<PGPKey *> *)keys certifyWithRootKey:(BOOL)certifyWithRootKey passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey *key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error;

/**
Verify if signature was signed with one of the given keys.
*/
Expand Down Expand Up @@ -109,14 +111,41 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (nullable NSData *)decrypt:(NSData *)data andVerifySignature:(BOOL)verifySignature usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error;

+ (nullable NSData *)decrypt:(NSData *)data verified:(BOOL * _Nullable)verified usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseForKeyBlock decryptionError:(NSError * __autoreleasing _Nullable *)decryptionError verificationError:(NSError * __autoreleasing _Nullable *)verificationError;
/**
Decrypt PGP encrypted data.
@param data data to decrypt.
@param verified Verification result code. It is 0 if success, else the verification error code.
@param keys private keys to use.
@param passphraseForKeyBlock Optional. Handler for passphrase protected keys. Return passphrase for a key in question.
@param decryptionError Optional. Error of decryption phase.
@param verificationError Optional. Error of verification phase..
@return Decrypted data, or `nil` if failed.
*/
+ (nullable NSData *)decrypt:(NSData *)data verified:(int * _Nullable)verified usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseForKeyBlock decryptionError:(NSError * __autoreleasing _Nullable *)decryptionError verificationError:(NSError * __autoreleasing _Nullable *)verificationError;

/**
Decrypt PGP encrypted data.
@param data data to decrypt.
@param verified Verification result code. It is 0 if success, else the verification error code.
@param certifyWithRootKey `YES` if signer key should verify with a root key.
@param keys private keys to use.
@param passphraseForKeyBlock Optional. Handler for passphrase protected keys. Return passphrase for a key in question.
@param decryptionError Optional. Error of decryption phase.
@param verificationError Optional. Error of verification phase..
@return Decrypted data, or `nil` if failed.
*/

+ (nullable NSData *)decrypt:(NSData *)data verified:(int * _Nullable)verified certifyWithRootKey:(BOOL)certifyWithRootKey usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseForKeyBlock decryptionError:(NSError * __autoreleasing _Nullable *)decryptionError verificationError:(NSError * __autoreleasing _Nullable *)verificationError;


/**
Return list of key identifiers used in the given message. Determine keys that a message has been encrypted.
*/
+ (nullable NSArray<PGPKeyID *> *)recipientsKeyIDForMessage:(NSData *)data error:(NSError * __autoreleasing _Nullable *)error;


@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ NS_SWIFT_NAME(Fingerprint) @interface PGPFingerprint : NSObject
- (NSString *)description;
- (NSUInteger)hashLength;

- (NSData*)exportV4HashedData;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ NS_SWIFT_NAME(KeyGenerator) @interface PGPKeyGenerator : NSObject
@property (nonatomic) PGPPublicKeyAlgorithm keyAlgorithm;
@property (nonatomic) PGPSymmetricAlgorithm cipherAlgorithm;
@property (nonatomic) PGPHashAlgorithm hashAlgorithm;
@property (nonatomic) PGPCurve curveKind;
@property (nonatomic) UInt8 version;
@property (nonatomic) NSDate *createDate;

- (PGPKey *)generateFor:(NSString *)userID passphrase:(nullable NSString *)passphrase;

- (instancetype)initWithAlgorithm:(PGPPublicKeyAlgorithm)algorithm keyBitsLength:(int)bits cipherAlgorithm:(PGPSymmetricAlgorithm)cipherAlgorithm hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ typedef NS_ERROR_ENUM(PGPErrorDomain, PGPErrorCode) {
/// Invalid PGP message. Invalid or corrupted data that can't be processed.
PGPErrorInvalidMessage = 9,
PGPErrorMissingSignature = 10,
PGPErrorNotFound = 11
PGPErrorNotFound = 11,
// for check signature with rootCA
PGPErrorMissingPublicKeySignature = 12,
PGPErrorMissingRootPublicKey = 13,
PGPErrorInvalidRootPublicKey = 14

};

typedef NS_CLOSED_ENUM(NSInteger, PGPFormatType) {
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ FOUNDATION_EXPORT const unsigned char ObjectivePGPVersionString[];
#import <ObjectivePGP/PGPEncryptedSessionKeyPacketProtocol.h>
#import <ObjectivePGP/PGPSymmetricallyEncryptedDataPacket.h>
#import <ObjectivePGP/PGPMarkerPacket.h>
#import <ObjectivePGP/PGPKeySpec.h>
#import <ObjectivePGP/PGPEC.h>
#import <ObjectivePGP/PGPPKCSEmsa.h>
#import <ObjectivePGP/PGPPKCSEme.h>
Expand All @@ -68,6 +69,7 @@ FOUNDATION_EXPORT const unsigned char ObjectivePGPVersionString[];
#import <ObjectivePGP/PGPPublicKeyPacket+Private.h>
#import <ObjectivePGP/PGPSignatureSubpacket+Private.h>
#import <ObjectivePGP/PGPSignaturePacket+Private.h>
#import <ObjectivePGP/twofish.h>
#import <ObjectivePGP/PGPKey+Private.h>
#import <ObjectivePGP/PGPPacketFactory.h>
#import <ObjectivePGP/PGPKeyring+Private.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ PGP_EMPTY_INIT_UNAVAILABLE

- (instancetype)initWithHashAlgorithm:(PGPHashAlgorithm)hashAlgorithm symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm;

+ (instancetype)defaultParameters;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ NS_SWIFT_NAME(CurveOID) @interface PGPCurveOID : NSObject <PGPExportable>
PGP_EMPTY_INIT_UNAVAILABLE;

- (nullable instancetype)initWithIdentifierData:(NSData *)identifierData NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCurveKind:(PGPCurve)kind;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//

#import "PGPSecretKeyPacket.h"
#import "PGPKeyMaterial.h"
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -23,8 +24,11 @@ PGP_EMPTY_INIT_UNAVAILABLE;

+ (BOOL)publicEncrypt:(nonnull NSData *)data withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket publicKey:(NSData * __autoreleasing _Nullable * _Nullable)publicKey encodedSymmetricKey:(NSData * __autoreleasing _Nullable * _Nullable)encodedSymmetricKey;

+ (NSArray<PGPMPI *> *)sign:(NSData *)toSign key:(PGPKey *)key;
+ (BOOL)verify:(NSData *)toVerify signature:(PGPSignaturePacket *)signaturePacket withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket;
+ (NSArray<PGPMPI *> *)sign:(NSData *)toSign key:(PGPKey *)key withHashAlgorithm:(PGPHashAlgorithm)hashAlgorithm;
+ (BOOL)verify:(NSData *)toVerify signature:(PGPSignaturePacket *)signaturePacket withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket withHashAlgorithm:(PGPHashAlgorithm)hashAlgorithm;

//new keys
+ (nullable PGPKeyMaterial *)generateNewKeyMPIArray:(PGPCurve)curve;

@end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright (C) Marcin Krzyżanowski <[email protected]>
// This software is provided 'as-is', without any express or implied warranty.
//
// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY
// INTERNATIONAL COPYRIGHT LAW. USAGE IS BOUND TO THE LICENSE AGREEMENT.
// This notice may not be removed from this file.
//
//

#import <Foundation/Foundation.h>
#import <ObjectivePGP/PGPTypes.h>
#import <ObjectivePGP/PGPCurveOID.h>
#import <ObjectivePGP/PGPCurveKDFParameters.h>

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(KeySpec) @interface PGPKeySpec : NSObject

@property (nonatomic) PGPPublicKeyAlgorithm keyAlgorithm;
@property (nonatomic) PGPCurveOID *curve;
@property (nonatomic) PGPCurveKDFParameters *kdfParameters;
@property (nonatomic) int keyBitsLength;

- (instancetype)initWithKeyAlgorithm:(PGPPublicKeyAlgorithm)algorithm withCurve:(PGPCurve)curve withKdfParameters:(PGPCurveKDFParameters*)kdfParameters;

- (instancetype)initWithKeyAlgorithm:(PGPPublicKeyAlgorithm)algorithm withKeyBitsLength:(int)keyBitsLength;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)verifyData:(NSData *)inputData publicKey:(PGPKey *)publicKey error:(NSError * __autoreleasing _Nullable *)error;
- (BOOL)verifyData:(NSData *)inputData publicKey:(PGPKey *)publicKey userID:(nullable NSString *)userID error:(NSError * __autoreleasing _Nullable *)error;
- (BOOL)verifyData:(NSData *)inputData publicKey:(PGPKey *)publicKey signingKeyPacket:(PGPPublicKeyPacket *)signingKeyPacket userID:(nullable NSString *)userID error:(NSError * __autoreleasing _Nullable *)error;
- (BOOL)verifyCertificateSignature:(PGPKey*)publicKey rootCert:(PGPKey*)rootKey userID:(nullable NSString*)userID error:(NSError* __autoreleasing _Nullable*) error;

@end

Expand Down
Loading

0 comments on commit 534781b

Please sign in to comment.