2
0

Compare commits

...

86 Commits

Author SHA1 Message Date
Maarten Billemont
67e18895ab Update Android APK to fix scrypt issue. 2017-02-09 23:33:04 -05:00
Maarten Billemont
8b7cf2e86d Instructions, so I don't forget. 2017-02-09 23:31:22 -05:00
Maarten Billemont
a267c0d1db APK release configuration. 2017-02-09 23:25:42 -05:00
Maarten Billemont
f60093513e Change to new masterpassword.keystore 2017-02-09 22:59:22 -05:00
Maarten Billemont
5b47d47a1b Android 2.4.1 2017-02-09 22:54:20 -05:00
Maarten Billemont
f8f48743b0 Fix native scrypt on Android. 2017-02-09 00:48:07 -05:00
Maarten Billemont
b46bf25c19 Migrate to Gradle. 2017-02-06 11:16:04 -05:00
Maarten Billemont
e754e1ddce Evaluate the speed of the first and second stage of mpw individually. 2017-01-05 10:58:02 -05:00
Maarten Billemont
0f4a66f5d3 Fix setupterm error evaluation. 2016-11-10 11:15:23 -05:00
Maarten Billemont
3036697004 Don't exit if TERM is not set and color is enabled; setupterm is strange.. 2016-11-06 11:19:52 -05:00
Maarten Billemont
097d240feb Fix leak and segfault wrt reading MP_FULLNAME 2016-11-06 11:17:02 -05:00
Maarten Billemont
dd9e4eafbc lineSize needs to be > 1. 2016-11-06 10:42:23 -05:00
Maarten Billemont
2199757d9b Build and Travis fix. 2016-11-03 20:13:43 -04:00
Maarten Billemont
00887f6277 Travis. 2016-11-03 19:45:37 -04:00
Maarten Billemont
21945ae23f Try to fix Travis builds again. 2016-11-03 16:46:58 -04:00
Maarten Billemont
d3f2a01da2 Fix memory leaks, thanks @daltomi - #134. 2016-11-03 10:31:07 -04:00
Maarten Billemont
f427e06692 Change the names of some utility functions to be more standard and consistent. 2016-11-03 10:04:18 -04:00
Maarten Billemont
73421b3299 Merge branch 'master' of github.com:Lyndir/MasterPassword 2016-10-29 09:29:13 -04:00
Maarten Billemont
564e5d9084 Standardize mpw-wide constants and explain their purpose, also allow non-home .mpw.d. 2016-10-29 09:29:01 -04:00
Maarten Billemont
88d818833c Merge pull request #110 from joshterrill/master
fixed wording on set password dialog
2016-10-29 08:24:21 -04:00
Maarten Billemont
0498a245c6 Some minor code improvements. 2016-10-29 08:18:20 -04:00
Maarten Billemont
77bb2ef4cd Merge pull request #118 from joelsnape/master
Corrected conversion exception (from long to UnsignedInteger) on linux oracle and open jdk.
2016-10-29 07:55:36 -04:00
Maarten Billemont
207b375ae9 Fix version number parsing. 2016-10-27 14:49:02 -04:00
Maarten Billemont
c1f4d2db24 Merge branch 'master' of github.com:Lyndir/MasterPassword 2016-10-27 14:24:49 -04:00
Maarten Billemont
ca3a8ee78c Update Master Password Web version to support all algorithm versions and Tom's latest mpw-js. 2016-10-27 14:14:58 -04:00
Maarten Billemont
e88ec0927e Merge pull request #108 from rolandog/patch-1
Prevented domain name and password leakage
2016-10-27 14:13:20 -04:00
Maarten Billemont
e6774592d7 Merge pull request #121 from nat13ejo/master
Modified the symlink in mpw_test.xml to point to the new location of mpw_test.xml
2016-10-27 14:12:20 -04:00
Emil Johansson
6834f3689f Modified the symlink in mpw_test.xml to point to the new location of
the file at ../Java/masterpassword-tests/src/main/resources/mpw_tests.xml

Fixes #120
2016-10-22 10:26:29 +02:00
Maarten Billemont
c2fc5e6072 Merge pull request #119 from nat13ejo/master
Added the option "-selection clip" to the xclip command. This fixes
2016-10-21 16:04:51 -04:00
Emil Johansson
ade5c274b1 Added the option "-selection clip" to the xclip command. This fixes
the bugg that the automatic copying to the clipboard accesible with
ctrl-V in applications like in e.g firefox is not working in OpenSUSE
41.1 and i suspect in other Linux distros as well.
2016-10-20 22:33:11 +02:00
Joel Snape
1da235bbdf Corrected conversion exception (from long to UnsignedInteger) on linux oracle and open jdk. 2016-10-08 20:51:19 +01:00
Maarten Billemont
b050cc4994 Build fixes. 2016-09-22 18:17:19 -04:00
Maarten Billemont
3e31dac7e0 Update project for Xcode 8, finally with named provisioning profile identifiers! 2016-09-22 17:37:21 -04:00
Maarten Billemont
eea9051dbb Adjust mpw-bench to compare to hmac-sha-256 instead of sha-256, their performance characteristics are quite different. 2016-08-24 00:07:58 -04:00
Maarten Billemont
d560a2052d Mac update. 2016-08-17 18:36:39 -04:00
Maarten Billemont
af7edd05d4 Make TouchID optional. 2016-08-17 18:34:32 -04:00
Joshua Terrill
33f817a585 fixed wording on set password dialog
The wordong says "Click 'Change Password' ...", but the button says "Set Password", not "Change Password".
2016-08-02 00:11:37 -07:00
Maarten Billemont
e2d3f14fdf Fix a crash when the master key could not be computed. 2016-07-23 11:44:17 -04:00
Maarten Billemont
e205926c8c Bump Crashlytics. 2016-07-21 20:07:20 -04:00
Maarten Billemont
d48494a566 Update Master Password for Mac. 2016-07-21 20:06:37 -04:00
Maarten Billemont
00ad9d59ca Better fix to Mac user getting logged out after the app is locked. 2016-07-21 20:03:47 -04:00
Maarten Billemont
af7327555c Merge branch 'master' of github.com:Lyndir/MasterPassword 2016-07-21 10:02:35 -04:00
Maarten Billemont
1977a423a5 Move a few batches of UI work into the main thread. 2016-07-21 09:59:37 -04:00
Maarten Billemont
fa588f8fe2 Update Crashlytics. 2016-07-19 12:06:22 -04:00
Maarten Billemont
ba00d89b99 Fix some potential crashes and memory leaks. 2016-07-19 12:00:19 -04:00
Maarten Billemont
c498d8b1ec Merge pull request #109 from dkunzler/master
fix mpsites export on Java
2016-07-06 15:22:14 -04:00
David Kunzler
e6b398d09d fix mpsites export on Java 2016-07-06 20:23:45 +02:00
Maarten Billemont
a72d893203 Include the build in the short version string. 2016-07-06 01:24:58 -04:00
Maarten Billemont
a5368033a3 Default to Long on invalid type. 2016-07-06 01:18:35 -04:00
Maarten Billemont
588ebe08cd Fix crash when default type is not a generated type, when password is unset and don't crash for fatals. 2016-07-06 01:16:10 -04:00
Maarten Billemont
28bd162e05 Fixed issue when signing out on iOS + issue with biometrics not getting enabled properly after enabling TouchID. 2016-07-05 20:15:18 -04:00
Maarten Billemont
2897bc741c Version can't be > 18 chars, so use the major as the repeater. 2016-07-02 09:46:42 -04:00
Maarten Billemont
e11e73c0db Little hack to work around stupid iTunesConnect restriction. 2016-07-02 09:29:50 -04:00
Maarten Billemont
672d8ba089 Update Master Password for Mac. 2016-07-02 09:18:55 -04:00
Maarten Billemont
3a70d5e38d Don't forget the active user when signing out, so sign-in can re-use the same user.
Also fix some deprecated method usages.
2016-07-02 09:04:31 -04:00
Maarten Billemont
b9298996e8 Make Reveal weak. 2016-06-04 12:01:20 -04:00
Maarten Billemont
28afa1a56d Bump Pearl. 2016-06-04 11:52:17 -04:00
Maarten Billemont
17cc647cf5 Turn off tests. 2016-06-04 11:38:37 -04:00
Maarten Billemont
9863fbb073 Bump Crashlytics. 2016-06-04 11:29:21 -04:00
Maarten Billemont
49398bb9f0 Another attempt at fixing dumb xctool bugs. 2016-06-04 11:27:37 -04:00
Maarten Billemont
b52b310e82 Fix saving of user after sign-in. 2016-06-04 10:44:43 -04:00
Maarten Billemont
6a74ada2fa Dismiss keyboard if active when opening question answers. 2016-06-04 10:14:19 -04:00
Maarten Billemont
c8a40a7062 Build fix for iOS. 2016-06-04 09:52:19 -04:00
Maarten Billemont
2889c73af3 Let's call it 'Desktop' now. 2016-05-16 08:46:55 -04:00
Maarten Billemont
9249967c6f Bump master password mac and distribute via the website instead of through the app store. 2016-05-16 08:44:06 -04:00
Maarten Billemont
24f5ceac51 Fix misplaced frames. 2016-05-16 08:36:14 -04:00
Maarten Billemont
060059ff0c Bugfixes, a gradient backdrop behind bottom buttons and support for generated login names. 2016-05-16 00:50:17 -04:00
Maarten Billemont
0f7793e9ba Fix "full screen" menu item not updating when toggled. 2016-05-15 00:14:41 -04:00
Maarten Billemont
a4cf7f9f3c Mac 2.4 beta. 2016-05-02 11:42:34 -04:00
Maarten Billemont
8978433aed fadeIn/fadeOut cleanup. 2016-04-30 18:09:27 -04:00
Maarten Billemont
b4efe301a4 Fix issues with focus and tips in security questions panel. 2016-04-30 18:06:23 -04:00
Maarten Billemont
9a82e617b3 Fix copy/paste/undo/redo editing hotkeys. 2016-04-30 17:41:51 -04:00
Maarten Billemont
2647279ff6 Only reset the frame size and position if switching window level. 2016-04-30 15:48:10 -04:00
Maarten Billemont
dae84c4a2e Manually fix hardcoded absolute paths, silly Xcode. 2016-04-25 11:13:24 -04:00
Maarten Billemont
3b74543c51 Security answer generation for question keywords. 2016-04-23 23:56:16 -04:00
Maarten Billemont
1918c30bed Wire up some of the security answers UI. Still WIP. 2016-04-23 14:07:08 -04:00
Maarten Billemont
bbeb6bb948 Fix deprecated NSAlert usage. 2016-04-23 12:22:15 -04:00
Maarten Billemont
15b14d67db Improvements to layout, password types and preparations for security answers. 2016-04-23 11:54:13 -04:00
Maarten Billemont
35c443d82d Support for windowed Master Password window on OS X, some UI improvements and modern version of window translucency. 2016-04-17 19:30:06 -04:00
Maarten Billemont
d950d4be3b Improvements to the question UI. 2016-04-17 16:29:37 -04:00
Maarten Billemont
d7aae64b5d Fix appearance of UI on Mac. 2016-04-16 17:22:11 -04:00
rolandog
657e4c8a9d Prevented domain name and password leakage
This prevents a user from logging in with any password into a tab that was left open and being able to view the last domain name and generated password.
2016-04-01 23:01:55 +00:00
Maarten Billemont
f238bb723d WIP - upgrade to tmthrgd latest code. 2016-03-05 16:57:58 -05:00
Maarten Billemont
b4da801bb0 Skip existing files when uploading to s3. 2016-02-21 11:51:32 -05:00
Maarten Billemont
ce7aa46af6 Bump masterpassword-android to 2.4. 2016-02-21 09:08:02 -05:00
Maarten Billemont
83c28692ad [maven-release-plugin] rollback changes from release preparation of 2.4-java 2016-02-20 22:29:27 -05:00
172 changed files with 2600 additions and 1590 deletions

