Skip to content
Snippets Groups Projects
Select Git revision
  • 5f9d98a061042f83b7c2458be0e7fd2bd7d5e9e9
  • dev default protected
  • 316-tracking-estimator
  • Thesis_hannes_merge_ready_versuch1
  • InboxWithNewOverview
  • 298-missing-backend-features-connections-for-ui
  • 293-integrate-attachment-functionality-in-new-composeview
  • 299-add-pull-to-refresh-to-maillistview
  • 290+Dev
  • 290-redesign-the-ContactView
  • 291-add-research-face-prototype
  • 292-add-comments-to-attachmentviewmain-swift
  • 302-fix-bug-attachment-previews-of-incoming-mails
  • 288-make-folders-list-slide-in-from-the-left-instead-of-from-the-right
  • 295-inboxview-maillistview-improvements
  • 294-fix-bugs-in-new-composeview
  • 287-redesign-composeview
  • updatePGP
  • 282-Implement-missing-functions-in-reply-button
  • 286-update-openssl
  • ThesisHannesV2_
  • runnable
  • optional_UI_change
  • dep
  • NoTestCase
25 results

PGPKey.h

  • user avatar
    Oliver Wiese authored
    a3cb6573
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    PGPKey.h 1.85 KiB
    //
    //  Copyright (c) Marcin Krzyżanowski. All rights reserved.
    //
    //  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 "PGPPartialKey.h"
    #import "PGPTypes.h"
    
    #import "PGPExportableProtocol.h"
    #import <Foundation/Foundation.h>
    
    NS_ASSUME_NONNULL_BEGIN
    
    /// Public + Private key with the same ID.
    NS_SWIFT_NAME(Key) @interface PGPKey : NSObject <PGPExportable, NSCopying>
    
    PGP_EMPTY_INIT_UNAVAILABLE;
    
    /// Key ID
    @property (nonatomic, readonly) PGPKeyID *keyID;
    @property (nonatomic, nullable, copy, readonly) PGPPartialKey *secretKey;
    @property (nonatomic, nullable, copy, readonly) PGPPartialKey *publicKey;
    @property (nonatomic, nullable, readonly) NSDate *expirationDate;
    
    /// Whether key is secret.
    @property (nonatomic, readonly) BOOL isSecret;
    /// Whether key is public.
    @property (nonatomic, readonly) BOOL isPublic;
    /// Whether key is encrypted
    @property (nonatomic, readonly) BOOL isEncryptedWithPassword;
    
    @property (nonatomic, nullable, readonly) PGPSecretKeyPacket *signingSecretKey;
    
    
    /// Initialize the key with partial keys
    - (instancetype)initWithSecretKey:(nullable PGPPartialKey *)secretKey publicKey:(nullable PGPPartialKey *)publicKey NS_DESIGNATED_INITIALIZER;
    
    /**
    *  Decrypts key.
    *  Warning: It is not good idea to keep decrypted key around
    *
    *  @param passphrase Passphrase
    *  @param error      error
    *
    *  @return Decrypted key, or `nil`.
    */
    - (nullable PGPKey *)decryptedWithPassphrase:(NSString *)passphrase error:(NSError * __autoreleasing _Nullable *)error;
    
    
    /// The binary format.
    /// @discussion If you need ASCII format, you can use `PGPArmor`.
    - (nullable NSData *)export:(PGPKeyType)keyType error:(NSError * __autoreleasing _Nullable *)error NS_SWIFT_NAME(export(keyType:));
    
    @end
    
    NS_ASSUME_NONNULL_END