3 Commits

Author SHA1 Message Date
Leo Vandriel c91a8e08c4 Merge pull request #62 from ClementPadovani/hotfix/make_plain_text_great_again
Removed all notions of rich text and disabled “smart” additions
2018-01-26 12:52:31 -08:00
Clément Padovani 6a8a48dfd9 Removed all notions of rich text and disabled “smart” additions 2017-12-30 20:50:11 +01:00
Leo 5b46a5c6de add certificate type to description 2017-04-26 11:06:32 -07:00
7 changed files with 66 additions and 38 deletions
+2
View File
@@ -3,6 +3,8 @@ Change Log
### master (unreleased)
* add certificate type to description
### 0.7.5 (2017-04-25)
* Add support for new certificate type (passes)
+3
View File
@@ -43,6 +43,9 @@
/** @name Inspection */
/** Extracts the type and summary string. */
+ (NWCertType)typeWithCertificate:(NWCertificateRef)certificate summary:(NSString **)summary;
/** Extracts the summary string. */
+ (NSString *)summaryWithCertificate:(NWCertificateRef)certificate;
-27
View File
@@ -7,33 +7,6 @@
#import "NWSecTools.h"
/** Types of push certificates. */
typedef NS_ENUM(NSInteger, NWCertType) {
/** None. */
kNWCertTypeNone = 0,
/** iOS Development. */
kNWCertTypeIOSDevelopment = 1,
/** iOS Production. */
kNWCertTypeIOSProduction = 2,
/** OS X Development. */
kNWCertTypeMacDevelopment = 3,
/** OS X Production. */
kNWCertTypeMacProduction = 4,
/** Simplified Certificate Handling. */
kNWCertTypeSimplified = 5,
/** Web Push Production. */
kNWCertTypeWebProduction = 6,
/** VoIP Services. */
kNWCertTypeVoIPServices = 7,
/** WatchKit Services. */
kNWCertTypeWatchKitServices = 8,
/** Pass Type ID. */
kNWCertTypePasses = 9,
/** Unknown. */
kNWCertTypeUnknown = 10,
};
@implementation NWSecTools
#pragma mark - Initialization
+27
View File
@@ -17,6 +17,32 @@ typedef NS_ENUM(NSInteger, NWNotificationType) {
kNWNotificationType2 = 2,
};
/** Types of push certificates. */
typedef NS_ENUM(NSInteger, NWCertType) {
/** None. */
kNWCertTypeNone = 0,
/** iOS Development. */
kNWCertTypeIOSDevelopment = 1,
/** iOS Production. */
kNWCertTypeIOSProduction = 2,
/** OS X Development. */
kNWCertTypeMacDevelopment = 3,
/** OS X Production. */
kNWCertTypeMacProduction = 4,
/** Simplified Certificate Handling. */
kNWCertTypeSimplified = 5,
/** Web Push Production. */
kNWCertTypeWebProduction = 6,
/** VoIP Services. */
kNWCertTypeVoIPServices = 7,
/** WatchKit Services. */
kNWCertTypeWatchKitServices = 8,
/** Pass Type ID. */
kNWCertTypePasses = 9,
/** Unknown. */
kNWCertTypeUnknown = 10,
};
/** An ARC-friendly replacement of SecIdentityRef. */
typedef id NWIdentityRef;
@@ -193,6 +219,7 @@ extern NSString * const NWErrorReasonCodeKey;
/** Returns string for given environment, for logging purposes */
NSString * descriptionForEnvironentOptions(NWEnvironmentOptions environmentOptions);
NSString * descriptionForEnvironent(NWEnvironment environment);
NSString * descriptionForCertType(NWCertType type);
@interface NWErrorUtil : NSObject
+18
View File
@@ -31,6 +31,24 @@ NSString * descriptionForEnvironent(NWEnvironment environment)
return nil;
}
NSString * descriptionForCertType(NWCertType type)
{
switch (type) {
case kNWCertTypeNone: return @"none";
case kNWCertTypeIOSDevelopment:
case kNWCertTypeIOSProduction: return @"iOS";
case kNWCertTypeMacDevelopment:
case kNWCertTypeMacProduction: return @"macOS";
case kNWCertTypeSimplified: return @"All";
case kNWCertTypeWebProduction: return @"Website";
case kNWCertTypeVoIPServices: return @"VoIP";
case kNWCertTypeWatchKitServices: return @"WatchKit";
case kNWCertTypePasses: return @"Pass";
case kNWCertTypeUnknown: return @"unknown";
}
return nil;
}
@implementation NWErrorUtil
+ (NSString *)stringWithCode:(NWError)code
+12 -9
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12118"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -159,7 +159,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="600" height="300"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
<value key="minSize" type="size" width="500" height="200"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
@@ -233,7 +233,7 @@
</popUpButtonCell>
</popUpButton>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EnU-aP-5PD">
<rect key="frame" x="464" y="177" width="118" height="24"/>
<rect key="frame" x="456" y="177" width="126" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="Olm-G5-Man">
<font key="font" metaFont="system"/>
<segments>
@@ -258,7 +258,7 @@
<action selector="push:" target="kaW-YJ-UA5" id="hXv-2c-nZa"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M70-t1-JuG">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="M70-t1-JuG">
<rect key="frame" x="18" y="23" width="486" height="14"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="d6h-q1-H0e">
<font key="font" metaFont="smallSystem"/>
@@ -272,7 +272,7 @@
<rect key="frame" x="1" y="1" width="558" height="128"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView importsGraphics="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="ad5-lb-L5u">
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="panel" allowsCharacterPickerTouchBarItem="NO" allowsUndo="YES" allowsNonContiguousLayout="YES" textCompletion="NO" id="ad5-lb-L5u">
<rect key="frame" x="0.0" y="0.0" width="558" height="128"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -287,6 +287,9 @@
</fragment>
</attributedString>
<color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
<connections>
<outlet property="delegate" destination="kaW-YJ-UA5" id="bUh-Oq-w5B"/>
</connections>
@@ -303,7 +306,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gQs-Aa-IJi">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gQs-Aa-IJi">
<rect key="frame" x="470" y="49" width="104" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="Vlu-lQ-8rQ"/>
@@ -320,7 +323,7 @@
<rect key="frame" x="1" y="1" width="558" height="128"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView importsGraphics="NO" richText="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="pi6-RR-ayT">
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="pi6-RR-ayT">
<rect key="frame" x="0.0" y="0.0" width="558" height="128"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -350,7 +353,7 @@
<action selector="sanboxCheckBoxDidPressed:" target="kaW-YJ-UA5" id="kzM-IO-iQv"/>
</connections>
</button>
<comboBox verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xpc-0j-elb">
<comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xpc-0j-elb">
<rect key="frame" x="20" y="208" width="563" height="23"/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" enabled="NO" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Device push token (only first 64 hex chars used, other text is ignored)" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="Dzy-yi-6QY">
<font key="font" size="10" name="Monaco"/>
+4 -2
View File
@@ -170,11 +170,13 @@
NWCertificateRef certificate = pair[0];
BOOL hasIdentity = (pair[1] != NSNull.null);
NWEnvironmentOptions environmentOptions = [NWSecTools environmentOptionsForCertificate:certificate];
NSString *summary = [NWSecTools summaryWithCertificate:certificate];
NSString *summary = nil;
NWCertType certType = [NWSecTools typeWithCertificate:certificate summary:&summary];
NSString *type = descriptionForCertType(certType);
NSDate *date = [NWSecTools expirationWithCertificate:certificate];
NSString *expire = [NSString stringWithFormat:@" [%@]", date ? [formatter stringFromDate:date] : @"expired"];
// summary = @"com.example.app";
[_certificatePopup addItemWithTitle:[NSString stringWithFormat:@"%@%@ (%@)%@%@", hasIdentity ? @"imported: " : @"", summary, descriptionForEnvironentOptions(environmentOptions), expire, suffix]];
[_certificatePopup addItemWithTitle:[NSString stringWithFormat:@"%@%@ (%@ %@)%@%@", hasIdentity ? @"imported: " : @"", summary, type, descriptionForEnvironentOptions(environmentOptions), expire, suffix]];
[suffix appendString:@" "];
}
[_certificatePopup addItemWithTitle:@"Import PKCS #12 file (.p12)..."];