4
.gitmodules vendored
View File

@@ -16,6 +16,6 @@
[submodule "External/jrswizzle"]
path = External/jrswizzle
url = git://github.com/jonmarimba/jrswizzle.git
[submodule "Site/mpw-js/js/mpw-js"]
path = Site/mpw-js/js/mpw-js
[submodule "MasterPassword/Web/js/mpw-js"]
path = MasterPassword/Web/js/mpw-js
url = https://github.com/tmthrgd/mpw-js.git

View File

@@ -1,8 +1,6 @@
language: objective-c
osx_image: xcode7
xcode_scheme: MasterPassword iOS (App Store)
xcode_workspace: MasterPassword.xcworkspace
xcode_sdk: iphonesimulator
env: TERM=dumb
osx_image: xcode8
env: TERM=dumb SHLVL=0
git:
submodules: true
script: xcodebuild -workspace MasterPassword.xcworkspace -scheme 'MasterPassword iOS (App Store)' -configuration 'AdHoc-iOS' -sdk iphonesimulator

View File

@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)stackFrameWithSymbol:(NSString *)symbol;
@property (nonatomic, copy, nullable) NSString *symbol;
@property (nonatomic, copy, nullable) NSString *rawSymbol;
@property (nonatomic, copy, nullable) NSString *library;
@property (nonatomic, copy, nullable) NSString *fileName;
@property (nonatomic, assign) uint32_t lineNumber;

View File

@@ -18,7 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
@protocol CrashlyticsDelegate;
/**
* Crashlytics. Handles configuration and initialization of Crashlytics.
* Crashlytics. Handles configuration and initialization of Crashlytics.
*
* Note: The Crashlytics class cannot be subclassed. If this is causing you pain for
* testing, we suggest using either a wrapper class or a protocol extension.
*/
@interface Crashlytics : NSObject

View File

@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>14F1021</string>
<string>15F34</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.6.0</string>
<string>3.7.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
@@ -25,27 +25,29 @@
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>99</string>
<string>112</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7B91b</string>
<string>7D175</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15A278</string>
<string>15E60</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0730</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7D175</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Crashlytics, Inc. All rights reserved.</string>
<string>Copyright © 2016 Crashlytics, Inc. All rights reserved.</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>4</integer>
</array>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.6.4</string>
<string>1.6.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
@@ -25,27 +25,29 @@
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>45</string>
<string>53</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7B91b</string>
<string>7C1002</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15A278</string>
<string>15C43</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0721</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7C1002</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Twitter. All rights reserved.</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>4</integer>
</array>
</dict>
</plist>

Binary file not shown.

2
External/Pearl vendored

Binary file not shown.

View File

@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @param signUpMethodOrNil The method by which a user logged in, e.g. Twitter or Digits.
* @param signUpSucceededOrNil The ultimate success or failure of the login
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
*/
+ (void)logSignUpWithMethod:(nullable NSString *)signUpMethodOrNil
success:(nullable NSNumber *)signUpSucceededOrNil
@@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @param loginMethodOrNil The method by which a user logged in, e.g. email, Twitter or Digits.
* @param loginSucceededOrNil The ultimate success or failure of the login
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
*/
+ (void)logLoginWithMethod:(nullable NSString *)loginMethodOrNil
success:(nullable NSNumber *)loginSucceededOrNil
@@ -61,7 +61,7 @@ NS_ASSUME_NONNULL_BEGIN
* your application.
*
* @param inviteMethodOrNil The method of invitation, e.g. GameCenter, Twitter, email.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
*/
+ (void)logInviteWithMethod:(nullable NSString *)inviteMethodOrNil
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
@@ -74,8 +74,8 @@ NS_ASSUME_NONNULL_BEGIN
* @param currencyOrNil The ISO4217 currency code. Example: USD
* @param purchaseSucceededOrNil Was the purchase succesful or unsuccesful
* @param itemNameOrNil The human-readable form of the item's name. Example:
* @param itemIdOrNil The machine-readable, unique item identifier Example: SKU
* @param itemTypeOrNil The type, or genre of the item. Example: Song
* @param itemIdOrNil The machine-readable, unique item identifier Example: SKU
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
*/
+ (void)logPurchaseWithPrice:(nullable NSDecimalNumber *)itemPriceOrNil
@@ -101,7 +101,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param levelNameOrNil The name of the level completed, E.G. "1" or "Training"
* @param scoreOrNil The score the user completed the level with.
* @param levelCompletedSuccesfullyOrNil A boolean representing whether or not the level was completed succesfully.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
*/
+ (void)logLevelEnd:(nullable NSString *)levelNameOrNil
score:(nullable NSNumber *)scoreOrNil
@@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param itemNameOrNil The human-readable form of the item's name. Example:
* @param itemTypeOrNil The type, or genre of the item. Example: Song
* @param itemIdOrNil The machine-readable, unique item identifier Example: SKU
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
*/
+ (void)logAddToCartWithPrice:(nullable NSDecimalNumber *)itemPriceOrNil
currency:(nullable NSString *)currencyOrNil
@@ -135,7 +135,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param totalPriceOrNil The total price of the cart.
* @param currencyOrNil The ISO4217 currency code. Example: USD
* @param itemCountOrNil The number of items in the cart.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
*/
+ (void)logStartCheckoutWithPrice:(nullable NSDecimalNumber *)totalPriceOrNil
currency:(nullable NSString *)currencyOrNil
@@ -188,7 +188,7 @@ NS_ASSUME_NONNULL_BEGIN
* the name of the event, since this is how the event will appear in Answers.
*
* @param eventName The human-readable name for the event.
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase. Attribute keys
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event. Attribute keys
* must be <code>NSString</code> and and values must be <code>NSNumber</code> or <code>NSString</code>.
* @discussion How we treat <code>NSNumbers</code>:
* We will provide information about the distribution of values over time.

View File

@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)stackFrameWithSymbol:(NSString *)symbol;
@property (nonatomic, copy, nullable) NSString *symbol;
@property (nonatomic, copy, nullable) NSString *rawSymbol;
@property (nonatomic, copy, nullable) NSString *library;
@property (nonatomic, copy, nullable) NSString *fileName;
@property (nonatomic, assign) uint32_t lineNumber;

View File

@@ -18,7 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
@protocol CrashlyticsDelegate;
/**
* Crashlytics. Handles configuration and initialization of Crashlytics.
* Crashlytics. Handles configuration and initialization of Crashlytics.
*
* Note: The Crashlytics class cannot be subclassed. If this is causing you pain for
* testing, we suggest using either a wrapper class or a protocol extension.
*/
@interface Crashlytics : NSObject
@@ -181,6 +184,21 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)recordCustomExceptionName:(NSString *)name reason:(nullable NSString *)reason frameArray:(CLS_GENERIC_NSARRAY(CLSStackFrame *) *)frameArray;
/**
*
* This allows you to record a non-fatal event, described by an NSError object. These events will be grouped and
* displayed similarly to crashes. Keep in mind that this method can be expensive. Also, the total number of
* NSErrors that can be recorded during your app's life-cycle is limited by a fixed-size circular buffer. If the
* buffer is overrun, the oldest data is dropped. Errors are relayed to Crashlytics on a subsequent launch
* of your application.
*
* You can also use the -recordError:withAdditionalUserInfo: to include additional context not represented
* by the NSError instance itself.
*
**/
- (void)recordError:(NSError *)error;
- (void)recordError:(NSError *)error withAdditionalUserInfo:(nullable CLS_GENERIC_NSDICTIONARY(NSString *, id) *)userInfo;
- (void)logEvent:(NSString *)eventName CLS_DEPRECATED("Please refer to Answers +logCustomEventWithName:");
- (void)logEvent:(NSString *)eventName attributes:(nullable NSDictionary *) attributes CLS_DEPRECATED("Please refer to Answers +logCustomEventWithName:");
+ (void)logEvent:(NSString *)eventName CLS_DEPRECATED("Please refer to Answers +logCustomEventWithName:");

Binary file not shown.

View File

@@ -11,8 +11,8 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR="\"${DIR}"
PATH_SEP="/"
VALIDATE_COMMAND="uploadDSYM\" $@ validate"
UPLOAD_COMMAND="uploadDSYM\" $@"
VALIDATE_COMMAND="uploadDSYM\" $@ validate run-script"
UPLOAD_COMMAND="uploadDSYM\" $@ run-script"
# Ensure params are as expected, run in sync mode to validate
eval $DIR$PATH_SEP$VALIDATE_COMMAND

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,7 +2,19 @@
// FABAttributes.h
// Fabric
//
// Copyright (c) 2015 Twitter. All rights reserved.
// Copyright (C) 2015 Twitter, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma once

View File

@@ -1,7 +1,20 @@
//
// Fabric.h
// Fabric
//
// Copyright (c) 2015 Twitter. All rights reserved.
// Copyright (C) 2015 Twitter, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <Foundation/Foundation.h>

View File

@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.6.0</string>
<string>1.6.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
@@ -25,31 +25,33 @@
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>37</string>
<string>53</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>13B137</string>
<string>13C75</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>9.1</string>
<string>9.2</string>
<key>DTSDKBuild</key>
<string>13B137</string>
<string>13C75</string>
<key>DTSDKName</key>
<string>iphoneos9.1</string>
<string>iphoneos9.2</string>
<key>DTXcode</key>
<string>0710</string>
<string>0721</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7C1002</string>
<key>MinimumOSVersion</key>
<string>6.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Twitter. All rights reserved.</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>4</integer>
</array>
</dict>
</plist>

View File

@@ -11,8 +11,8 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR="\"${DIR}"
PATH_SEP="/"
VALIDATE_COMMAND="uploadDSYM\" $@ validate"
UPLOAD_COMMAND="uploadDSYM\" $@"
VALIDATE_COMMAND="uploadDSYM\" $@ validate run-script"
UPLOAD_COMMAND="uploadDSYM\" $@ run-script"
# Ensure params are as expected, run in sync mode to validate
eval $DIR$PATH_SEP$VALIDATE_COMMAND

Binary file not shown.

View File

@@ -18,17 +18,17 @@
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "1DC75A27-0030-4493-ACE8-E1D49AB9A549",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"304AD0F97EA7B4893D91DFB8C3413D4E627B9472" : "MasterPassword\/External\/KCOrderedAccessorFix",
"304AD0F97EA7B4893D91DFB8C3413D4E627B9472" : "MasterPassword\/External\/KCOrderedAccessorFix\/",
"2A70319CE0F91B35406CA7D970AE7CB4957B0A75" : "",
"8A15A8EA0B3D0B497C4883425BC74DF995224BB3" : "MasterPassword\/External\/Pearl\/External\/jrswizzle",
"1712FC0BC3C9AABD8B7B5376E310E93FBDB3BCFA" : "MasterPassword\/External\/InAppSettingsKit",
"8A15A8EA0B3D0B497C4883425BC74DF995224BB3" : "MasterPassword\/External\/jrswizzle\/",
"1712FC0BC3C9AABD8B7B5376E310E93FBDB3BCFA" : "MasterPassword\/External\/InAppSettingsKit\/",
"1AA8C0BE-EEC3-4FBC-A801-8939A1AC093A" : "MasterPassword\/External\/LoveLyndir",
"3E67FB08419C920516AAC3B00DAAF23073B8CF77" : "MasterPassword\/External\/RHStatusItemView",
"3ED8592497DB6A564366943C9AAD5A46341B5076" : "MasterPassword\/External\/AttributedMarkdown",
"4DDCFFD91B41F00326AD14553BD66CFD366ABD91" : "MasterPassword\/External\/Pearl",
"3ED8592497DB6A564366943C9AAD5A46341B5076" : "MasterPassword\/External\/AttributedMarkdown\/",
"4DDCFFD91B41F00326AD14553BD66CFD366ABD91" : "MasterPassword\/External\/Pearl\/",
"E47DEC29CB0D0FDE3560EF46E1808FA1C723D657" : "MasterPassword\/External\/UbiquityStoreManager",
"2FE140B36B7D26140DC8D5E5C639DC5900EFCF35" : "MasterPassword\/External\/Pearl\/External\/uicolor-utilities",
"F788B28042EDBEF29EFE34687DA79A778C2CC260" : "MasterPassword"
"2FE140B36B7D26140DC8D5E5C639DC5900EFCF35" : "MasterPassword\/External\/uicolor-utilities\/",
"F788B28042EDBEF29EFE34687DA79A778C2CC260" : "MasterPassword\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "MasterPassword",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,

View File

@@ -5,3 +5,4 @@ set -e
cd "${BASH_SOURCE%/*}"
rm -vfr lib/*/{.unpacked,.patched,src} lib/include
rm -vfr *.o *.dSYM mpw mpw-bench mpw-tests

View File

@@ -19,6 +19,9 @@
const uint8_t *mpw_masterKeyForUser(const char *fullName, const char *masterPassword, const MPAlgorithmVersion algorithmVersion) {
if (!fullName || !masterPassword)
return NULL;
switch (algorithmVersion) {
case MPAlgorithmVersion0:
return mpw_masterKeyForUser_v0( fullName, masterPassword );
@@ -37,6 +40,9 @@ const uint8_t *mpw_masterKeyForUser(const char *fullName, const char *masterPass
const char *mpw_passwordForSite(const uint8_t *masterKey, const char *siteName, const MPSiteType siteType, const uint32_t siteCounter,
const MPSiteVariant siteVariant, const char *siteContext, const MPAlgorithmVersion algorithmVersion) {
if (!masterKey || !siteName)
return NULL;
switch (algorithmVersion) {
case MPAlgorithmVersion0:
return mpw_passwordForSite_v0( masterKey, siteName, siteType, siteCounter, siteVariant, siteContext );

View File

@@ -22,10 +22,9 @@ static const char *mpw_templateForType_v0(MPSiteType type, uint16_t seedByte) {
size_t count = 0;
const char **templates = mpw_templatesForType( type, &count );
if (!count)
return NULL;
return templates[seedByte % count];
char const *template = count? templates[seedByte % count]: NULL;
free( templates );
return template;
}
static const char mpw_characterFromClass_v0(char characterClass, uint16_t seedByte) {
@@ -38,7 +37,7 @@ static const uint8_t *mpw_masterKeyForUser_v0(const char *fullName, const char *
const char *mpKeyScope = mpw_scopeForVariant( MPSiteVariantPassword );
trc( "algorithm: v%d\n", 0 );
trc( "fullName: %s (%zu)\n", fullName, mpw_charlen( fullName ) );
trc( "fullName: %s (%zu)\n", fullName, mpw_utf8_strlen( fullName ) );
trc( "masterPassword: %s\n", masterPassword );
trc( "key scope: %s\n", mpKeyScope );
@@ -46,14 +45,14 @@ static const uint8_t *mpw_masterKeyForUser_v0(const char *fullName, const char *
// masterKeySalt = mpKeyScope . #fullName . fullName
size_t masterKeySaltSize = 0;
uint8_t *masterKeySalt = NULL;
mpw_pushString( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_pushInt( &masterKeySalt, &masterKeySaltSize, htonl( mpw_charlen( fullName ) ) );
mpw_pushString( &masterKeySalt, &masterKeySaltSize, fullName );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
if (!masterKeySalt) {
ftl( "Could not allocate master key salt: %d\n", errno );
return NULL;
}
trc( "masterKeySalt ID: %s\n", mpw_idForBuf( masterKeySalt, masterKeySaltSize ) );
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
// Calculate the master key.
// masterKey = scrypt( masterPassword, masterKeySalt )
@@ -63,7 +62,7 @@ static const uint8_t *mpw_masterKeyForUser_v0(const char *fullName, const char *
ftl( "Could not allocate master key: %d\n", errno );
return NULL;
}
trc( "masterKey ID: %s\n", mpw_idForBuf( masterKey, MP_dkLen ) );
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MP_dkLen ) );
return masterKey;
}
@@ -87,19 +86,19 @@ static const char *mpw_passwordForSite_v0(const uint8_t *masterKey, const char *
// sitePasswordSeed = hmac-sha256( masterKey, siteScope . #siteName . siteName . siteCounter . #siteContext . siteContext )
size_t sitePasswordInfoSize = 0;
uint8_t *sitePasswordInfo = NULL;
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_charlen( siteName ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_utf8_strlen( siteName ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
if (siteContext) {
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_charlen( siteContext ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_utf8_strlen( siteContext ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
}
if (!sitePasswordInfo) {
ftl( "Could not allocate site seed info: %d\n", errno );
return NULL;
}
trc( "sitePasswordInfo ID: %s\n", mpw_idForBuf( sitePasswordInfo, sitePasswordInfoSize ) );
trc( "sitePasswordInfo ID: %s\n", mpw_id_buf( sitePasswordInfo, sitePasswordInfoSize ) );
const char *sitePasswordSeed = (const char *)mpw_hmac_sha256( masterKey, MP_dkLen, sitePasswordInfo, sitePasswordInfoSize );
mpw_free( sitePasswordInfo, sitePasswordInfoSize );
@@ -107,7 +106,7 @@ static const char *mpw_passwordForSite_v0(const uint8_t *masterKey, const char *
ftl( "Could not allocate site seed: %d\n", errno );
return NULL;
}
trc( "sitePasswordSeed ID: %s\n", mpw_idForBuf( sitePasswordSeed, 32 ) );
trc( "sitePasswordSeed ID: %s\n", mpw_id_buf( sitePasswordSeed, 32 ) );
// Determine the template.
const char *template = mpw_templateForType_v0( siteType, htons( sitePasswordSeed[0] ) );

View File

@@ -22,7 +22,7 @@ static const uint8_t *mpw_masterKeyForUser_v1(const char *fullName, const char *
const char *mpKeyScope = mpw_scopeForVariant( MPSiteVariantPassword );
trc( "algorithm: v%d\n", 1 );
trc( "fullName: %s (%zu)\n", fullName, mpw_charlen( fullName ) );
trc( "fullName: %s (%zu)\n", fullName, mpw_utf8_strlen( fullName ) );
trc( "masterPassword: %s\n", masterPassword );
trc( "key scope: %s\n", mpKeyScope );
@@ -30,14 +30,14 @@ static const uint8_t *mpw_masterKeyForUser_v1(const char *fullName, const char *
// masterKeySalt = mpKeyScope . #fullName . fullName
size_t masterKeySaltSize = 0;
uint8_t *masterKeySalt = NULL;
mpw_pushString( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_pushInt( &masterKeySalt, &masterKeySaltSize, htonl( mpw_charlen( fullName ) ) );
mpw_pushString( &masterKeySalt, &masterKeySaltSize, fullName );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
if (!masterKeySalt) {
ftl( "Could not allocate master key salt: %d\n", errno );
return NULL;
}
trc( "masterKeySalt ID: %s\n", mpw_idForBuf( masterKeySalt, masterKeySaltSize ) );
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
// Calculate the master key.
// masterKey = scrypt( masterPassword, masterKeySalt )
@@ -47,7 +47,7 @@ static const uint8_t *mpw_masterKeyForUser_v1(const char *fullName, const char *
ftl( "Could not allocate master key: %d\n", errno );
return NULL;
}
trc( "masterKey ID: %s\n", mpw_idForBuf( masterKey, MP_dkLen ) );
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MP_dkLen ) );
return masterKey;
}
@@ -71,19 +71,19 @@ static const char *mpw_passwordForSite_v1(const uint8_t *masterKey, const char *
// sitePasswordSeed = hmac-sha256( masterKey, siteScope . #siteName . siteName . siteCounter . #siteContext . siteContext )
size_t sitePasswordInfoSize = 0;
uint8_t *sitePasswordInfo = NULL;
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_charlen( siteName ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_utf8_strlen( siteName ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
if (siteContext) {
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_charlen( siteContext ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( mpw_utf8_strlen( siteContext ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
}
if (!sitePasswordInfo) {
ftl( "Could not allocate site seed info: %d\n", errno );
return NULL;
}
trc( "sitePasswordInfo ID: %s\n", mpw_idForBuf( sitePasswordInfo, sitePasswordInfoSize ) );
trc( "sitePasswordInfo ID: %s\n", mpw_id_buf( sitePasswordInfo, sitePasswordInfoSize ) );
const uint8_t *sitePasswordSeed = mpw_hmac_sha256( masterKey, MP_dkLen, sitePasswordInfo, sitePasswordInfoSize );
mpw_free( sitePasswordInfo, sitePasswordInfoSize );
@@ -91,7 +91,7 @@ static const char *mpw_passwordForSite_v1(const uint8_t *masterKey, const char *
ftl( "Could not allocate site seed: %d\n", errno );
return NULL;
}
trc( "sitePasswordSeed ID: %s\n", mpw_idForBuf( sitePasswordSeed, 32 ) );
trc( "sitePasswordSeed ID: %s\n", mpw_id_buf( sitePasswordSeed, 32 ) );
// Determine the template.
const char *template = mpw_templateForType( siteType, sitePasswordSeed[0] );

View File

@@ -22,7 +22,7 @@ static const uint8_t *mpw_masterKeyForUser_v2(const char *fullName, const char *
const char *mpKeyScope = mpw_scopeForVariant( MPSiteVariantPassword );
trc( "algorithm: v%d\n", 2 );
trc( "fullName: %s (%zu)\n", fullName, mpw_charlen( fullName ) );
trc( "fullName: %s (%zu)\n", fullName, mpw_utf8_strlen( fullName ) );
trc( "masterPassword: %s\n", masterPassword );
trc( "key scope: %s\n", mpKeyScope );
@@ -30,14 +30,14 @@ static const uint8_t *mpw_masterKeyForUser_v2(const char *fullName, const char *
// masterKeySalt = mpKeyScope . #fullName . fullName
size_t masterKeySaltSize = 0;
uint8_t *masterKeySalt = NULL;
mpw_pushString( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_pushInt( &masterKeySalt, &masterKeySaltSize, htonl( mpw_charlen( fullName ) ) );
mpw_pushString( &masterKeySalt, &masterKeySaltSize, fullName );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
if (!masterKeySalt) {
ftl( "Could not allocate master key salt: %d\n", errno );
return NULL;
}
trc( "masterKeySalt ID: %s\n", mpw_idForBuf( masterKeySalt, masterKeySaltSize ) );
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
// Calculate the master key.
// masterKey = scrypt( masterPassword, masterKeySalt )
@@ -47,7 +47,7 @@ static const uint8_t *mpw_masterKeyForUser_v2(const char *fullName, const char *
ftl( "Could not allocate master key: %d\n", errno );
return NULL;
}
trc( "masterKey ID: %s\n", mpw_idForBuf( masterKey, MP_dkLen ) );
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MP_dkLen ) );
return masterKey;
}
@@ -71,19 +71,19 @@ static const char *mpw_passwordForSite_v2(const uint8_t *masterKey, const char *
// sitePasswordSeed = hmac-sha256( masterKey, siteScope . #siteName . siteName . siteCounter . #siteContext . siteContext )
size_t sitePasswordInfoSize = 0;
uint8_t *sitePasswordInfo = NULL;
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteName ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteName ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
if (siteContext) {
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteContext ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteContext ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
}
if (!sitePasswordInfo) {
ftl( "Could not allocate site seed info: %d\n", errno );
return NULL;
}
trc( "sitePasswordInfo ID: %s\n", mpw_idForBuf( sitePasswordInfo, sitePasswordInfoSize ) );
trc( "sitePasswordInfo ID: %s\n", mpw_id_buf( sitePasswordInfo, sitePasswordInfoSize ) );
const uint8_t *sitePasswordSeed = mpw_hmac_sha256( masterKey, MP_dkLen, sitePasswordInfo, sitePasswordInfoSize );
mpw_free( sitePasswordInfo, sitePasswordInfoSize );
@@ -91,7 +91,7 @@ static const char *mpw_passwordForSite_v2(const uint8_t *masterKey, const char *
ftl( "Could not allocate site seed: %d\n", errno );
return NULL;
}
trc( "sitePasswordSeed ID: %s\n", mpw_idForBuf( sitePasswordSeed, 32 ) );
trc( "sitePasswordSeed ID: %s\n", mpw_id_buf( sitePasswordSeed, 32 ) );
// Determine the template.
const char *template = mpw_templateForType( siteType, sitePasswordSeed[0] );

View File

@@ -30,14 +30,14 @@ static const uint8_t *mpw_masterKeyForUser_v3(const char *fullName, const char *
// masterKeySalt = mpKeyScope . #fullName . fullName
size_t masterKeySaltSize = 0;
uint8_t *masterKeySalt = NULL;
mpw_pushString( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_pushInt( &masterKeySalt, &masterKeySaltSize, htonl( strlen( fullName ) ) );
mpw_pushString( &masterKeySalt, &masterKeySaltSize, fullName );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, mpKeyScope );
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( strlen( fullName ) ) );
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
if (!masterKeySalt) {
ftl( "Could not allocate master key salt: %d\n", errno );
return NULL;
}
trc( "masterKeySalt ID: %s\n", mpw_idForBuf( masterKeySalt, masterKeySaltSize ) );
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
// Calculate the master key.
// masterKey = scrypt( masterPassword, masterKeySalt )
@@ -47,7 +47,7 @@ static const uint8_t *mpw_masterKeyForUser_v3(const char *fullName, const char *
ftl( "Could not allocate master key: %d\n", errno );
return NULL;
}
trc( "masterKey ID: %s\n", mpw_idForBuf( masterKey, MP_dkLen ) );
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MP_dkLen ) );
return masterKey;
}
@@ -71,19 +71,19 @@ static const char *mpw_passwordForSite_v3(const uint8_t *masterKey, const char *
// sitePasswordSeed = hmac-sha256( masterKey, siteScope . #siteName . siteName . siteCounter . #siteContext . siteContext )
size_t sitePasswordInfoSize = 0;
uint8_t *sitePasswordInfo = NULL;
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteName ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteScope );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteName ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteName );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( siteCounter ) );
if (siteContext) {
mpw_pushInt( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteContext ) ) );
mpw_pushString( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
mpw_push_int( &sitePasswordInfo, &sitePasswordInfoSize, htonl( strlen( siteContext ) ) );
mpw_push_string( &sitePasswordInfo, &sitePasswordInfoSize, siteContext );
}
if (!sitePasswordInfo) {
ftl( "Could not allocate site seed info: %d\n", errno );
return NULL;
}
trc( "sitePasswordInfo ID: %s\n", mpw_idForBuf( sitePasswordInfo, sitePasswordInfoSize ) );
trc( "sitePasswordInfo ID: %s\n", mpw_id_buf( sitePasswordInfo, sitePasswordInfoSize ) );
const uint8_t *sitePasswordSeed = mpw_hmac_sha256( masterKey, MP_dkLen, sitePasswordInfo, sitePasswordInfoSize );
mpw_free( sitePasswordInfo, sitePasswordInfoSize );
@@ -91,7 +91,7 @@ static const char *mpw_passwordForSite_v3(const uint8_t *masterKey, const char *
ftl( "Could not allocate site seed: %d\n", errno );
return NULL;
}
trc( "sitePasswordSeed ID: %s\n", mpw_idForBuf( sitePasswordSeed, 32 ) );
trc( "sitePasswordSeed ID: %s\n", mpw_id_buf( sitePasswordSeed, 32 ) );
// Determine the template.
const char *template = mpw_templateForType( siteType, sitePasswordSeed[0] );

View File

@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include <sys/time.h>
@@ -56,52 +57,79 @@ int main(int argc, char *const argv[]) {
const MPSiteVariant siteVariant = MPSiteVariantPassword;
const char *siteContext = NULL;
struct timeval startTime;
unsigned int iterations;
float percent;
const uint8_t *masterKey;
// Start HMAC-SHA-256
// Similar to phase-two of mpw
uint8_t *sitePasswordInfo = malloc( 128 );
iterations = 3000000;
masterKey = mpw_masterKeyForUser( fullName, masterPassword, MPAlgorithmVersionCurrent );
if (!masterKey) {
ftl( "Could not allocate master key: %d\n", errno );
abort();
}
mpw_getTime( &startTime );
for (int i = 1; i <= iterations; ++i) {
free( (void *)mpw_hmac_sha256( masterKey, MP_dkLen, sitePasswordInfo, 128 ) );
if (modff(100.f * i / iterations, &percent) == 0)
fprintf( stderr, "\rhmac-sha-256: iteration %d / %d (%.0f%%)..", i, iterations, percent );
}
const double hmacSha256Speed = mpw_showSpeed( startTime, iterations, "hmac-sha-256" );
free( (void *)masterKey );
// Start BCrypt
// Similar to phase-one of mpw
int bcrypt_cost = 9;
iterations = 1000;
mpw_getTime( &startTime );
for (int i = 1; i <= iterations; ++i) {
crypt( masterPassword, crypt_gensalt( "$2b$", bcrypt_cost, fullName, strlen( fullName ) ) );
if (modff(100.f * i / iterations, &percent) == 0)
fprintf( stderr, "\rbcrypt (cost %d): iteration %d / %d (%.0f%%)..", bcrypt_cost, i, iterations, percent );
}
const double bcrypt9Speed = mpw_showSpeed( startTime, iterations, "bcrypt9" );
// Start SCrypt
// Phase one of mpw
iterations = 50;
mpw_getTime( &startTime );
for (int i = 1; i <= iterations; ++i) {
free( (void *)mpw_masterKeyForUser( fullName, masterPassword, MPAlgorithmVersionCurrent ) );
if (modff(100.f * i / iterations, &percent) == 0)
fprintf( stderr, "\rscrypt_mpw: iteration %d / %d (%.0f%%)..", i, iterations, percent );
}
const double scryptSpeed = mpw_showSpeed( startTime, iterations, "scrypt_mpw" );
// Start MPW
unsigned int iterations = 100;
// Both phases of mpw
iterations = 50;
mpw_getTime( &startTime );
for (int i = 0; i < iterations; ++i) {
const uint8_t *masterKey = mpw_masterKeyForUser(
fullName, masterPassword, MPAlgorithmVersionCurrent );
if (!masterKey)
for (int i = 1; i <= iterations; ++i) {
masterKey = mpw_masterKeyForUser( fullName, masterPassword, MPAlgorithmVersionCurrent );
if (!masterKey) {
ftl( "Could not allocate master key: %d\n", errno );
abort();
}
free( (void *)mpw_passwordForSite(
masterKey, siteName, siteType, siteCounter, siteVariant, siteContext, MPAlgorithmVersionCurrent ) );
free( (void *)masterKey );
if (i % ( iterations / 100 ) == 0)
fprintf( stderr, "\rmpw: iteration %d / %d (%d%%)..", i, iterations, i * 100 / iterations );
if (modff(100.f * i / iterations, &percent) == 0)
fprintf( stderr, "\rmpw: iteration %d / %d (%.0f%%)..", i, iterations, percent );
}
const double mpwSpeed = mpw_showSpeed( startTime, iterations, "mpw" );
// Start SHA-256
iterations = 45000000;
uint8_t hash[32];
mpw_getTime( &startTime );
for (int i = 0; i < iterations; ++i) {
SHA256_Buf( masterPassword, strlen( masterPassword ), hash );
if (i % ( iterations / 100 ) == 0)
fprintf( stderr, "\rsha256: iteration %d / %d (%d%%)..", i, iterations, i * 100 / iterations );
}
const double sha256Speed = mpw_showSpeed( startTime, iterations, "sha256" );
// Start BCrypt
int bcrypt_cost = 9;
iterations = 1000;
mpw_getTime( &startTime );
for (int i = 0; i < iterations; ++i) {
crypt( masterPassword, crypt_gensalt( "$2b$", bcrypt_cost, fullName, strlen( fullName ) ) );
if (i % ( iterations / 100 ) == 0)
fprintf( stderr, "\rbcrypt (cost %d): iteration %d / %d (%d%%)..", bcrypt_cost, i, iterations, i * 100 / iterations );
}
const double bcrypt9Speed = mpw_showSpeed( startTime, iterations, "bcrypt9" );
// Summarize.
fprintf( stdout, "\n== SUMMARY ==\nOn this machine,\n" );
fprintf( stdout, " - mpw is %f times slower than sha256 (reference: 320000 on an MBP Late 2013).\n", sha256Speed / mpwSpeed );
fprintf( stdout, " - mpw is %f times slower than hmac-sha-256 (reference: 320000 on an MBP Late 2013).\n", hmacSha256Speed / mpwSpeed );
fprintf( stdout, " - mpw is %f times slower than bcrypt (cost 9) (reference: 22 on an MBP Late 2013).\n", bcrypt9Speed / mpwSpeed );
fprintf( stdout, " - scrypt is %f times slower than bcrypt (cost 9) (reference: 22 on an MBP Late 2013).\n", bcrypt9Speed / scryptSpeed );
return 0;
}

View File

@@ -78,14 +78,14 @@ static char *homedir(const char *filename) {
return homefile;
}
static char *getlinep(const char *prompt) {
static char *getline_prompt(const char *prompt) {
char *buf = NULL;
size_t bufSize = 0;
ssize_t lineSize;
fprintf( stderr, "%s", prompt );
fprintf( stderr, " " );
if ((lineSize = getline( &buf, &bufSize, stdin )) < 0) {
if ((lineSize = getline( &buf, &bufSize, stdin )) <= 1) {
free( buf );
return NULL;
}
@@ -96,7 +96,7 @@ static char *getlinep(const char *prompt) {
int main(int argc, char *const argv[]) {
// Read the environment.
char *fullName = getenv( MP_env_fullname );
const char *fullName = NULL;
const char *masterPassword = NULL;
const char *siteName = NULL;
MPSiteType siteType = MPSiteTypeGeneratedLong;
@@ -116,7 +116,7 @@ int main(int argc, char *const argv[]) {
for (int opt; (opt = getopt( argc, argv, "u:P:t:c:V:a:C:vqh" )) != -1;)
switch (opt) {
case 'u':
fullName = optarg;
fullName = strdup( optarg );
break;
case 'P':
// Do not use this. Passing your master password via the command-line
@@ -166,12 +166,14 @@ int main(int argc, char *const argv[]) {
ftl("Unexpected option: %c", opt);
}
if (optind < argc)
siteName = argv[optind];
siteName = strdup( argv[optind] );
// Convert and validate input.
if (!fullName && !(fullName = getlinep( "Your full name:" )))
if (!fullName && (fullName = getenv( MP_env_fullname )))
fullName = strdup( fullName );
if (!fullName && !(fullName = getline_prompt( "Your full name:" )))
ftl( "Missing full name.\n" );
if (!siteName && !(siteName = getlinep( "Site name:" )))
if (!siteName && !(siteName = getline_prompt( "Site name:" )))
ftl( "Missing site name.\n" );
if (siteCounterString)
siteCounter = (uint32_t)atol( siteCounterString );
@@ -210,21 +212,27 @@ int main(int argc, char *const argv[]) {
masterPassword = getpass( "Your master password: " );
// Summarize operation.
fprintf( stderr, "%s's password for %s:\n[ %s ]: ", fullName, siteName, mpw_identicon( fullName, masterPassword ) );
const char *identicon = mpw_identicon( fullName, masterPassword );
fprintf( stderr, "%s's password for %s:\n[ %s ]: ", fullName, siteName, identicon );
mpw_free_string( identicon );
// Output the password.
const uint8_t *masterKey = mpw_masterKeyForUser(
fullName, masterPassword, algorithmVersion );
mpw_freeString( masterPassword );
mpw_free_string( masterPassword );
mpw_free_string( fullName );
if (!masterKey)
ftl( "Couldn't derive master key." );
const char *sitePassword = mpw_passwordForSite(
masterKey, siteName, siteType, siteCounter, siteVariant, siteContextString, algorithmVersion );
mpw_free( masterKey, MP_dkLen );
mpw_free_string( siteName );
if (!sitePassword)
ftl( "Couldn't derive site password." );
fprintf( stdout, "%s\n", sitePassword );
mpw_free_string( sitePassword );
return 0;
}

View File

@@ -65,7 +65,7 @@ int main(int argc, char *const argv[]) {
}
// Free test case.
mpw_freeString( sitePassword );
mpw_free_string( sitePassword );
xmlFree( id );
xmlFree( fullName );
xmlFree( masterPassword );

View File

@@ -50,6 +50,7 @@ const MPSiteType mpw_typeWithName(const char *typeName) {
return MPSiteTypeGeneratedPhrase;
ftl( "Not a generated type name: %s", stdTypeName );
return MPSiteTypeGeneratedLong;
}
const char **mpw_templatesForType(MPSiteType type, size_t *count) {
@@ -62,11 +63,11 @@ const char **mpw_templatesForType(MPSiteType type, size_t *count) {
switch (type) {
case MPSiteTypeGeneratedMaximum: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"anoxxxxxxxxxxxxxxxxx", "axxxxxxxxxxxxxxxxxno" );
}
case MPSiteTypeGeneratedLong: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"CvcvnoCvcvCvcv", "CvcvCvcvnoCvcv", "CvcvCvcvCvcvno",
"CvccnoCvcvCvcv", "CvccCvcvnoCvcv", "CvccCvcvCvcvno",
"CvcvnoCvccCvcv", "CvcvCvccnoCvcv", "CvcvCvccCvcvno",
@@ -76,27 +77,27 @@ const char **mpw_templatesForType(MPSiteType type, size_t *count) {
"CvccnoCvcvCvcc", "CvccCvcvnoCvcc", "CvccCvcvCvccno" );
}
case MPSiteTypeGeneratedMedium: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"CvcnoCvc", "CvcCvcno" );
}
case MPSiteTypeGeneratedBasic: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"aaanaaan", "aannaaan", "aaannaaa" );
}
case MPSiteTypeGeneratedShort: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"Cvcn" );
}
case MPSiteTypeGeneratedPIN: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"nnnn" );
}
case MPSiteTypeGeneratedName: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"cvccvcvcv" );
}
case MPSiteTypeGeneratedPhrase: {
return alloc_array( *count, const char *,
return mpw_alloc_array( *count, const char *,
"cvcc cvc cvccvcv cvc", "cvc cvccvcvcv cvcv", "cv cvccv cvc cvcvccv" );
}
default: {
@@ -111,10 +112,7 @@ const char *mpw_templateForType(MPSiteType type, uint8_t seedByte) {
size_t count = 0;
const char **templates = mpw_templatesForType( type, &count );
if (!count)
return NULL;
char const *template = templates[seedByte % count];
char const *template = count? templates[seedByte % count]: NULL;
free( templates );
return template;
}

View File

@@ -21,7 +21,7 @@
#include "mpw-util.h"
void mpw_pushBuf(uint8_t **const buffer, size_t *const bufferSize, const void *pushBuffer, const size_t pushSize) {
void mpw_push_buf(uint8_t **const buffer, size_t *const bufferSize, const void *pushBuffer, const size_t pushSize) {
if (*bufferSize == (size_t)-1)
// The buffer was marked as broken, it is missing a previous push. Abort to avoid corrupt content.
@@ -42,23 +42,25 @@ void mpw_pushBuf(uint8_t **const buffer, size_t *const bufferSize, const void *p
memcpy( pushDst, pushBuffer, pushSize );
}
void mpw_pushString(uint8_t **buffer, size_t *const bufferSize, const char *pushString) {
void mpw_push_string(uint8_t **buffer, size_t *const bufferSize, const char *pushString) {
mpw_pushBuf( buffer, bufferSize, pushString, strlen( pushString ) );
mpw_push_buf( buffer, bufferSize, pushString, strlen( pushString ) );
}
void mpw_pushInt(uint8_t **const buffer, size_t *const bufferSize, const uint32_t pushInt) {
void mpw_push_int(uint8_t **const buffer, size_t *const bufferSize, const uint32_t pushInt) {
mpw_pushBuf( buffer, bufferSize, &pushInt, sizeof( pushInt ) );
mpw_push_buf( buffer, bufferSize, &pushInt, sizeof( pushInt ) );
}
void mpw_free(const void *buffer, const size_t bufferSize) {
memset( (void *)buffer, 0, bufferSize );
free( (void *)buffer );
if (buffer) {
memset( (void *)buffer, 0, bufferSize );
free( (void *)buffer );
}
}
void mpw_freeString(const char *string) {
void mpw_free_string(const char *string) {
mpw_free( string, strlen( string ) );
}
@@ -66,6 +68,9 @@ void mpw_freeString(const char *string) {
uint8_t const *mpw_scrypt(const size_t keySize, const char *secret, const uint8_t *salt, const size_t saltSize,
uint64_t N, uint32_t r, uint32_t p) {
if (!secret || !salt)
return NULL;
uint8_t *key = malloc( keySize );
if (!key)
return NULL;
@@ -88,7 +93,7 @@ uint8_t const *mpw_hmac_sha256(const uint8_t *key, const size_t keySize, const u
return buffer;
}
const char *mpw_idForBuf(const void *buf, size_t length) {
const char *mpw_id_buf(const void *buf, size_t length) {
uint8_t hash[32];
SHA256_Buf( buf, length, hash );
@@ -124,15 +129,23 @@ const char *mpw_hex_l(uint32_t number) {
#ifdef COLOR
static int putvari;
static char *putvarc = NULL;
static int istermsetup = 0;
static void initputvar() {
static int termsetup;
static int initputvar() {
if (!isatty(STDERR_FILENO))
return 0;
if (putvarc)
free(putvarc);
if (!termsetup) {
int status;
if (! (termsetup = (setupterm(NULL, STDERR_FILENO, &status) == OK && status == 1))) {
wrn( "Terminal doesn't support color (setupterm errno %d).\n", status );
return 0;
}
}
putvarc=(char *)calloc(256, sizeof(char));
putvari=0;
if (!istermsetup)
istermsetup = (OK == setupterm(NULL, STDERR_FILENO, NULL));
return 1;
}
static int putvar(int c) {
putvarc[putvari++]=c;
@@ -156,9 +169,8 @@ const char *mpw_identicon(const char *fullName, const char *masterPassword) {
char *colorString, *resetString;
#ifdef COLOR
if (isatty( STDERR_FILENO )) {
if (initputvar()) {
uint8_t colorIdentifier = (uint8_t)(identiconSeed[4] % 7 + 1);
initputvar();
tputs(tparm(tgetstr("AF", NULL), colorIdentifier), 1, putvar);
colorString = calloc(strlen(putvarc) + 1, sizeof(char));
strcpy(colorString, putvarc);
@@ -189,7 +201,7 @@ const char *mpw_identicon(const char *fullName, const char *masterPassword) {
/**
* @return the amount of bytes used by UTF-8 to encode a single character that starts with the given byte.
*/
static int mpw_charByteSize(unsigned char utf8Byte) {
static int mpw_utf8_sizeof(unsigned char utf8Byte) {
if (!utf8Byte)
return 0;
@@ -207,11 +219,11 @@ static int mpw_charByteSize(unsigned char utf8Byte) {
return 0;
}
const size_t mpw_charlen(const char *utf8String) {
const size_t mpw_utf8_strlen(const char *utf8String) {
size_t charlen = 0;
char *remainingString = (char *)utf8String;
for (int charByteSize; (charByteSize = mpw_charByteSize( (unsigned char)*remainingString )); remainingString += charByteSize)
for (int charByteSize; (charByteSize = mpw_utf8_sizeof( (unsigned char)*remainingString )); remainingString += charByteSize)
++charlen;
return charlen;

View File

@@ -54,7 +54,7 @@ int mpw_verbosity;
//// Buffers and memory.
#define alloc_array(_count, _type, ...) ({ \
#define mpw_alloc_array(_count, _type, ...) ({ \
_type stackElements[] = { __VA_ARGS__ }; \
_count = sizeof( stackElements ) / sizeof( _type ); \
_type *allocElements = malloc( sizeof( stackElements ) ); \
@@ -63,19 +63,19 @@ int mpw_verbosity;
})
/** Push a buffer onto a buffer. reallocs the given buffer and appends the given buffer. */
void mpw_pushBuf(
void mpw_push_buf(
uint8_t **const buffer, size_t *const bufferSize, const void *pushBuffer, const size_t pushSize);
/** Push a string onto a buffer. reallocs the given buffer and appends the given string. */
void mpw_pushString(
void mpw_push_string(
uint8_t **buffer, size_t *const bufferSize, const char *pushString);
/** Push an integer onto a buffer. reallocs the given buffer and appends the given integer. */
void mpw_pushInt(
void mpw_push_int(
uint8_t **const buffer, size_t *const bufferSize, const uint32_t pushInt);
/** Free a buffer after zero'ing its contents. */
void mpw_free(
const void *buffer, const size_t bufferSize);
/** Free a string after zero'ing its contents. */
void mpw_freeString(
void mpw_free_string(
const char *string);
//// Cryptographic functions.
@@ -98,7 +98,7 @@ const char *mpw_hex(const void *buf, size_t length);
const char *mpw_hex_l(uint32_t number);
/** Encode a fingerprint for a buffer.
* @return A C-string in a reused buffer, do not free or store it. */
const char *mpw_idForBuf(const void *buf, size_t length);
const char *mpw_id_buf(const void *buf, size_t length);
/** Encode a visual fingerprint for a user.
* @return A newly allocated string. */
const char *mpw_identicon(const char *fullName, const char *masterPassword);
@@ -106,4 +106,4 @@ const char *mpw_identicon(const char *fullName, const char *masterPassword);
//// String utilities.
/** @return The amount of display characters in the given UTF-8 string. */
const size_t mpw_charlen(const char *utf8String);
const size_t mpw_utf8_strlen(const char *utf8String);

View File

@@ -5,7 +5,7 @@ mpw() {
if hash pbcopy 2>/dev/null; then
pbcopy
elif hash xclip 2>/dev/null; then
xclip
xclip -selection clip
else
cat; echo 2>/dev/null
return

View File

@@ -1 +1 @@
../Java/masterpassword-algorithm/src/test/resources/mpw_tests.xml
../Java/masterpassword-tests/src/main/resources/mpw_tests.xml

View File

@@ -1,2 +1,8 @@
# Gradle
build
.gradle
local.properties
# Maven
target
dependency-reduced-pom.xml

View File

@@ -0,0 +1,34 @@
allprojects {
//apply plugin: 'findbugs'
group = 'com.lyndir.masterpassword'
version = 'GIT-SNAPSHOT'
tasks.withType(JavaCompile) {
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
}
tasks.withType(FindBugs) {
reports {
xml.enabled false
html.enabled true
}
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: 'com.android.tools.build', name: 'gradle', version: '2.2.3'
}
}
subprojects {
repositories {
mavenCentral()
maven { url "http://maven.lyndir.com" }
}
}

View File

@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx1536M

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Wed Feb 08 01:04:17 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

172
MasterPassword/Java/gradlew vendored Executable file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
MasterPassword/Java/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,12 @@
apply plugin: 'java'
description = 'Master Password Algorithm Implementation'
dependencies {
compile( 'com.lyndir.lhunath.opal:opal-system:1.6-p10' ) {
exclude( module: 'joda-time' )
}
compile 'com.lambdaworks:scrypt:1.4.0'
compile 'org.jetbrains:annotations:13.0'
compile 'com.google.code.findbugs:jsr305:3.0.1'
}

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>com.lyndir.masterpassword</groupId>
<artifactId>masterpassword</artifactId>
<version>2.4-java</version>
<version>GIT-SNAPSHOT</version>
</parent>
<name>Master Password Algorithm Implementation</name>

View File

@@ -0,0 +1,74 @@
package com.lyndir.masterpassword;
import com.google.common.base.Charsets;
import com.lyndir.lhunath.opal.system.MessageAuthenticationDigests;
import com.lyndir.lhunath.opal.system.MessageDigests;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
/**
* @author lhunath, 2016-10-29
*/
public class MPConstant {
/* Environment */
/**
* mpw: default user name if one is not provided.
*/
public static final String env_userName = "MP_USERNAME";
/**
* mpw: default site type if one is not provided.
*
* @see MPSiteType#forOption(String)
*/
public static final String env_siteType = "MP_SITETYPE";
/**
* mpw: default site counter value if one is not provided.
*/
public static final String env_siteCounter = "MP_SITECOUNTER";
/**
* mpw: default path to look for run configuration files if the platform default is not desired.
*/
public static final String env_rcDir = "MP_RCDIR";
/**
* mpw: permit automatic update checks.
*/
public static final String env_checkUpdates = "MP_CHECKUPDATES";
/* Algorithm */
/**
* scrypt: CPU cost parameter.
*/
public static final int scrypt_N = 32768;
/**
* scrypt: Memory cost parameter.
*/
public static final int scrypt_r = 8;
/**
* scrypt: Parallelization parameter.
*/
public static final int scrypt_p = 2;
/**
* mpw: Master key size (byte).
*/
public static final int mpw_dkLen = 64;
/**
* mpw: Input character encoding.
*/
public static final Charset mpw_charset = Charsets.UTF_8;
/**
* mpw: Platform-agnostic byte order.
*/
public static final ByteOrder mpw_byteOrder = ByteOrder.BIG_ENDIAN;
/**
* mpw: Site digest.
*/
public static final MessageAuthenticationDigests mpw_digest = MessageAuthenticationDigests.HmacSHA256;
/**
* mpw: Key ID hash.
*/
public static final MessageDigests mpw_hash = MessageDigests.SHA256;
}

View File

@@ -1,6 +1,5 @@
package com.lyndir.masterpassword;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.UnsignedInteger;
@@ -8,7 +7,6 @@ import com.lambdaworks.crypto.SCrypt;
import com.lyndir.lhunath.opal.system.*;
import com.lyndir.lhunath.opal.system.logging.Logger;
import java.nio.*;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import javax.annotation.Nonnull;
@@ -25,19 +23,11 @@ import javax.annotation.Nullable;
*/
public class MasterKeyV0 extends MasterKey {
private static final int MP_intLen = 32;
@SuppressWarnings("UnusedDeclaration")
private static final Logger logger = Logger.get( MasterKeyV0.class );
protected final int MP_N = 32768;
protected final int MP_r = 8;
protected final int MP_p = 2;
protected final int MP_dkLen = 64;
protected final int MP_intLen = 32;
protected final Charset MP_charset = Charsets.UTF_8;
protected final ByteOrder MP_byteOrder = ByteOrder.BIG_ENDIAN;
protected final MessageDigests MP_hash = MessageDigests.SHA256;
protected final MessageAuthenticationDigests MP_mac = MessageAuthenticationDigests.HmacSHA256;
public MasterKeyV0(final String fullName) {
super( fullName );
}
@@ -52,15 +42,15 @@ public class MasterKeyV0 extends MasterKey {
@Override
protected byte[] deriveKey(final char[] masterPassword) {
String fullName = getFullName();
byte[] fullNameBytes = fullName.getBytes( MP_charset );
byte[] fullNameBytes = fullName.getBytes( MPConstant.mpw_charset );
byte[] fullNameLengthBytes = bytesForInt( fullName.length() );
String mpKeyScope = MPSiteVariant.Password.getScope();
byte[] masterKeySalt = Bytes.concat( mpKeyScope.getBytes( MP_charset ), fullNameLengthBytes, fullNameBytes );
byte[] masterKeySalt = Bytes.concat( mpKeyScope.getBytes( MPConstant.mpw_charset ), fullNameLengthBytes, fullNameBytes );
logger.trc( "key scope: %s", mpKeyScope );
logger.trc( "masterKeySalt ID: %s", CodeUtils.encodeHex( idForBytes( masterKeySalt ) ) );
ByteBuffer mpBytesBuf = MP_charset.encode( CharBuffer.wrap( masterPassword ) );
ByteBuffer mpBytesBuf = MPConstant.mpw_charset.encode( CharBuffer.wrap( masterPassword ) );
byte[] mpBytes = new byte[mpBytesBuf.remaining()];
mpBytesBuf.get( mpBytes, 0, mpBytes.length );
Arrays.fill( mpBytesBuf.array(), (byte) 0 );
@@ -71,9 +61,9 @@ public class MasterKeyV0 extends MasterKey {
protected byte[] scrypt(final byte[] masterKeySalt, final byte[] mpBytes) {
try {
if (isAllowNative())
return SCrypt.scrypt( mpBytes, masterKeySalt, MP_N, MP_r, MP_p, MP_dkLen );
return SCrypt.scrypt( mpBytes, masterKeySalt, MPConstant.scrypt_N, MPConstant.scrypt_r, MPConstant.scrypt_p, MPConstant.mpw_dkLen );
else
return SCrypt.scryptJ( mpBytes, masterKeySalt, MP_N, MP_r, MP_p, MP_dkLen );
return SCrypt.scryptJ( mpBytes, masterKeySalt, MPConstant.scrypt_N, MPConstant.scrypt_r, MPConstant.scrypt_p, MPConstant.mpw_dkLen );
}
catch (GeneralSecurityException e) {
logger.bug( e );
@@ -99,22 +89,22 @@ public class MasterKeyV0 extends MasterKey {
siteCounter = UnsignedInteger.valueOf( (System.currentTimeMillis() / (300 * 1000)) * 300 );
String siteScope = siteVariant.getScope();
byte[] siteNameBytes = siteName.getBytes( MP_charset );
byte[] siteNameBytes = siteName.getBytes( MPConstant.mpw_charset );
byte[] siteNameLengthBytes = bytesForInt( siteName.length() );
byte[] siteCounterBytes = bytesForInt( siteCounter );
byte[] siteContextBytes = siteContext == null || siteContext.isEmpty()? null: siteContext.getBytes( MP_charset );
byte[] siteContextBytes = siteContext == null || siteContext.isEmpty()? null: siteContext.getBytes( MPConstant.mpw_charset );
byte[] siteContextLengthBytes = bytesForInt( siteContextBytes == null? 0: siteContextBytes.length );
logger.trc( "site scope: %s, context: %s", siteScope, siteContextBytes == null? "<empty>": siteContext );
logger.trc( "seed from: hmac-sha256(masterKey, %s | %s | %s | %s | %s | %s)", siteScope, CodeUtils.encodeHex( siteNameLengthBytes ),
siteName, CodeUtils.encodeHex( siteCounterBytes ), CodeUtils.encodeHex( siteContextLengthBytes ),
siteContextBytes == null? "(null)": siteContext );
byte[] sitePasswordInfo = Bytes.concat( siteScope.getBytes( MP_charset ), siteNameLengthBytes, siteNameBytes, siteCounterBytes );
byte[] sitePasswordInfo = Bytes.concat( siteScope.getBytes( MPConstant.mpw_charset ), siteNameLengthBytes, siteNameBytes, siteCounterBytes );
if (siteContextBytes != null)
sitePasswordInfo = Bytes.concat( sitePasswordInfo, siteContextLengthBytes, siteContextBytes );
logger.trc( "sitePasswordInfo ID: %s", CodeUtils.encodeHex( idForBytes( sitePasswordInfo ) ) );
byte[] sitePasswordSeedBytes = MP_mac.of( getKey(), sitePasswordInfo );
byte[] sitePasswordSeedBytes = MPConstant.mpw_digest.of( getKey(), sitePasswordInfo );
int[] sitePasswordSeed = new int[sitePasswordSeedBytes.length];
for (int i = 0; i < sitePasswordSeedBytes.length; ++i) {
ByteBuffer buf = ByteBuffer.allocate( Integer.SIZE / Byte.SIZE ).order( ByteOrder.BIG_ENDIAN );
@@ -146,16 +136,16 @@ public class MasterKeyV0 extends MasterKey {
@Override
protected byte[] bytesForInt(final int number) {
return ByteBuffer.allocate( MP_intLen / Byte.SIZE ).order( MP_byteOrder ).putInt( number ).array();
return ByteBuffer.allocate( MP_intLen / Byte.SIZE ).order( MPConstant.mpw_byteOrder ).putInt( number ).array();
}
@Override
protected byte[] bytesForInt(@Nonnull final UnsignedInteger number) {
return ByteBuffer.allocate( MP_intLen / Byte.SIZE ).order( MP_byteOrder ).putInt( number.intValue() ).array();
return ByteBuffer.allocate( MP_intLen / Byte.SIZE ).order( MPConstant.mpw_byteOrder ).putInt( number.intValue() ).array();
}
@Override
protected byte[] idForBytes(final byte[] bytes) {
return MP_hash.of( bytes );
return MPConstant.mpw_hash.of( bytes );
}
}

View File

@@ -46,22 +46,22 @@ public class MasterKeyV1 extends MasterKeyV0 {
siteCounter = UnsignedInteger.valueOf( (System.currentTimeMillis() / (300 * 1000)) * 300 );
String siteScope = siteVariant.getScope();
byte[] siteNameBytes = siteName.getBytes( MP_charset );
byte[] siteNameBytes = siteName.getBytes( MPConstant.mpw_charset );
byte[] siteNameLengthBytes = bytesForInt( siteName.length() );
byte[] siteCounterBytes = bytesForInt( siteCounter );
byte[] siteContextBytes = siteContext == null || siteContext.isEmpty()? null: siteContext.getBytes( MP_charset );
byte[] siteContextBytes = siteContext == null || siteContext.isEmpty()? null: siteContext.getBytes( MPConstant.mpw_charset );
byte[] siteContextLengthBytes = bytesForInt( siteContextBytes == null? 0: siteContextBytes.length );
logger.trc( "site scope: %s, context: %s", siteScope, siteContextBytes == null? "<empty>": siteContext );
logger.trc( "seed from: hmac-sha256(masterKey, %s | %s | %s | %s | %s | %s)", siteScope, CodeUtils.encodeHex( siteNameLengthBytes ),
siteName, CodeUtils.encodeHex( siteCounterBytes ), CodeUtils.encodeHex( siteContextLengthBytes ),
siteContextBytes == null? "(null)": siteContext );
byte[] sitePasswordInfo = Bytes.concat( siteScope.getBytes( MP_charset ), siteNameLengthBytes, siteNameBytes, siteCounterBytes );
byte[] sitePasswordInfo = Bytes.concat( siteScope.getBytes( MPConstant.mpw_charset ), siteNameLengthBytes, siteNameBytes, siteCounterBytes );
if (siteContextBytes != null)
sitePasswordInfo = Bytes.concat( sitePasswordInfo, siteContextLengthBytes, siteContextBytes );
logger.trc( "sitePasswordInfo ID: %s", CodeUtils.encodeHex( idForBytes( sitePasswordInfo ) ) );
byte[] sitePasswordSeed = MP_mac.of( getKey(), sitePasswordInfo );
byte[] sitePasswordSeed = MPConstant.mpw_digest.of( getKey(), sitePasswordInfo );
logger.trc( "sitePasswordSeed ID: %s", CodeUtils.encodeHex( idForBytes( sitePasswordSeed ) ) );
Preconditions.checkState( sitePasswordSeed.length > 0 );

View File

@@ -45,22 +45,22 @@ public class MasterKeyV2 extends MasterKeyV1 {
siteCounter = UnsignedInteger.valueOf( (System.currentTimeMillis() / (300 * 1000)) * 300 );
String siteScope = siteVariant.getScope();
byte[] siteNameBytes = siteName.getBytes( MP_charset );
byte[] siteNameBytes = siteName.getBytes( MPConstant.mpw_charset );
byte[] siteNameLengthBytes = bytesForInt( siteNameBytes.length );
byte[] siteCounterBytes = bytesForInt( siteCounter );
byte[] siteContextBytes = siteContext == null || siteContext.isEmpty()? null: siteContext.getBytes( MP_charset );
byte[] siteContextBytes = siteContext == null || siteContext.isEmpty()? null: siteContext.getBytes( MPConstant.mpw_charset );
byte[] siteContextLengthBytes = bytesForInt( siteContextBytes == null? 0: siteContextBytes.length );
logger.trc( "site scope: %s, context: %s", siteScope, siteContextBytes == null? "<empty>": siteContext );
logger.trc( "seed from: hmac-sha256(masterKey, %s | %s | %s | %s | %s | %s)", siteScope, CodeUtils.encodeHex( siteNameLengthBytes ),
siteName, CodeUtils.encodeHex( siteCounterBytes ), CodeUtils.encodeHex( siteContextLengthBytes ),
siteContextBytes == null? "(null)": siteContext );
byte[] sitePasswordInfo = Bytes.concat( siteScope.getBytes( MP_charset ), siteNameLengthBytes, siteNameBytes, siteCounterBytes );
byte[] sitePasswordInfo = Bytes.concat( siteScope.getBytes( MPConstant.mpw_charset ), siteNameLengthBytes, siteNameBytes, siteCounterBytes );
if (siteContextBytes != null)
sitePasswordInfo = Bytes.concat( sitePasswordInfo, siteContextLengthBytes, siteContextBytes );
logger.trc( "sitePasswordInfo ID: %s", CodeUtils.encodeHex( idForBytes( sitePasswordInfo ) ) );
byte[] sitePasswordSeed = MP_mac.of( getKey(), sitePasswordInfo );
byte[] sitePasswordSeed = MPConstant.mpw_digest.of( getKey(), sitePasswordInfo );
logger.trc( "sitePasswordSeed ID: %s", CodeUtils.encodeHex( idForBytes( sitePasswordSeed ) ) );
Preconditions.checkState( sitePasswordSeed.length > 0 );

View File

@@ -1,12 +1,10 @@
package com.lyndir.masterpassword;
import com.google.common.primitives.Bytes;
import com.lambdaworks.crypto.SCrypt;
import com.lyndir.lhunath.opal.system.CodeUtils;
import com.lyndir.lhunath.opal.system.logging.Logger;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import javax.annotation.Nullable;
@@ -35,15 +33,15 @@ public class MasterKeyV3 extends MasterKeyV2 {
@Nullable
@Override
protected byte[] deriveKey(final char[] masterPassword) {
byte[] fullNameBytes = getFullName().getBytes( MP_charset );
byte[] fullNameBytes = getFullName().getBytes( MPConstant.mpw_charset );
byte[] fullNameLengthBytes = bytesForInt( fullNameBytes.length );
String mpKeyScope = MPSiteVariant.Password.getScope();
byte[] masterKeySalt = Bytes.concat( mpKeyScope.getBytes( MP_charset ), fullNameLengthBytes, fullNameBytes );
byte[] masterKeySalt = Bytes.concat( mpKeyScope.getBytes( MPConstant.mpw_charset ), fullNameLengthBytes, fullNameBytes );
logger.trc( "key scope: %s", mpKeyScope );
logger.trc( "masterKeySalt ID: %s", CodeUtils.encodeHex( idForBytes( masterKeySalt ) ) );
ByteBuffer mpBytesBuf = MP_charset.encode( CharBuffer.wrap( masterPassword ) );
ByteBuffer mpBytesBuf = MPConstant.mpw_charset.encode( CharBuffer.wrap( masterPassword ) );
byte[] mpBytes = new byte[mpBytesBuf.remaining()];
mpBytesBuf.get( mpBytes, 0, mpBytes.length );
Arrays.fill( mpBytesBuf.array(), (byte) 0 );

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyndir.masterpassword"
android:versionCode="2003"
android:versionName="2.3">
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="21" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:allowBackup="true"
android:debuggable="true">
<activity android:name=".EmergencyActivity" android:theme="@style/MPTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TestActivity" android:theme="@style/MPTheme" />
</application>
</manifest>

View File

@@ -0,0 +1,44 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
applicationId "com.lyndir.masterpassword"
minSdkVersion 19
targetSdkVersion 25
versionCode 20401
versionName "2.4.1"
}
// release with: STORE_PW=$(mpw masterpassword.keystore) KEY_PW=$(mpw masterpassword-android) gradle assembleRelease
signingConfigs {
release {
storeFile file('masterpassword.keystore')
storePassword System.getenv('STORE_PW')
keyAlias 'masterpassword-android'
keyPassword System.getenv('KEY_PW')
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
dependencies {
compile project( ':masterpassword-algorithm' )
compile project( ':masterpassword-tests' )
// Android dependencies
compile 'org.slf4j:slf4j-android:1.7.13-underscore'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile files('libs/scrypt-1.4.0-native.jar')
}

View File

@@ -1,8 +0,0 @@
/*___Generated_by_IDEA___*/
package com.lyndir.masterpassword;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}

View File

@@ -1,7 +0,0 @@
/*___Generated_by_IDEA___*/
package com.lyndir.masterpassword;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}

View File

@@ -1,7 +0,0 @@
/*___Generated_by_IDEA___*/
package com.lyndir.masterpassword;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}

View File

@@ -0,0 +1 @@
/Users/lhunath/annex/secret/release-com.lyndir.masterpassword.jks

View File

@@ -0,0 +1 @@
/Users/lhunath/annex/secret/masterpassword.keystore

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>com.lyndir.masterpassword</groupId>
<artifactId>masterpassword</artifactId>
<version>2.4-java</version>
<version>GIT-SNAPSHOT</version>
</parent>
<name>Master Password Android</name>
@@ -105,13 +105,13 @@
<dependency>
<groupId>com.lyndir.masterpassword</groupId>
<artifactId>masterpassword-algorithm</artifactId>
<version>2.4-java</version>
<version>GIT-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lyndir.masterpassword</groupId>
<artifactId>masterpassword-tests</artifactId>
<version>2.4-java</version>
<version>GIT-SNAPSHOT</version>
</dependency>
<!-- EXTERNAL DEPENDENCIES -->

View File

@@ -1 +0,0 @@
/Users/lhunath/SpiderOak Hive/secret/release-com.lyndir.masterpassword.jks

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyndir.masterpassword">
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name">
<activity
android:name=".EmergencyActivity"
android:theme="@style/MPTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TestActivity"
android:theme="@style/MPTheme" />
</application>
</manifest>

View File

@@ -13,8 +13,8 @@ import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.view.WindowManager;
import android.widget.*;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.UnsignedInteger;
@@ -40,40 +40,40 @@ public class EmergencyActivity extends Activity {
private ListenableFuture<MasterKey> masterKeyFuture;
@InjectView(R.id.progressView)
@BindView(R.id.progressView)
ProgressBar progressView;
@InjectView(R.id.fullNameField)
@BindView(R.id.fullNameField)
EditText fullNameField;
@InjectView(R.id.masterPasswordField)
@BindView(R.id.masterPasswordField)
EditText masterPasswordField;
@InjectView(R.id.siteNameField)
@BindView(R.id.siteNameField)
EditText siteNameField;
@InjectView(R.id.siteTypeButton)
@BindView(R.id.siteTypeButton)
Button siteTypeButton;
@InjectView(R.id.counterField)
@BindView(R.id.counterField)
Button siteCounterButton;
@InjectView(R.id.siteVersionButton)
@BindView(R.id.siteVersionButton)
Button siteVersionButton;
@InjectView(R.id.sitePasswordField)
@BindView(R.id.sitePasswordField)
Button sitePasswordField;
@InjectView(R.id.sitePasswordTip)
@BindView(R.id.sitePasswordTip)
TextView sitePasswordTip;
@InjectView(R.id.rememberFullNameField)
@BindView(R.id.rememberFullNameField)
CheckBox rememberFullNameField;
@InjectView(R.id.rememberPasswordField)
@BindView(R.id.rememberPasswordField)
CheckBox forgetPasswordField;
@InjectView(R.id.maskPasswordField)
@BindView(R.id.maskPasswordField)
CheckBox maskPasswordField;
private int id_userName;
@@ -92,7 +92,7 @@ public class EmergencyActivity extends Activity {
getWindow().setFlags( WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE );
setContentView( R.layout.activity_emergency );
ButterKnife.inject( this );
ButterKnife.bind( this );
fullNameField.setOnFocusChangeListener( new ValueChangedListener() {
@Override

View File

@@ -8,8 +8,8 @@ import android.content.Intent;
import android.os.*;
import android.view.View;
import android.widget.*;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.google.common.base.*;
import com.google.common.collect.*;
import com.google.common.util.concurrent.*;
@@ -27,19 +27,19 @@ public class TestActivity extends Activity implements MPTestSuite.Listener {
private final ListeningExecutorService backgroundExecutor = MoreExecutors.listeningDecorator( Executors.newSingleThreadExecutor() );
private final ListeningExecutorService mainExecutor = MoreExecutors.listeningDecorator( new MainThreadExecutor() );
@InjectView(R.id.progressView)
@BindView(R.id.progressView)
ProgressBar progressView;
@InjectView(R.id.statusView)
@BindView(R.id.statusView)
TextView statusView;
@InjectView(R.id.logView)
@BindView(R.id.logView)
TextView logView;
@InjectView(R.id.actionButton)
@BindView(R.id.actionButton)
Button actionButton;
@InjectView(R.id.nativeKDFField)
@BindView(R.id.nativeKDFField)
CheckBox nativeKDFField;
private MPTestSuite testSuite;
@@ -57,7 +57,7 @@ public class TestActivity extends Activity implements MPTestSuite.Listener {
Res.init( getResources() );
setContentView( R.layout.activity_test );
ButterKnife.inject( this );
ButterKnife.bind( this );
nativeKDFField.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() {
@Override

View File

@@ -0,0 +1,14 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '1.2.4'
}
description = 'Master Password CLI'
mainClassName = 'com.lyndir.masterpassword.CLI'
dependencies {
compile project(':masterpassword-algorithm')
compile group: 'ch.qos.logback', name: 'logback-classic', version:'1.1.2'
}

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>com.lyndir.masterpassword</groupId>
<artifactId>masterpassword</artifactId>
<version>2.4-java</version>
<version>GIT-SNAPSHOT</version>
</parent>
<name>Master Password CLI</name>
@@ -85,7 +85,7 @@
<dependency>
<groupId>com.lyndir.masterpassword</groupId>
<artifactId>masterpassword-algorithm</artifactId>
<version>2.4-java</version>
<version>GIT-SNAPSHOT</version>
</dependency>
<dependency>

Some files were not shown because too many files have changed in this diff Show More