Compare commits
149 Commits
2.1-releas
...
windows
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78f0dcd16c | ||
|
|
af36fa0f74 | ||
|
|
9ab1b2d47a | ||
|
|
17d38235a1 | ||
|
|
8912d5b8e2 | ||
|
|
1fe3edec04 | ||
|
|
8dd932da31 | ||
|
|
71ba6bd502 | ||
|
|
33eab0f199 | ||
|
|
7d6f2533db | ||
|
|
c6cd50379e | ||
|
|
fb86b3bc15 | ||
|
|
964b6f050b | ||
|
|
617923557a | ||
|
|
719deb7926 | ||
|
|
a51d2b5eb4 | ||
|
|
1f1407f31f | ||
|
|
afb0a0365a | ||
|
|
834434a499 | ||
|
|
00033eca37 | ||
|
|
574f239545 | ||
|
|
99f5dfe040 | ||
|
|
c0e6e60a38 | ||
|
|
b656899532 | ||
|
|
dbd5265ee0 | ||
|
|
b533400286 | ||
|
|
09d67113a2 | ||
|
|
f0fa350e64 | ||
|
|
435d72a509 | ||
|
|
66220ed34e | ||
|
|
395f7c71a2 | ||
|
|
96b482d94b | ||
|
|
c9c9aec9dd | ||
|
|
7bb79c6a1e | ||
|
|
4b2251d4fa | ||
|
|
1c72643aaa | ||
|
|
acf9b4aec8 | ||
|
|
1f173d7586 | ||
|
|
34be1eac70 | ||
|
|
e1a9c8194c | ||
|
|
e18dee2242 | ||
|
|
a38829c1e2 | ||
|
|
8615f6af5d | ||
|
|
d642cb1aee | ||
|
|
2be2a19fa0 | ||
|
|
0d5b51ed8d | ||
|
|
c781bcf10a | ||
|
|
1c45a0df4a | ||
|
|
6b16e4d606 | ||
|
|
e837752777 | ||
|
|
84c23fa7f6 | ||
|
|
2b0cc8ec7b | ||
|
|
6f77e1922b | ||
|
|
653f90c59c | ||
|
|
3076cc3de4 | ||
|
|
15c53c06c6 | ||
|
|
b3a886a6db | ||
|
|
41ae6a5de5 | ||
|
|
92bd2cd016 | ||
|
|
4b975b5b04 | ||
|
|
56f04a8924 | ||
|
|
3c2b5de4b8 | ||
|
|
33e1492b44 | ||
|
|
9384e27247 | ||
|
|
a95561dd50 | ||
|
|
9d809f34d9 | ||
|
|
fc21bd959f | ||
|
|
2de17384ff | ||
|
|
85dab50996 | ||
|
|
bb97e8f3e8 | ||
|
|
f3d0368a75 | ||
|
|
283d555d3b | ||
|
|
d909e64670 | ||
|
|
10f100186c | ||
|
|
2af2351ebf | ||
|
|
49b3fe7913 | ||
|
|
9d926be8ae | ||
|
|
c3474de2ff | ||
|
|
68b9b4e09a | ||
|
|
b810c1032b | ||
|
|
a4ab3c7bc9 | ||
|
|
039547b735 | ||
|
|
6f741f6f2f | ||
|
|
38d4b761b7 | ||
|
|
18f8ebb9dc | ||
|
|
794d064a99 | ||
|
|
090b274363 | ||
|
|
25ba87f119 | ||
|
|
f0b659a0c7 | ||
|
|
7736788920 | ||
|
|
e3be98f3ad | ||
|
|
d9b1b44de0 | ||
|
|
c3c2de5d14 | ||
|
|
6aa50bac04 | ||
|
|
5268039c3d | ||
|
|
0d66d4660e | ||
|
|
e981df3c8b | ||
|
|
543ebd4bac | ||
|
|
e6d21e1c1d | ||
|
|
a3ebcf0608 | ||
|
|
556d1d3d58 | ||
|
|
979d3a2a5a | ||
|
|
480e7f192a | ||
|
|
a18793b161 | ||
|
|
9b24efa65c | ||
|
|
3e217d5a69 | ||
|
|
c8ca1c80e6 | ||
|
|
88c18db010 | ||
|
|
f909cdbae4 | ||
|
|
8b8d5d325e | ||
|
|
c7670f47db | ||
|
|
f3f25f5890 | ||
|
|
3065433a37 | ||
|
|
41b3964363 | ||
|
|
5e8810c535 | ||
|
|
8c3dfc8510 | ||
|
|
b4b9ee3cb9 | ||
|
|
da4bad7977 | ||
|
|
984434cca4 | ||
|
|
064122f36d | ||
|
|
5db083bf7c | ||
|
|
44f91e0618 | ||
|
|
6050b5d6fd | ||
|
|
8e3e77c2c1 | ||
|
|
a2e71aa94d | ||
|
|
a5bc2eb584 | ||
|
|
9bb613a3b6 | ||
|
|
466863f8fd | ||
|
|
fe5828c724 | ||
|
|
b3ec7a848d | ||
|
|
17734652b4 | ||
|
|
9e742fa40f | ||
|
|
d03b1746e0 | ||
|
|
58156be793 | ||
|
|
d5a5cd7de4 | ||
|
|
2100662fb3 | ||
|
|
248627aa92 | ||
|
|
449ccaa3d4 | ||
|
|
0a7465282b | ||
|
|
5b85ba3a4b | ||
|
|
b3a0b6a7c0 | ||
|
|
4396ce436e | ||
|
|
68e6106ee7 | ||
|
|
4c12f368f5 | ||
|
|
0156f8c3c8 | ||
|
|
2e5cbac761 | ||
|
|
a043b7c049 | ||
|
|
06c62f70ed | ||
|
|
bc88daf08d |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -16,6 +16,9 @@
|
||||
xcuserdata/
|
||||
/DerivedData/
|
||||
|
||||
# Generated
|
||||
MasterPassword/Resources/Media/Images.xcassets/
|
||||
|
||||
# Media
|
||||
Press/Background.png
|
||||
Press/Front-Page.png
|
||||
@@ -29,7 +32,10 @@ Press/MasterPassword_PressKit/MasterPassword_pressrelease_*.pdf
|
||||
MasterPassword/Java/**/target
|
||||
|
||||
# C
|
||||
MasterPassword/C/VERSION
|
||||
MasterPassword/C/*.o
|
||||
MasterPassword/C/mpw-*.tar.gz
|
||||
MasterPassword/C/mpw
|
||||
MasterPassword/C/mpw-bench
|
||||
MasterPassword/C/lib/*/*
|
||||
!MasterPassword/C/lib/*/.source
|
||||
|
||||
21
.gitmodules
vendored
21
.gitmodules
vendored
@@ -4,9 +4,18 @@
|
||||
[submodule "External/InAppSettingsKit"]
|
||||
path = External/InAppSettingsKit
|
||||
url = git://github.com/lhunath/InAppSettingsKit.git
|
||||
[submodule "External/UbiquityStoreManager"]
|
||||
path = External/UbiquityStoreManager
|
||||
url = git://github.com/lhunath/UbiquityStoreManager.git
|
||||
[submodule "External/RHStatusItemView"]
|
||||
path = External/RHStatusItemView
|
||||
url = git://github.com/lhunath/RHStatusItemView.git
|
||||
[submodule "External/KCOrderedAccessorFix"]
|
||||
path = External/KCOrderedAccessorFix
|
||||
url = https://github.com/lhunath/KCOrderedAccessorFix.git
|
||||
[submodule "External/AttributedMarkdown"]
|
||||
path = External/AttributedMarkdown
|
||||
url = https://github.com/dreamwieber/AttributedMarkdown.git
|
||||
[submodule "External/uicolor-utilities"]
|
||||
path = External/uicolor-utilities
|
||||
url = git://github.com/lhunath/uicolor-utilities.git
|
||||
[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
|
||||
url = https://github.com/Lyndir/mpw-js.git
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
language: objective-c
|
||||
xcode_workspace: MasterPassword.xcworkspace
|
||||
xcode_project: MasterPassword/ObjC/iOS/MasterPassword-iOS.xcodeproj
|
||||
xcode_scheme: MasterPassword iOS (Development)
|
||||
xcode_sdk: iphonesimulator
|
||||
env: TERM=dumb
|
||||
git:
|
||||
submodules: false
|
||||
before_install: ./Scripts/updateDependencies
|
||||
submodules: true
|
||||
|
||||
1
External/AttributedMarkdown
vendored
Submodule
1
External/AttributedMarkdown
vendored
Submodule
Submodule External/AttributedMarkdown added at d598fb4f5e
1
External/KCOrderedAccessorFix
vendored
Submodule
1
External/KCOrderedAccessorFix
vendored
Submodule
Submodule External/KCOrderedAccessorFix added at 1b8f8b79ad
1
External/Mac/Crashlytics.framework/Modules
vendored
Symbolic link
1
External/Mac/Crashlytics.framework/Modules
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
Versions/Current/Modules
|
||||
Binary file not shown.
@@ -38,6 +38,7 @@
|
||||
*
|
||||
**/
|
||||
OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
OBJC_EXTERN void CLSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,6 +47,8 @@ OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
*
|
||||
**/
|
||||
OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
OBJC_EXTERN void CLSNSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
|
||||
|
||||
|
||||
@protocol CrashlyticsDelegate;
|
||||
|
||||
|
||||
6
External/Mac/Crashlytics.framework/Versions/A/Modules/module.modulemap
vendored
Normal file
6
External/Mac/Crashlytics.framework/Versions/A/Modules/module.modulemap
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
framework module Crashlytics {
|
||||
umbrella header "Crashlytics.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -15,13 +15,13 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.1.2</string>
|
||||
<string>2.2.5</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>macosx</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>9</string>
|
||||
<string>39</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
|
||||
BIN
External/Mac/Crashlytics.framework/run
vendored
BIN
External/Mac/Crashlytics.framework/run
vendored
Binary file not shown.
2
External/Pearl
vendored
2
External/Pearl
vendored
Submodule External/Pearl updated: b63670d86d...2237aaf429
1
External/RHStatusItemView
vendored
1
External/RHStatusItemView
vendored
Submodule External/RHStatusItemView deleted from 039dc04e66
1
External/UbiquityStoreManager
vendored
1
External/UbiquityStoreManager
vendored
Submodule External/UbiquityStoreManager deleted from 3492749214
Binary file not shown.
@@ -38,6 +38,7 @@
|
||||
*
|
||||
**/
|
||||
OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
OBJC_EXTERN void CLSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,6 +47,8 @@ OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
*
|
||||
**/
|
||||
OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
|
||||
OBJC_EXTERN void CLSNSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0);
|
||||
|
||||
|
||||
@protocol CrashlyticsDelegate;
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.2.4</string>
|
||||
<string>2.2.5</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>iPhoneOS</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>38</string>
|
||||
<string>40</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>iphoneos</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
|
||||
BIN
External/iOS/Crashlytics.framework/run
vendored
BIN
External/iOS/Crashlytics.framework/run
vendored
Binary file not shown.
BIN
External/iOS/Crashlytics.framework/submit
vendored
BIN
External/iOS/Crashlytics.framework/submit
vendored
Binary file not shown.
1
External/jrswizzle
vendored
Submodule
1
External/jrswizzle
vendored
Submodule
Submodule External/jrswizzle added at 98d18aee73
1
External/uicolor-utilities
vendored
Submodule
1
External/uicolor-utilities
vendored
Submodule
Submodule External/uicolor-utilities added at ae96212a49
@@ -18,8 +18,12 @@
|
||||
<string>github.com:Lyndir/Lyndir.git</string>
|
||||
<key>2FE140B36B7D26140DC8D5E5C639DC5900EFCF35</key>
|
||||
<string>git://github.com/lhunath/uicolor-utilities.git</string>
|
||||
<key>304AD0F97EA7B4893D91DFB8C3413D4E627B9472</key>
|
||||
<string>https://github.com/CFKevinRef/KCOrderedAccessorFix.git</string>
|
||||
<key>3E67FB08419C920516AAC3B00DAAF23073B8CF77</key>
|
||||
<string>git://github.com/lhunath/RHStatusItemView.git</string>
|
||||
<key>3ED8592497DB6A564366943C9AAD5A46341B5076</key>
|
||||
<string>https://github.com/dreamwieber/AttributedMarkdown.git</string>
|
||||
<key>4DDCFFD91B41F00326AD14553BD66CFD366ABD91</key>
|
||||
<string>ssh://github.com/Lyndir/Pearl.git</string>
|
||||
<key>8A15A8EA0B3D0B497C4883425BC74DF995224BB3</key>
|
||||
@@ -41,8 +45,12 @@
|
||||
<string>../..</string>
|
||||
<key>2FE140B36B7D26140DC8D5E5C639DC5900EFCF35</key>
|
||||
<string>../External/Pearl/External/uicolor-utilities</string>
|
||||
<key>304AD0F97EA7B4893D91DFB8C3413D4E627B9472</key>
|
||||
<string>../External/KCOrderedAccessorFix</string>
|
||||
<key>3E67FB08419C920516AAC3B00DAAF23073B8CF77</key>
|
||||
<string>../External/RHStatusItemView</string>
|
||||
<key>3ED8592497DB6A564366943C9AAD5A46341B5076</key>
|
||||
<string>../External/AttributedMarkdown</string>
|
||||
<key>4DDCFFD91B41F00326AD14553BD66CFD366ABD91</key>
|
||||
<string>../External/Pearl</string>
|
||||
<key>8A15A8EA0B3D0B497C4883425BC74DF995224BB3</key>
|
||||
@@ -68,6 +76,14 @@
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>3ED8592497DB6A564366943C9AAD5A46341B5076</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>AttributedMarkdown</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
@@ -84,6 +100,14 @@
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>jrswizzle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>304AD0F97EA7B4893D91DFB8C3413D4E627B9472</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>KCOrderedAccessorFix</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,270 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run with -DDEBUG to enable trace-level output.
|
||||
#
|
||||
# TROUBLESHOOTING
|
||||
# - To enable verbose algorithm/implementation debugging, use ./build -DDEBUG
|
||||
# - If you see 'undefined reference to `AES_encrypt'',
|
||||
# make sure you have openssl installed.
|
||||
# If libcrypto.a is in a non-standard directory, try ./build -L[your-lib-dir]
|
||||
# - If you see 'undefined reference to `clock_gettime'',
|
||||
# try ./build -lrt instead.
|
||||
# - If you see 'x86.S:202: Error: junk at end of line, first unrecognized character is `,'',
|
||||
# try commenting the line in lib/bcrypt/x86.S.
|
||||
#
|
||||
# BUGS
|
||||
# masterpassword@lyndir.com
|
||||
#
|
||||
# AUTHOR
|
||||
# Maarten Billemont
|
||||
#
|
||||
cd "${BASH_SOURCE%/*}"
|
||||
shopt -s extglob
|
||||
set -e
|
||||
|
||||
[[ -e lib/scrypt/scryptenc.o ]] || { echo >&2 "Missing scrypt. First get and build the scrypt source in lib/scrypt from <$(<lib/scrypt/.source)>.\n"; exit 1; }
|
||||
|
||||
deps=( -I"lib/scrypt/lib" -I"lib/scrypt/libcperciva" -l "crypto_aesctr.o" -l "sha256.o" -l "crypto_scrypt-nosse.o" -l "memlimit.o" -l "scryptenc_cpuperf.o" -l"scryptenc.o" -l"crypto" -L"." -L"lib/scrypt" )
|
||||
### CONFIGURATION
|
||||
|
||||
gcc "${deps[@]}" -Qunused-arguments -c types.c -o types.o "$@"
|
||||
gcc "${deps[@]}" -Qunused-arguments -l"types.o" mpw.c -o mpw "$@"
|
||||
# Targets to build.
|
||||
if [[ $targets ]]; then
|
||||
read -ra targets <<< "$targets"
|
||||
else
|
||||
# Default targets.
|
||||
# Modify here or override using targets='mpw mpw-bench' ./build
|
||||
targets=(
|
||||
mpw # C CLI version of Master Password.
|
||||
#mpw-bench # C CLI Master Password benchmark utility.
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
digest() {
|
||||
openssl sha -sha256 -binary < "$1" | od -t x1 -An -v | tr -d '[:space:]'
|
||||
}
|
||||
fetch() {
|
||||
if hash wget 2>/dev/null; then
|
||||
wget -O "${1##*/}" "$1"
|
||||
elif hash curl 2>/dev/null; then
|
||||
curl "$1" > "${1##*/}"
|
||||
fi
|
||||
}
|
||||
unpack() {
|
||||
if [[ $1 = *.tar.gz || $1 = *.tgz ]]; then
|
||||
tar -xvzf "$1"
|
||||
|
||||
elif [[ $1 = *.tar.bz2 || $1 = *.tbz2 ]]; then
|
||||
tar -xvjf "$1"
|
||||
|
||||
elif [[ $1 = *.tar ]]; then
|
||||
tar -xvf "$1"
|
||||
|
||||
else
|
||||
echo 2>&1 "Don't know how to unpack: $1"
|
||||
fi
|
||||
|
||||
printf 'Verifying package: %s, against digest: %s...' "$1" "$2"
|
||||
[[ $(digest "$1") = $2 ]] || {
|
||||
printf ' mismatch!\n'
|
||||
echo 2>&1 "Downloaded package doesn't match digest."
|
||||
exit 1
|
||||
}
|
||||
printf ' OK!\n'
|
||||
|
||||
files=( !("$1") )
|
||||
if [[ -d $files ]] && (( ${#files[@]} == 1 )); then
|
||||
mv "$files"/* .
|
||||
rmdir "$files"
|
||||
fi
|
||||
}
|
||||
fetchSource() (
|
||||
source .source
|
||||
|
||||
if [[ $pkg && -e "${pkg##*/}" ]]; then
|
||||
files=( !("${pkg##*/}") )
|
||||
[[ -e $files ]] || {
|
||||
echo
|
||||
echo "Unpacking: ${PWD##*/}, using package..."
|
||||
unpack "${pkg##*/}" "$pkg_sha256"
|
||||
}
|
||||
|
||||
elif [[ $git ]] && hash git 2>/dev/null; then
|
||||
[[ -e .git ]] || {
|
||||
echo
|
||||
echo "Fetching: ${PWD##*/}, using git..."
|
||||
git clone "$svn" .
|
||||
printf '%s' "$(git describe --always)" > "${PWD##*/}-version"
|
||||
}
|
||||
|
||||
elif [[ $svn ]] && hash git 2>/dev/null && [[ -x "$(git --exec-path)/git-svn" ]]; then
|
||||
[[ -e .git ]] || {
|
||||
echo
|
||||
echo "Fetching: ${PWD##*/}, using git-svn..."
|
||||
git svn clone --prefix=origin/ --stdlayout "$svn" .
|
||||
printf '%s' "$(git describe --always)" > "${PWD##*/}-version"
|
||||
}
|
||||
|
||||
elif [[ $svn ]] && hash svn 2>/dev/null; then
|
||||
[[ -e .svn ]] || {
|
||||
echo
|
||||
echo "Fetching: ${PWD##*/}, using svn..."
|
||||
svn checkout "$svn/trunk" .
|
||||
printf 'r%s' "$(svn info | awk '/^Revision:/{ print $2 }')" > "${PWD##*/}-version"
|
||||
}
|
||||
|
||||
elif [[ $pkg ]]; then
|
||||
files=( !("${pkg##*/}") )
|
||||
[[ -e $files ]] || {
|
||||
echo
|
||||
echo "Fetching: ${PWD##*/}, using package..."
|
||||
fetch "$pkg"
|
||||
unpack "${pkg##*/}" "$pkg_sha256"
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
echo >&2 "error: Missing git-svn or svn."
|
||||
echo >&2 "error: Please install either or manually check out the sources"
|
||||
echo >&2 "error: from: $home"
|
||||
echo >&2 "error: into: $PWD"
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
depend() {
|
||||
|
||||
echo
|
||||
echo "Checking dependency: $1..."
|
||||
[[ -e "lib/$1/.built" ]] && return
|
||||
|
||||
pushd "lib/$1"
|
||||
fetchSource
|
||||
|
||||
echo
|
||||
echo "Configuring dependency: $1..."
|
||||
if [[ -e configure.ac ]]; then
|
||||
if [[ ! -e configure ]]; then
|
||||
# create configure using autotools.
|
||||
if ! hash aclocal || ! hash automake; then
|
||||
echo >&2 "Need autotools to build $1. Please install automake and autoconf."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
aclocal
|
||||
autoheader
|
||||
autoconf
|
||||
mkdir -p config.aux
|
||||
automake --add-missing
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -e configure ]]; then
|
||||
./configure
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Building dependency: $1..."
|
||||
if [[ -e Makefile ]]; then
|
||||
if ! hash make; then
|
||||
echo >&2 "Need make to build $1. Please install GNU make."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make
|
||||
date > .built
|
||||
else
|
||||
echo >&2 "error: Don't know how to build: $1"
|
||||
exit 1
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
### MPW
|
||||
mpw() {
|
||||
depend scrypt
|
||||
|
||||
echo
|
||||
echo "Building target: $target..."
|
||||
CFLAGS=(
|
||||
# include paths
|
||||
-I"lib/scrypt/lib" -I"lib/scrypt/libcperciva"
|
||||
)
|
||||
LDFLAGS=(
|
||||
# library paths
|
||||
-L"." -L"lib/scrypt"
|
||||
# link libraries
|
||||
-l"crypto" -l"curses"
|
||||
# scrypt
|
||||
"lib/scrypt/scrypt-crypto_aesctr.o"
|
||||
"lib/scrypt/scrypt-sha256.o"
|
||||
"lib/scrypt/scrypt-crypto_scrypt-nosse.o"
|
||||
"lib/scrypt/scrypt-memlimit.o"
|
||||
"lib/scrypt/scrypt-scryptenc_cpuperf.o"
|
||||
"lib/scrypt/scrypt-scryptenc.o"
|
||||
)
|
||||
|
||||
cc "${CFLAGS[@]}" -c types.c -o types.o "$@"
|
||||
cc "${CFLAGS[@]}" "${LDFLAGS[@]}" "types.o" mpw.c -o mpw "$@"
|
||||
echo "done! Now run ./install or use ./mpw"
|
||||
}
|
||||
|
||||
|
||||
### MPW-BENCH
|
||||
mpw-bench() {
|
||||
depend scrypt
|
||||
depend bcrypt
|
||||
|
||||
echo
|
||||
echo "Building target: $target..."
|
||||
CFLAGS=(
|
||||
# include paths
|
||||
-I"lib/scrypt/lib" -I"lib/scrypt/libcperciva"
|
||||
-I"lib/bcrypt"
|
||||
)
|
||||
LDFLAGS=(
|
||||
# library paths
|
||||
-L"." -L"lib/scrypt"
|
||||
-L"lib/bcrypt"
|
||||
# libraries
|
||||
-l"crypto"
|
||||
# scrypt
|
||||
"lib/scrypt/scrypt-crypto_aesctr.o"
|
||||
"lib/scrypt/scrypt-sha256.o"
|
||||
"lib/scrypt/scrypt-crypto_scrypt-nosse.o"
|
||||
"lib/scrypt/scrypt-memlimit.o"
|
||||
"lib/scrypt/scrypt-scryptenc_cpuperf.o"
|
||||
"lib/scrypt/scrypt-scryptenc.o"
|
||||
# bcrypt
|
||||
"lib/bcrypt/crypt_blowfish.o"
|
||||
"lib/bcrypt/crypt_gensalt.o"
|
||||
"lib/bcrypt/wrapper.o"
|
||||
"lib/bcrypt/x86.o"
|
||||
)
|
||||
|
||||
cc "${CFLAGS[@]}" -c types.c -o types.o "$@"
|
||||
cc "${CFLAGS[@]}" "${LDFLAGS[@]}" "types.o" mpw-bench.c -o mpw-bench "$@"
|
||||
echo "done! Now use ./mpw-bench"
|
||||
}
|
||||
|
||||
|
||||
### TARGETS
|
||||
|
||||
haslib() {
|
||||
! LC_ALL=C cc -l"$1" 2>&1 | grep -q 'library not found'
|
||||
}
|
||||
cc() {
|
||||
if hash llvm-gcc 2>/dev/null; then
|
||||
llvm-gcc "$@"
|
||||
elif hash gcc 2>/dev/null; then
|
||||
gcc -std=gnu99 "$@"
|
||||
elif hash clang 2>/dev/null; then
|
||||
clang "$@"
|
||||
else
|
||||
echo >&2 "Need a compiler. Please install GCC or LLVM."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Will build targets: ${targets[*]}..."
|
||||
for target in "${targets[@]}"; do
|
||||
"$target" "$@"
|
||||
done
|
||||
|
||||
20
MasterPassword/C/distribute
Executable file
20
MasterPassword/C/distribute
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cd "${BASH_SOURCE%/*}"
|
||||
tag=$(git describe)
|
||||
commit=$(git describe --long --dirty)
|
||||
[[ $tag && $commit = $tag-* ]] || exit 1
|
||||
git show --show-signature --pretty=format:%H --quiet "$tag" > VERSION
|
||||
|
||||
mpwArchive=mpw-$commit.tar.gz
|
||||
[[ -e $mpwArchive ]] && echo "WARNING: $mpwArchive already exists. Will overwrite."
|
||||
read -n1 -p "Will prepare and release $mpwArchive. Press a key to continue or ^C to abort."
|
||||
|
||||
git ls-files -z . | xargs -0 tar -cvzf "$mpwArchive"
|
||||
echo "$mpwArchive ready, SHA256: $(openssl sha -sha256 < "$mpwArchive")"
|
||||
|
||||
cd ../../Site/current
|
||||
ln -sf "../../MasterPassword/C/$mpwArchive"
|
||||
[[ -e $_ ]]
|
||||
echo "Linked from site, please update your hyperlinks to point to http://masterpasswordapp.com/$mpwArchive"
|
||||
3
MasterPassword/C/lib/bcrypt/.source
Normal file
3
MasterPassword/C/lib/bcrypt/.source
Normal file
@@ -0,0 +1,3 @@
|
||||
home=http://www.openwall.com/crypt/
|
||||
pkg=http://www.openwall.com/crypt/crypt_blowfish-1.3.tar.gz
|
||||
pkg_sha256=83fa01fca6996fe8d882b7f8e9ba0305a5664936100b01481ea3c6a8ce8d72fd
|
||||
@@ -1 +1,4 @@
|
||||
https://code.google.com/p/scrypt/
|
||||
home=https://code.google.com/p/scrypt/
|
||||
svn=http://scrypt.googlecode.com/svn
|
||||
pkg=http://masterpasswordapp.com/libscrypt-b12b554.tar.gz
|
||||
pkg_sha256=c726daec68a345e420896f005394a948dc5a6924713ed94b684c856d4c247f0b
|
||||
|
||||
Binary file not shown.
Binary file not shown.
187
MasterPassword/C/mpw-bench.c
Normal file
187
MasterPassword/C/mpw-bench.c
Normal file
@@ -0,0 +1,187 @@
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <pwd.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <alg/sha256.h>
|
||||
#include <crypto/crypto_scrypt.h>
|
||||
#include <ow-crypt.h>
|
||||
#include "types.h"
|
||||
|
||||
#define MP_N 32768
|
||||
#define MP_r 8
|
||||
#define MP_p 2
|
||||
#define MP_dkLen 64
|
||||
#define MP_hash PearlHashSHA256
|
||||
|
||||
|
||||
int main(int argc, char *const argv[]) {
|
||||
|
||||
char *userName = "Robert Lee Mitchel";
|
||||
char *masterPassword = "banana colored duckling";
|
||||
char *siteName = "masterpasswordapp.com";
|
||||
uint32_t siteCounter = 1;
|
||||
MPElementType siteType = MPElementTypeGeneratedLong;
|
||||
|
||||
// Start MP
|
||||
struct timeval startTime;
|
||||
if (gettimeofday(&startTime, NULL) != 0) {
|
||||
fprintf(stderr, "Could not get time: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int iterations = 100;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
// Calculate the master key salt.
|
||||
char *mpNameSpace = "com.lyndir.masterpassword";
|
||||
const uint32_t n_userNameLength = htonl(strlen(userName));
|
||||
const size_t masterKeySaltLength = strlen(mpNameSpace) + sizeof(n_userNameLength) + strlen(userName);
|
||||
char *masterKeySalt = malloc( masterKeySaltLength );
|
||||
if (!masterKeySalt) {
|
||||
fprintf(stderr, "Could not allocate master key salt: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *mKS = masterKeySalt;
|
||||
memcpy(mKS, mpNameSpace, strlen(mpNameSpace)); mKS += strlen(mpNameSpace);
|
||||
memcpy(mKS, &n_userNameLength, sizeof(n_userNameLength)); mKS += sizeof(n_userNameLength);
|
||||
memcpy(mKS, userName, strlen(userName)); mKS += strlen(userName);
|
||||
if (mKS - masterKeySalt != masterKeySaltLength)
|
||||
abort();
|
||||
trc("masterKeySalt ID: %s\n", IDForBuf(masterKeySalt, masterKeySaltLength));
|
||||
|
||||
// Calculate the master key.
|
||||
uint8_t *masterKey = malloc( MP_dkLen );
|
||||
if (!masterKey) {
|
||||
fprintf(stderr, "Could not allocate master key: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
if (crypto_scrypt( (const uint8_t *)masterPassword, strlen(masterPassword), (const uint8_t *)masterKeySalt, masterKeySaltLength, MP_N, MP_r, MP_p, masterKey, MP_dkLen ) < 0) {
|
||||
fprintf(stderr, "Could not generate master key: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
memset(masterKeySalt, 0, masterKeySaltLength);
|
||||
free(masterKeySalt);
|
||||
|
||||
// Calculate the site seed.
|
||||
const uint32_t n_siteNameLength = htonl(strlen(siteName));
|
||||
const uint32_t n_siteCounter = htonl(siteCounter);
|
||||
const size_t sitePasswordInfoLength = strlen(mpNameSpace) + sizeof(n_siteNameLength) + strlen(siteName) + sizeof(n_siteCounter);
|
||||
char *sitePasswordInfo = malloc( sitePasswordInfoLength );
|
||||
if (!sitePasswordInfo) {
|
||||
fprintf(stderr, "Could not allocate site seed: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *sPI = sitePasswordInfo;
|
||||
memcpy(sPI, mpNameSpace, strlen(mpNameSpace)); sPI += strlen(mpNameSpace);
|
||||
memcpy(sPI, &n_siteNameLength, sizeof(n_siteNameLength)); sPI += sizeof(n_siteNameLength);
|
||||
memcpy(sPI, siteName, strlen(siteName)); sPI += strlen(siteName);
|
||||
memcpy(sPI, &n_siteCounter, sizeof(n_siteCounter)); sPI += sizeof(n_siteCounter);
|
||||
if (sPI - sitePasswordInfo != sitePasswordInfoLength)
|
||||
abort();
|
||||
|
||||
uint8_t sitePasswordSeed[32];
|
||||
HMAC_SHA256_Buf(masterKey, MP_dkLen, sitePasswordInfo, sitePasswordInfoLength, sitePasswordSeed);
|
||||
memset(masterKey, 0, MP_dkLen);
|
||||
memset(sitePasswordInfo, 0, sitePasswordInfoLength);
|
||||
free(masterKey);
|
||||
free(sitePasswordInfo);
|
||||
|
||||
// Determine the cipher.
|
||||
const char *cipher = CipherForType(siteType, sitePasswordSeed[0]);
|
||||
trc("type %d, cipher: %s\n", siteType, cipher);
|
||||
if (strlen(cipher) > 32)
|
||||
abort();
|
||||
|
||||
// Encode the password from the seed using the cipher.
|
||||
char *sitePassword = calloc(strlen(cipher) + 1, sizeof(char));
|
||||
for (int c = 0; c < strlen(cipher); ++c) {
|
||||
sitePassword[c] = CharacterFromClass(cipher[c], sitePasswordSeed[c + 1]);
|
||||
trc("class %c, character: %c\n", cipher[c], sitePassword[c]);
|
||||
}
|
||||
memset(sitePasswordSeed, 0, sizeof(sitePasswordSeed));
|
||||
|
||||
if (i % 1 == 0)
|
||||
fprintf( stderr, "\rmpw: iteration %d / %d..", i, iterations );
|
||||
}
|
||||
|
||||
// Output timing results.
|
||||
struct timeval endTime;
|
||||
if (gettimeofday(&endTime, NULL) != 0) {
|
||||
fprintf(stderr, "Could not get time: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
long long secs = (endTime.tv_sec - startTime.tv_sec);
|
||||
long long usecs = (endTime.tv_usec - startTime.tv_usec);
|
||||
double elapsed = secs + usecs / 1000000.0;
|
||||
double mpwSpeed = iterations / elapsed;
|
||||
fprintf( stdout, " done. %d iterations in %llds %lldµs -> %.2f/s\n", iterations, secs, usecs, mpwSpeed );
|
||||
|
||||
// Start SHA-256
|
||||
if (gettimeofday(&startTime, NULL) != 0) {
|
||||
fprintf(stderr, "Could not get time: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
|
||||
iterations = 50000000;
|
||||
uint8_t hash[32];
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
SHA256_Buf(masterPassword, strlen(masterPassword), hash);
|
||||
|
||||
if (i % 1000 == 0)
|
||||
fprintf( stderr, "\rsha256: iteration %d / %d..", i, iterations );
|
||||
}
|
||||
|
||||
// Output timing results.
|
||||
if (gettimeofday(&endTime, NULL) != 0) {
|
||||
fprintf(stderr, "Could not get time: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
secs = (endTime.tv_sec - startTime.tv_sec);
|
||||
usecs = (endTime.tv_usec - startTime.tv_usec);
|
||||
elapsed = secs + usecs / 1000000.0;
|
||||
double sha256Speed = iterations / elapsed;
|
||||
fprintf( stdout, " done. %d iterations in %llds %lldµs -> %.2f/s\n", iterations, secs, usecs, sha256Speed );
|
||||
|
||||
// Start BCrypt
|
||||
if (gettimeofday(&startTime, NULL) != 0) {
|
||||
fprintf(stderr, "Could not get time: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int bcrypt_cost = 9;
|
||||
iterations = 600;
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
crypt(masterPassword, crypt_gensalt("$2b$", bcrypt_cost, userName, strlen(userName)));
|
||||
|
||||
if (i % 10 == 0)
|
||||
fprintf( stderr, "\rbcrypt (cost %d): iteration %d / %d..", bcrypt_cost, i, iterations );
|
||||
}
|
||||
|
||||
// Output timing results.
|
||||
if (gettimeofday(&endTime, NULL) != 0) {
|
||||
fprintf(stderr, "Could not get time: %d\n", errno);
|
||||
return 1;
|
||||
}
|
||||
secs = (endTime.tv_sec - startTime.tv_sec);
|
||||
usecs = (endTime.tv_usec - startTime.tv_usec);
|
||||
elapsed = secs + usecs / 1000000.0;
|
||||
double bcrypt9Speed = iterations / elapsed;
|
||||
fprintf( stdout, " done. %d iterations in %llds %lldµs -> %.2f/s\n", iterations, secs, usecs, bcrypt9Speed );
|
||||
|
||||
// Summarize.
|
||||
fprintf( stdout, "\n== SUMMARY ==\nOn this machine,\n" );
|
||||
fprintf( stdout, "mpw is %f times slower than sha256\n", sha256Speed / mpwSpeed );
|
||||
fprintf( stdout, "mpw is %f times slower than bcrypt (cost 9)\n", bcrypt9Speed / mpwSpeed );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#define _WITH_GETLINE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
@@ -23,6 +24,12 @@
|
||||
#include <crypto/crypto_scrypt.h>
|
||||
#include "types.h"
|
||||
|
||||
#if defined(READLINE)
|
||||
#include <readline/readline.h>
|
||||
#elif defined(EDITLINE)
|
||||
#include <histedit.h>
|
||||
#endif
|
||||
|
||||
#define MP_N 32768
|
||||
#define MP_r 8
|
||||
#define MP_p 2
|
||||
@@ -44,14 +51,22 @@ void usage() {
|
||||
" m, med, medium | Copy-friendly, 8 characters, contains symbols.\n"
|
||||
" b, basic | 8 characters, no symbols.\n"
|
||||
" s, short | Copy-friendly, 4 characters, no symbols.\n"
|
||||
" p, pin | 4 numbers.\n"
|
||||
" n, name | 9 letter name.\n\n", MP_env_sitetype);
|
||||
" i, pin | 4 numbers.\n"
|
||||
" n, name | 9 letter name.\n"
|
||||
" p, phrase | 20 character sentence.\n\n", MP_env_sitetype);
|
||||
fprintf(stderr, " -c counter The value of the counter.\n"
|
||||
" Defaults to %s in env or '1'.\n\n", MP_env_sitecounter);
|
||||
fprintf(stderr, " -v variant The kind of content to generate.\n"
|
||||
" Defaults to 'password'.\n"
|
||||
" p, password | The password to log in with.\n"
|
||||
" l, login | The username to log in as.\n\n");
|
||||
" l, login | The username to log in as.\n"
|
||||
" a, answer | The answer to a security question.\n\n");
|
||||
fprintf(stderr, " -C context A variant-specific context.\n"
|
||||
" Defaults to empty.\n"
|
||||
" -v p, password | Doesn't currently use a context.\n"
|
||||
" -v l, login | Doesn't currently use a context.\n"
|
||||
" -v a, answer | Empty for a universal site answer or\n"
|
||||
" | the most significant word(s) of the question.\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -80,40 +95,54 @@ char *homedir(const char *filename) {
|
||||
return homefile;
|
||||
}
|
||||
|
||||
char *getlinep(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) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
buf[lineSize - 1]=0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
int main(int argc, char *const argv[]) {
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
// Read the environment.
|
||||
const char *userName = getenv( MP_env_username );
|
||||
char *userName = getenv( MP_env_username );
|
||||
const char *masterPassword = NULL;
|
||||
const char *siteName = NULL;
|
||||
MPElementType siteType = MPElementTypeGeneratedLong;
|
||||
const char *siteTypeString = getenv( MP_env_sitetype );
|
||||
MPElementVariant siteVariant = MPElementVariantPassword;
|
||||
const char *siteVariantString = NULL;
|
||||
const char *siteContextString = NULL;
|
||||
uint32_t siteCounter = 1;
|
||||
const char *siteCounterString = getenv( MP_env_sitecounter );
|
||||
|
||||
// Read the options.
|
||||
char opt;
|
||||
while ((opt = getopt(argc, argv, "u:t:c:v:h")) != -1)
|
||||
for (int opt; (opt = getopt(argc, argv, "u:t:c:v:C:h")) != -1;)
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage();
|
||||
break;
|
||||
case 'u':
|
||||
userName = optarg;
|
||||
break;
|
||||
case 't':
|
||||
siteTypeString = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
siteCounterString = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
siteVariantString = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
siteCounterString = optarg;
|
||||
case 'C':
|
||||
siteContextString = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
break;
|
||||
case '?':
|
||||
switch (optopt) {
|
||||
@@ -138,14 +167,18 @@ int main(int argc, char *const argv[]) {
|
||||
|
||||
// Convert and validate input.
|
||||
if (!userName) {
|
||||
if (!(userName = getlinep("Your user name:"))) {
|
||||
fprintf(stderr, "Missing user name.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
trc("userName: %s\n", userName);
|
||||
if (!siteName) {
|
||||
if (!(siteName = getlinep("Site name:"))) {
|
||||
fprintf(stderr, "Missing site name.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
trc("siteName: %s\n", siteName);
|
||||
if (siteCounterString)
|
||||
siteCounter = atoi( siteCounterString );
|
||||
@@ -159,6 +192,8 @@ int main(int argc, char *const argv[]) {
|
||||
trc("siteVariant: %d (%s)\n", siteVariant, siteVariantString);
|
||||
if (siteVariant == MPElementVariantLogin)
|
||||
siteType = MPElementTypeGeneratedName;
|
||||
if (siteVariant == MPElementVariantAnswer)
|
||||
siteType = MPElementTypeGeneratedPhrase;
|
||||
if (siteTypeString)
|
||||
siteType = TypeWithName( siteTypeString );
|
||||
trc("siteType: %d (%s)\n", siteType, siteTypeString);
|
||||
@@ -171,11 +206,8 @@ int main(int argc, char *const argv[]) {
|
||||
}
|
||||
trc("mpwConfigPath: %s\n", mpwConfigPath);
|
||||
FILE *mpwConfig = fopen(mpwConfigPath, "r");
|
||||
if (!mpwConfig) {
|
||||
fprintf(stderr, "Couldn't open configuration file: %s: %d\n", mpwConfigPath, errno);
|
||||
return 1;
|
||||
}
|
||||
free(mpwConfigPath);
|
||||
if (mpwConfig) {
|
||||
char *line = NULL;
|
||||
size_t linecap = 0;
|
||||
ssize_t linelen;
|
||||
@@ -184,18 +216,20 @@ int main(int argc, char *const argv[]) {
|
||||
masterPassword = strsep(&line, "\n");
|
||||
break;
|
||||
}
|
||||
if (!masterPassword) {
|
||||
fprintf(stderr, "Missing master password for user: %s\n", userName);
|
||||
return 1;
|
||||
}
|
||||
while (!masterPassword)
|
||||
masterPassword = getpass( "Your master password: " );
|
||||
trc("masterPassword: %s\n", masterPassword);
|
||||
|
||||
// Summarize operation.
|
||||
fprintf(stderr, "%s's password for %s:\n[ %s ]: ", userName, siteName, Identicon( userName, masterPassword ));
|
||||
|
||||
// Calculate the master key salt.
|
||||
const char *mpKeyScope = ScopeForVariant(MPElementVariantPassword);
|
||||
trc("key scope: %s\n", mpKeyScope);
|
||||
const uint32_t n_userNameLength = htonl(strlen(userName));
|
||||
size_t masterKeySaltLength = strlen(mpKeyScope) + sizeof(n_userNameLength) + strlen(userName);
|
||||
char *masterKeySalt = malloc( masterKeySaltLength );
|
||||
const size_t masterKeySaltLength = strlen(mpKeyScope) + sizeof(n_userNameLength) + strlen(userName);
|
||||
char *masterKeySalt = (char *)malloc( masterKeySaltLength );
|
||||
if (!masterKeySalt) {
|
||||
fprintf(stderr, "Could not allocate master key salt: %d\n", errno);
|
||||
return 1;
|
||||
@@ -210,7 +244,7 @@ int main(int argc, char *const argv[]) {
|
||||
trc("masterKeySalt ID: %s\n", IDForBuf(masterKeySalt, masterKeySaltLength));
|
||||
|
||||
// Calculate the master key.
|
||||
uint8_t *masterKey = malloc( MP_dkLen );
|
||||
uint8_t *masterKey = (uint8_t *)malloc( MP_dkLen );
|
||||
if (!masterKey) {
|
||||
fprintf(stderr, "Could not allocate master key: %d\n", errno);
|
||||
return 1;
|
||||
@@ -227,11 +261,14 @@ int main(int argc, char *const argv[]) {
|
||||
|
||||
// Calculate the site seed.
|
||||
const char *mpSiteScope = ScopeForVariant(siteVariant);
|
||||
trc("site scope: %s\n", mpSiteScope);
|
||||
trc("site scope: %s, context: %s\n", mpSiteScope, siteContextString == NULL? "<empty>": siteContextString);
|
||||
const uint32_t n_siteNameLength = htonl(strlen(siteName));
|
||||
const uint32_t n_siteCounter = htonl(siteCounter);
|
||||
const uint32_t n_siteContextLength = siteContextString == NULL? 0: htonl(strlen(siteContextString));
|
||||
size_t sitePasswordInfoLength = strlen(mpSiteScope) + sizeof(n_siteNameLength) + strlen(siteName) + sizeof(n_siteCounter);
|
||||
char *sitePasswordInfo = malloc( sitePasswordInfoLength );
|
||||
if (siteContextString)
|
||||
sitePasswordInfoLength += sizeof(n_siteContextLength) + strlen(siteContextString);
|
||||
char *sitePasswordInfo = (char *)malloc( sitePasswordInfoLength );
|
||||
if (!sitePasswordInfo) {
|
||||
fprintf(stderr, "Could not allocate site seed: %d\n", errno);
|
||||
return 1;
|
||||
@@ -242,9 +279,13 @@ int main(int argc, char *const argv[]) {
|
||||
memcpy(sPI, &n_siteNameLength, sizeof(n_siteNameLength)); sPI += sizeof(n_siteNameLength);
|
||||
memcpy(sPI, siteName, strlen(siteName)); sPI += strlen(siteName);
|
||||
memcpy(sPI, &n_siteCounter, sizeof(n_siteCounter)); sPI += sizeof(n_siteCounter);
|
||||
if (siteContextString) {
|
||||
memcpy(sPI, &n_siteContextLength, sizeof(n_siteContextLength)); sPI += sizeof(n_siteContextLength);
|
||||
memcpy(sPI, siteContextString, strlen(siteContextString)); sPI += strlen(siteContextString);
|
||||
}
|
||||
if (sPI - sitePasswordInfo != sitePasswordInfoLength)
|
||||
abort();
|
||||
trc("seed from: hmac-sha256(masterKey, %s | %s | %s | %s)\n", mpSiteScope, Hex(&n_siteNameLength, sizeof(n_siteNameLength)), siteName, Hex(&n_siteCounter, sizeof(n_siteCounter)));
|
||||
trc("seed from: hmac-sha256(masterKey, %s | %s | %s | %s | %s | %s)\n", mpSiteScope, Hex(&n_siteNameLength, sizeof(n_siteNameLength)), siteName, Hex(&n_siteCounter, sizeof(n_siteCounter)), Hex(&n_siteContextLength, sizeof(n_siteContextLength)), siteContextString);
|
||||
trc("sitePasswordInfo ID: %s\n", IDForBuf(sitePasswordInfo, sitePasswordInfoLength));
|
||||
|
||||
uint8_t sitePasswordSeed[32];
|
||||
@@ -262,7 +303,7 @@ int main(int argc, char *const argv[]) {
|
||||
abort();
|
||||
|
||||
// Encode the password from the seed using the cipher.
|
||||
char *sitePassword = calloc(strlen(cipher) + 1, sizeof(char));
|
||||
char *sitePassword = (char *)calloc(strlen(cipher) + 1, sizeof(char));
|
||||
for (int c = 0; c < strlen(cipher); ++c) {
|
||||
sitePassword[c] = CharacterFromClass(cipher[c], sitePasswordSeed[c + 1]);
|
||||
trc("class %c, character: %c\n", cipher[c], sitePassword[c]);
|
||||
|
||||
@@ -10,9 +10,13 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <alg/sha256.h>
|
||||
|
||||
#include <curses.h>
|
||||
#include <term.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
const MPElementType TypeWithName(const char *typeName) {
|
||||
@@ -31,10 +35,12 @@ const MPElementType TypeWithName(const char *typeName) {
|
||||
return MPElementTypeGeneratedBasic;
|
||||
if (0 == strcmp(lowerTypeName, "s") || 0 == strcmp(lowerTypeName, "short"))
|
||||
return MPElementTypeGeneratedShort;
|
||||
if (0 == strcmp(lowerTypeName, "p") || 0 == strcmp(lowerTypeName, "pin"))
|
||||
if (0 == strcmp(lowerTypeName, "i") || 0 == strcmp(lowerTypeName, "pin"))
|
||||
return MPElementTypeGeneratedPIN;
|
||||
if (0 == strcmp(lowerTypeName, "n") || 0 == strcmp(lowerTypeName, "name"))
|
||||
return MPElementTypeGeneratedName;
|
||||
if (0 == strcmp(lowerTypeName, "p") || 0 == strcmp(lowerTypeName, "phrase"))
|
||||
return MPElementTypeGeneratedPhrase;
|
||||
|
||||
fprintf(stderr, "Not a generated type name: %s", lowerTypeName);
|
||||
abort();
|
||||
@@ -48,19 +54,19 @@ const char *CipherForType(MPElementType type, uint8_t seedByte) {
|
||||
|
||||
switch (type) {
|
||||
case MPElementTypeGeneratedMaximum: {
|
||||
char *ciphers[] = { "anoxxxxxxxxxxxxxxxxx", "axxxxxxxxxxxxxxxxxno" };
|
||||
const char *ciphers[] = { "anoxxxxxxxxxxxxxxxxx", "axxxxxxxxxxxxxxxxxno" };
|
||||
return ciphers[seedByte % 2];
|
||||
}
|
||||
case MPElementTypeGeneratedLong: {
|
||||
char *ciphers[] = { "CvcvnoCvcvCvcv", "CvcvCvcvnoCvcv", "CvcvCvcvCvcvno", "CvccnoCvcvCvcv", "CvccCvcvnoCvcv", "CvccCvcvCvcvno", "CvcvnoCvccCvcv", "CvcvCvccnoCvcv", "CvcvCvccCvcvno", "CvcvnoCvcvCvcc", "CvcvCvcvnoCvcc", "CvcvCvcvCvccno", "CvccnoCvccCvcv", "CvccCvccnoCvcv", "CvccCvccCvcvno", "CvcvnoCvccCvcc", "CvcvCvccnoCvcc", "CvcvCvccCvccno", "CvccnoCvcvCvcc", "CvccCvcvnoCvcc", "CvccCvcvCvccno" };
|
||||
const char *ciphers[] = { "CvcvnoCvcvCvcv", "CvcvCvcvnoCvcv", "CvcvCvcvCvcvno", "CvccnoCvcvCvcv", "CvccCvcvnoCvcv", "CvccCvcvCvcvno", "CvcvnoCvccCvcv", "CvcvCvccnoCvcv", "CvcvCvccCvcvno", "CvcvnoCvcvCvcc", "CvcvCvcvnoCvcc", "CvcvCvcvCvccno", "CvccnoCvccCvcv", "CvccCvccnoCvcv", "CvccCvccCvcvno", "CvcvnoCvccCvcc", "CvcvCvccnoCvcc", "CvcvCvccCvccno", "CvccnoCvcvCvcc", "CvccCvcvnoCvcc", "CvccCvcvCvccno" };
|
||||
return ciphers[seedByte % 21];
|
||||
}
|
||||
case MPElementTypeGeneratedMedium: {
|
||||
char *ciphers[] = { "CvcnoCvc", "CvcCvcno" };
|
||||
const char *ciphers[] = { "CvcnoCvc", "CvcCvcno" };
|
||||
return ciphers[seedByte % 2];
|
||||
}
|
||||
case MPElementTypeGeneratedBasic: {
|
||||
char *ciphers[] = { "aaanaaan", "aannaaan", "aaannaaa" };
|
||||
const char *ciphers[] = { "aaanaaan", "aannaaan", "aaannaaa" };
|
||||
return ciphers[seedByte % 3];
|
||||
}
|
||||
case MPElementTypeGeneratedShort: {
|
||||
@@ -72,6 +78,10 @@ const char *CipherForType(MPElementType type, uint8_t seedByte) {
|
||||
case MPElementTypeGeneratedName: {
|
||||
return "cvccvcvcv";
|
||||
}
|
||||
case MPElementTypeGeneratedPhrase: {
|
||||
const char *ciphers[] = { "cvcc cvc cvccvcv cvc", "cvc cvccvcvcv cvcv", "cv cvccv cvc cvcvccv" };
|
||||
return ciphers[seedByte % 3];
|
||||
}
|
||||
default: {
|
||||
fprintf(stderr, "Unknown generated type: %d", type);
|
||||
abort();
|
||||
@@ -89,6 +99,8 @@ const MPElementVariant VariantWithName(const char *variantName) {
|
||||
return MPElementVariantPassword;
|
||||
if (0 == strcmp(lowerVariantName, "l") || 0 == strcmp(lowerVariantName, "login"))
|
||||
return MPElementVariantLogin;
|
||||
if (0 == strcmp(lowerVariantName, "a") || 0 == strcmp(lowerVariantName, "answer"))
|
||||
return MPElementVariantAnswer;
|
||||
|
||||
fprintf(stderr, "Not a variant name: %s", lowerVariantName);
|
||||
abort();
|
||||
@@ -102,6 +114,9 @@ const char *ScopeForVariant(MPElementVariant variant) {
|
||||
case MPElementVariantLogin: {
|
||||
return "com.lyndir.masterpassword.login";
|
||||
}
|
||||
case MPElementVariantAnswer: {
|
||||
return "com.lyndir.masterpassword.answer";
|
||||
}
|
||||
default: {
|
||||
fprintf(stderr, "Unknown variant: %d", variant);
|
||||
abort();
|
||||
@@ -148,6 +163,10 @@ const char CharacterFromClass(char characterClass, uint8_t seedByte) {
|
||||
classCharacters = "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz0123456789!@#$%^&*()";
|
||||
break;
|
||||
}
|
||||
case ' ': {
|
||||
classCharacters = " ";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
fprintf(stderr, "Unknown character class: %c", characterClass);
|
||||
abort();
|
||||
@@ -156,11 +175,12 @@ const char CharacterFromClass(char characterClass, uint8_t seedByte) {
|
||||
|
||||
return classCharacters[seedByte % strlen(classCharacters)];
|
||||
}
|
||||
|
||||
const char *IDForBuf(const void *buf, size_t length) {
|
||||
uint8_t hash[32];
|
||||
SHA256_Buf(buf, length, hash);
|
||||
|
||||
char *id = calloc(65, sizeof(char));
|
||||
char *id = (char *)calloc(65, sizeof(char));
|
||||
for (int kH = 0; kH < 32; kH++)
|
||||
sprintf(&(id[kH * 2]), "%02X", hash[kH]);
|
||||
|
||||
@@ -168,8 +188,51 @@ const char *IDForBuf(const void *buf, size_t length) {
|
||||
}
|
||||
|
||||
const char *Hex(const void *buf, size_t length) {
|
||||
char *id = calloc(length*2+1, sizeof(char));
|
||||
char *id = (char *)calloc(length*2+1, sizeof(char));
|
||||
for (int kH = 0; kH < length; kH++)
|
||||
sprintf(&(id[kH * 2]), "%02X", ((const uint8_t*)buf)[kH]);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
int putvari;
|
||||
char *putvarc = NULL;
|
||||
static void initputvar() {
|
||||
if (putvarc)
|
||||
free(putvarc);
|
||||
putvari=0;
|
||||
putvarc=(char *)calloc(256, sizeof(char));
|
||||
}
|
||||
static int putvar(int c) {
|
||||
putvarc[putvari++]=c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *Identicon(const char *userName, const char *masterPassword) {
|
||||
const char *left[] = { "╔", "╚", "╰", "═" };
|
||||
const char *right[] = { "╗", "╝", "╯", "═" };
|
||||
const char *body[] = { "█", "░", "▒", "▓", "☺", "☻" };
|
||||
const char *accessory[] = { "◈", "◎", "◐", "◑", "◒", "◓", "☀", "☁", "☂", "☃", "☄", "★", "☆", "☎", "☏", "⎈", "⌂", "☘", "☢", "☣", "☕", "⌚", "⌛", "⏰", "⚡", "⛄", "⛅", "☔", "♔", "♕", "♖", "♗", "♘", "♙", "♚", "♛", "♜", "♝", "♞", "♟", "♨", "♩", "♪", "♫", "⚐", "⚑", "⚔", "⚖", "⚙", "⚠", "⌘", "⏎", "✄", "✆", "✈", "✉", "✌" };
|
||||
|
||||
uint8_t identiconSeed[32];
|
||||
HMAC_SHA256_Buf(masterPassword, strlen(masterPassword), userName, strlen(userName), identiconSeed);
|
||||
|
||||
char *identicon = (char *)calloc(20, sizeof(char));
|
||||
setupterm(NULL, 2, NULL);
|
||||
initputvar();
|
||||
tputs(tparm(tgetstr("AF", NULL), identiconSeed[4] % 7 + 1), 1, putvar);
|
||||
char red[strlen(putvarc)];
|
||||
strcpy(red, putvarc);
|
||||
tputs(tgetstr("me", NULL), 1, putvar);
|
||||
char reset[strlen(putvarc)];
|
||||
strcpy(reset, putvarc);
|
||||
sprintf(identicon, "%s%s%s%s%s%s",
|
||||
red,
|
||||
left[identiconSeed[0] % (sizeof(left) / sizeof(left[0]))],
|
||||
body[identiconSeed[1] % (sizeof(body) / sizeof(body[0]))],
|
||||
right[identiconSeed[2] % (sizeof(right) / sizeof(right[0]))],
|
||||
accessory[identiconSeed[3] % (sizeof(accessory) / sizeof(accessory[0]))],
|
||||
reset);
|
||||
|
||||
return identicon;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ typedef enum {
|
||||
MPElementVariantPassword,
|
||||
/** Generate the login name to log in as. */
|
||||
MPElementVariantLogin,
|
||||
/** Generate the answer to a security question. */
|
||||
MPElementVariantAnswer,
|
||||
} MPElementVariant;
|
||||
|
||||
typedef enum {
|
||||
@@ -34,7 +36,8 @@ typedef enum {
|
||||
MPElementTypeGeneratedBasic = 0x4 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedShort = 0x3 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedPIN = 0x5 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedName = 0xF | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedName = 0xE | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedPhrase = 0xF | MPElementTypeClassGenerated | 0x0,
|
||||
|
||||
MPElementTypeStoredPersonal = 0x0 | MPElementTypeClassStored | MPElementFeatureExportContent,
|
||||
MPElementTypeStoredDevicePrivate = 0x1 | MPElementTypeClassStored | MPElementFeatureDevicePrivate,
|
||||
@@ -53,4 +56,5 @@ const char *CipherForType(MPElementType type, uint8_t seedByte);
|
||||
const char CharacterFromClass(char characterClass, uint8_t seedByte);
|
||||
const char *IDForBuf(const void *buf, size_t length);
|
||||
const char *Hex(const void *buf, size_t length);
|
||||
const char *Identicon(const char *userName, const char *masterPassword);
|
||||
|
||||
|
||||
327
MasterPassword/CSharp/MPSetup/License agreement.rtf
Normal file
327
MasterPassword/CSharp/MPSetup/License agreement.rtf
Normal file
@@ -0,0 +1,327 @@
|
||||
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff39\deff0\stshfdbch0\stshfloch40\stshfhich40\stshfbi40\deflang5129\deflangfe5129\themelang5129\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
|
||||
{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Helvetica;}{\f10\fbidi \fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}
|
||||
{\f10\fbidi \fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}
|
||||
{\f40\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times;}{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Nimbus Mono L{\*\falt MS Gothic};}
|
||||
{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f384\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\f385\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f387\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f388\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f389\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\f390\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f391\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f392\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f404\fbidi \fmodern\fcharset238\fprq1 Courier New CE;}
|
||||
{\f405\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;}{\f407\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f408\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f409\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);}
|
||||
{\f410\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f411\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f412\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f424\fbidi \fswiss\fcharset238\fprq2 Helvetica CE;}
|
||||
{\f425\fbidi \fswiss\fcharset204\fprq2 Helvetica Cyr;}{\f427\fbidi \fswiss\fcharset161\fprq2 Helvetica Greek;}{\f428\fbidi \fswiss\fcharset162\fprq2 Helvetica Tur;}{\f429\fbidi \fswiss\fcharset177\fprq2 Helvetica (Hebrew);}
|
||||
{\f430\fbidi \fswiss\fcharset178\fprq2 Helvetica (Arabic);}{\f431\fbidi \fswiss\fcharset186\fprq2 Helvetica Baltic;}{\f432\fbidi \fswiss\fcharset163\fprq2 Helvetica (Vietnamese);}{\f754\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}
|
||||
{\f755\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f757\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f758\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f761\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}
|
||||
{\f762\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\f774\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f775\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f777\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}
|
||||
{\f778\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}{\f779\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f780\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f781\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}
|
||||
{\f782\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f783\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f784\fbidi \froman\fcharset238\fprq2 Times CE;}{\f785\fbidi \froman\fcharset204\fprq2 Times Cyr;}
|
||||
{\f787\fbidi \froman\fcharset161\fprq2 Times Greek;}{\f788\fbidi \froman\fcharset162\fprq2 Times Tur;}{\f789\fbidi \froman\fcharset177\fprq2 Times (Hebrew);}{\f790\fbidi \froman\fcharset178\fprq2 Times (Arabic);}
|
||||
{\f791\fbidi \froman\fcharset186\fprq2 Times Baltic;}{\f792\fbidi \froman\fcharset163\fprq2 Times (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}
|
||||
{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;}{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;}{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}
|
||||
{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}
|
||||
{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}
|
||||
{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;
|
||||
\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp
|
||||
\f40\fs24\lang9226\langfe5129\kerning3\langnp9226 }{\*\defpap \ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\aspnum\faroman\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{
|
||||
\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \snext0 \sqformat \spriority0 Normal;}{\*\cs10
|
||||
\additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
|
||||
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
|
||||
\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\aspnum\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af40\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \snext11 \ssemihidden \sunhideused
|
||||
Normal Table;}{\s15\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \snext15 \spriority0
|
||||
Standard;}{\s16\ql \li0\ri0\sb240\sa120\keepn\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs28\alang1025 \ltrch\fcs0 \f4\fs28\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129
|
||||
\sbasedon15 \snext17 \spriority0 Heading;}{\s17\ql \li0\ri0\sa120\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0
|
||||
\f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \sbasedon15 \snext17 \spriority0 Text body;}{\s18\ql \li0\ri0\sa120\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025
|
||||
\ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \sbasedon17 \snext18 List;}{\s19\ql \li0\ri0\sb120\sa120\nowidctlpar\noline\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1
|
||||
\ai\af39\afs24\alang1025 \ltrch\fcs0 \i\f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \sbasedon15 \snext19 \spriority35 caption;}{\s20\ql \li0\ri0\nowidctlpar\noline\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0
|
||||
\rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \sbasedon15 \snext20 \spriority0 Index;}{\s21\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0
|
||||
\rtlch\fcs1 \af41\afs20\alang1025 \ltrch\fcs0 \f41\fs20\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 \sbasedon15 \snext21 \spriority0 Preformatted Text;}{\s22\ql \li0\ri0\widctlpar
|
||||
\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af2\afs20\alang1025 \ltrch\fcs0
|
||||
\f2\fs20\lang5129\langfe5129\cgrid\langnp5129\langfenp5129 \sbasedon0 \snext22 \slink23 \ssemihidden \sunhideused \styrsid8540216 HTML Preformatted;}{\*\cs23 \additive \rtlch\fcs1 \af2\afs20 \ltrch\fcs0
|
||||
\f2\fs20\lang5129\langfe0\kerning0\langnp5129\langfenp0 \sbasedon10 \slink22 \slocked \ssemihidden \styrsid8540216 HTML Preformatted Char;}}{\*\listtable{\list\listtemplateid319469612\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0
|
||||
\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid336134145\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative
|
||||
\levelspace360\levelindent0{\leveltext\leveltemplateid336134147\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134149\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134145
|
||||
\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134147\'01o;}{\levelnumbers;}
|
||||
\f2\fbias0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134149\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0
|
||||
\fi-360\li4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134145\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5040\lin5040 }
|
||||
{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134147\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23
|
||||
\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134149\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li6480\lin6480 }{\listname ;}\listid2168516}{\list\listtemplateid-2025932976
|
||||
\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid336134167\'02\'00);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\lin720 }{\listlevel\levelnfc4
|
||||
\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134169\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2
|
||||
\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134171\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0
|
||||
\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134159\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0
|
||||
\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134169\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0
|
||||
\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134171\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1
|
||||
\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134159\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative
|
||||
\levelspace360\levelindent0{\leveltext\leveltemplateid336134169\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360
|
||||
\levelindent0{\leveltext\leveltemplateid336134171\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid1148745780}{\list\listtemplateid1718929376\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc0
|
||||
\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid336134159\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0
|
||||
\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134169\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1
|
||||
\lvltentative\levelspace360\levelindent0{\leveltext\leveltemplateid336134171\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative
|
||||
\levelspace360\levelindent0{\leveltext\leveltemplateid336134159\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360
|
||||
\levelindent0{\leveltext\leveltemplateid336134169\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0
|
||||
{\leveltext\leveltemplateid336134171\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134159\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134169\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134171\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid1243491588}{\list\listtemplateid14058324\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0
|
||||
\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid336134167\'02\'00);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative
|
||||
\levelspace360\levelindent0{\leveltext\leveltemplateid336134169\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360
|
||||
\levelindent0{\leveltext\leveltemplateid336134171\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0
|
||||
{\leveltext\leveltemplateid336134159\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134169\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134171\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134159\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134169\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134171\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid1353334123}{\list\listtemplateid-2129903306\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0
|
||||
\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid336134167\'02\'00);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative
|
||||
\levelspace360\levelindent0{\leveltext\leveltemplateid336134169\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360
|
||||
\levelindent0{\leveltext\leveltemplateid336134171\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0
|
||||
{\leveltext\leveltemplateid336134159\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134169\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134171\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134159\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134169\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace360\levelindent0{\leveltext
|
||||
\leveltemplateid336134171\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid2001083591}}{\*\listoverridetable{\listoverride\listid2168516\listoverridecount0\ls1}{\listoverride\listid1243491588
|
||||
\listoverridecount0\ls2}{\listoverride\listid1353334123\listoverridecount0\ls3}{\listoverride\listid1148745780\listoverridecount0\ls4}{\listoverride\listid2001083591\listoverridecount0\ls5}}{\*\pgptbl {\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0
|
||||
\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0
|
||||
\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}
|
||||
{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp
|
||||
\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43
|
||||
\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0
|
||||
\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0
|
||||
\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp43\itap0\li0\ri0\sb0\sa0}{\pgp
|
||||
\ipgp43\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid2903393\rsid5508620\rsid8540216\rsid8942186\rsid10953693\rsid12090885\rsid13708602\rsid14233442\rsid16134980}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1
|
||||
\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Michel}{\operator Michel Verhagen}{\creatim\yr2014\mo6\dy17\hr15\min55}{\revtim\yr2014\mo6\dy17\hr16\min37}{\version6}{\edmins8}{\nofpages2}{\nofwords474}{\nofchars2706}{\*\company GuruCE}
|
||||
{\nofcharsws3174}{\vern57433}}{\*\userprops {\propname Info 1}\proptype30{\staticval }{\propname Info 2}\proptype30{\staticval }{\propname Info 3}\proptype30{\staticval }{\propname Info 4}\proptype30{\staticval }}{\*\xmlnstbl {\xmlns1 http://schemas.micro
|
||||
soft.com/office/word/2003/wordml}}\paperw11906\paperh16838\margl1134\margr1134\margt1134\margb1134\gutter0\ltrsect
|
||||
\deftab709\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1
|
||||
\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphauto1\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1134\dgvorigin1134\dghshow1\dgvshow1
|
||||
\jexpand\viewkind1\viewscale140\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
|
||||
\asianbrkrule\rsidroot2903393\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
|
||||
{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0
|
||||
\f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 {\rtlch\fcs1 \af39 \ltrch\fcs0 \cf1\insrsid5508620 \chftnsep }{\rtlch\fcs1 \af39 \ltrch\fcs0 \insrsid5508620
|
||||
\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 {
|
||||
\rtlch\fcs1 \af39 \ltrch\fcs0 \insrsid5508620 \chftnsepc
|
||||
\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 {
|
||||
\rtlch\fcs1 \af39 \ltrch\fcs0 \insrsid5508620 \chftnsep
|
||||
\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af39\afs24\alang1025 \ltrch\fcs0 \f40\fs24\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 {
|
||||
\rtlch\fcs1 \af39 \ltrch\fcs0 \insrsid5508620 \chftnsepc
|
||||
\par }}\ltrpar \sectd \ltrsect\linex0\endnhere\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}
|
||||
{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang
|
||||
{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar
|
||||
\s21\qc \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af41\afs20\alang1025 \ltrch\fcs0 \f41\fs20\lang9226\langfe5129\kerning3\cgrid\langnp9226\langfenp5129 {\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0
|
||||
\b\f31506\fs34\insrsid8540216\charrsid8942186 MASTERPASSWORD FOR WINDOWS
|
||||
\par }{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs28\insrsid8540216\charrsid8942186 Created by Michel Verhagen
|
||||
\par Copyright (C)2014 GuruCE Limited}{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs34\insrsid8540216\charrsid8942186
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186 Released under the}{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \f31506\fs28\insrsid8540216\charrsid8942186
|
||||
\par }{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs24\insrsid14233442\charrsid8942186 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007}{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs24\insrsid2903393\charrsid8942186
|
||||
\par }{\rtlch\fcs1 \ab\af41\afs36 \ltrch\fcs0 \b\f31506\fs28\insrsid8942186\charrsid8942186
|
||||
\par }{\rtlch\fcs1 \af41 \ltrch\fcs0 \f31506\fs16\insrsid2903393\charrsid8942186
|
||||
\par }\pard \ltrpar\s21\qc \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186 Contains software provided by Maarten Billemont
|
||||
and used under the GPL v3 License.
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs28\insrsid8540216\charrsid8942186 Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186 Contains software provided by Replicon Inc. and used under this license:}{\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs28\insrsid8540216\charrsid8942186
|
||||
\par
|
||||
\par Replicon.Cryptography.SCrypt
|
||||
\par Copyright (c) 2012, Replicon Inc.
|
||||
\par All rights reserved.
|
||||
\par }\pard \ltrpar\s21\qj \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
\par Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
\par
|
||||
\par {\listtext\pard\plain\ltrpar \s21 \rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f3\fs22\lang9226\langfe5129\kerning3\langnp9226\insrsid8540216\charrsid8942186 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ltrpar
|
||||
\s21\qj \fi-360\li720\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\ls1\adjustright\rin0\lin720\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
\par {\listtext\pard\plain\ltrpar \s21 \rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f3\fs22\lang9226\langfe5129\kerning3\langnp9226\insrsid8540216\charrsid8942186 \loch\af3\dbch\af0\hich\f3 \'b7\tab}Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
\par {\listtext\pard\plain\ltrpar \s21 \rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f3\fs22\lang9226\langfe5129\kerning3\langnp9226\insrsid8540216\charrsid8942186 \loch\af3\dbch\af0\hich\f3 \'b7\tab}Neither the name of Replicon Inc. nor the names of
|
||||
its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
\par }\pard \ltrpar\s21\qj \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
\par THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL REPLICON INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
\par
|
||||
\par
|
||||
\par }\pard \ltrpar\s21\qc \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8942186 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
Contains software provided by Colin Percival and used under this license:
|
||||
\par }\pard \ltrpar\s21\qj \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
\par }\pard \ltrpar\s21\qc \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \ab\af41\afs52 \ltrch\fcs0 \b\f31506\fs28\insrsid8540216\charrsid8942186 Copyright 2009 Colin Percival
|
||||
\par All rights reserved.
|
||||
\par }\pard \ltrpar\s21\qj \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
\par Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
\par
|
||||
\par {\listtext\pard\plain\ltrpar \s21 \rtlch\fcs1 \af0\afs28 \ltrch\fcs0 \f31506\fs22\lang9226\langfe5129\kerning3\langnp9226\insrsid8540216\charrsid8942186 \hich\af31506\dbch\af0\loch\f31506 1.\tab}}\pard \ltrpar
|
||||
\s21\qj \fi-360\li720\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\ls2\adjustright\rin0\lin720\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
\par {\listtext\pard\plain\ltrpar \s21 \rtlch\fcs1 \af0\afs28 \ltrch\fcs0 \f31506\fs22\lang9226\langfe5129\kerning3\langnp9226\insrsid8540216\charrsid8942186 \hich\af31506\dbch\af0\loch\f31506 2.\tab}Redistributi
|
||||
ons in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
\par }\pard \ltrpar\s21\qj \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0\pararsid8540216 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
\par THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}{\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8942186 }{\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186 SUCH DAMAGE.
|
||||
\par }\pard \ltrpar\s21\qj \li0\ri0\nowidctlpar\wrapdefault\hyphpar0\aspalpha\faroman\adjustright\rin0\lin0\itap0 {\rtlch\fcs1 \af41\afs28 \ltrch\fcs0 \f31506\fs22\insrsid8540216\charrsid8942186
|
||||
\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
|
||||
9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
|
||||
5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
|
||||
b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
|
||||
0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
|
||||
a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
|
||||
c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
|
||||
0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
|
||||
a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
|
||||
6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
|
||||
4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
|
||||
4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100aa5225dfc60600008b1a0000160000007468656d652f7468656d652f
|
||||
7468656d65312e786d6cec595d8bdb46147d2ff43f08bd3bfe92fcb1c41b6cd9ceb6d94d42eca4e4716c8fadc98e344633de8d0981923c160aa569e943037deb
|
||||
43691b48a02fe9afd936a54d217fa17746b63c638fbb9b2585a5640d8b343af7ce997bafce1d4997afdc8fa87384134e58dc708b970aae83e3211b9178d2706f
|
||||
f7bbb99aeb7081e211a22cc60d778eb97b65f7c30f2ea31d11e2083b601ff31dd4704321a63bf93c1fc230e297d814c7706dcc920809384d26f951828ec16f44
|
||||
f3a542a1928f10895d274611b8bd311e932176fad2a5bbbb74dea1701a0b2e078634e949d7d8b050d8d1615122f89c0734718e106db830cf881df7f17de13a14
|
||||
7101171a6e41fdb9f9ddcb79b4b330a2628bad66d7557f0bbb85c1e8b0a4e64c26836c52cff3bd4a33f3af00546ce23ad54ea553c9fc29001a0e61a52917dda7
|
||||
dfaab7dafe02ab81d2438bef76b55d2e1a78cd7f798373d3973f03af40a97f6f03dfed06104503af4029dedfc07b5eb51478065e81527c65035f2d34db5ed5c0
|
||||
2b5048497cb8812ef89572b05c6d061933ba6785d77daf5b2d2d9caf50500d5975c929c62c16db6a2d42f758d2058004522448ec88f9148fd110aa3840940c12
|
||||
e2ec93490885374531e3305c2815ba8532fc973f4f1da988a01d8c346bc90b98f08d21c9c7e1c3844c45c3fd18bcba1ae4cdcb1fdfbc7cee9c3c7a71f2e89793
|
||||
c78f4f1efd9c3a32acf6503cd1ad5e7fffc5df4f3f75fe7afeddeb275fd9f15cc7fffed367bffdfaa51d082b5d85e0d5d7cffe78f1ecd5379ffff9c3130bbc99
|
||||
a0810eef930873e73a3e766eb10816a6426032c783e4ed2cfa2122ba45339e701423398bc57f478406fafa1c5164c1b5b019c13b09488c0d787576cf20dc0b93
|
||||
9920168fd7c2c8001e30465b2cb146e19a9c4b0b737f164fec9327331d770ba123dbdc018a8dfc766653d05662731984d8a07993a258a0098eb170e4357688b1
|
||||
6575770931e27a408609e36c2c9cbbc46921620d499f0c8c6a5a19ed9108f232b711847c1bb139b8e3b418b5adba8d8f4c24dc15885ac8f73135c27815cd048a
|
||||
6c2efb28a27ac0f791086d247bf364a8e33a5c40a6279832a733c29cdb6c6e24b05e2de9d7405eec693fa0f3c84426821cda7cee23c674649b1d06218aa6366c
|
||||
8fc4a18efd881f428922e7261336f80133ef10790e7940f1d674df21d848f7e96a701b9455a7b42a107965965872791533a37e7b733a4658490d08bfa1e71189
|
||||
4f15f73559f7ff5b5907217df5ed53cbaa2eaaa0371362bda3f6d6647c1b6e5dbc03968cc8c5d7ee369ac53731dc2e9b0decbd74bf976ef77f2fdddbeee7772f
|
||||
d82b8d06f9965bc574abae36eed1d67dfb9850da13738af7b9daba73e84ca32e0c4a3bf5cc8ab3e7b8690887f24e86090cdc2441cac64998f88488b017a229ec
|
||||
ef8bae7432e10bd713ee4c19876dbf1ab6fa96783a8b0ed8287d5c2d16e5a3692a1e1c89d578c1cfc6e15143a4e84a75f50896b9576c27ea51794940dabe0d09
|
||||
6d329344d942a2ba1c9441520fe610340b09b5b277c2a26e615193ee97a9da6001d4b2acc0d6c9810d57c3f53d30012378a242148f649ed2542fb3ab92f92e33
|
||||
bd2d984605c03e625901ab4cd725d7adcb93ab4b4bed0c99364868e566925091513d8c87688417d52947cf42e36d735d5fa5d4a02743a1e683d25ad1a8d6fe8d
|
||||
c579730d76ebda40635d2968ec1c37dc4ad9879219a269c31dc3633f1c4653a81d2eb7bc884ee0ddd95024e90d7f1e6599265cb4110fd3802bd149d520220227
|
||||
0e2551c395cbcfd24063a5218a5bb104827061c9d541562e1a3948ba99643c1ee3a1d0d3ae8dc848a7a7a0f0a95658af2af3f383a5259b41ba7be1e8d819d059
|
||||
720b4189f9d5a20ce0887078fb534ca33922f03a3313b255fdad35a685eceaef13550da5e3884e43b4e828ba98a77025e5191d7596c5403b5bac1902aa8564d1
|
||||
080713d960f5a01add34eb1a2987ad5df7742319394d34573dd35015d935ed2a66ccb06c036bb13c5f93d7582d430c9aa677f854bad725b7bed4bab57d42d625
|
||||
20e059fc2c5df70c0d41a3b69acca026196fcab0d4ecc5a8d93b960b3c85da599a84a6fa95a5dbb5b8653dc23a1d0c9eabf383dd7ad5c2d078b9af549156df3d
|
||||
f44f136c700fc4a30d2f81675470954af8f09020d810f5d49e24950db845ee8bc5ad0147ce2c210df741c16f7a41c90f72859adfc97965af90abf9cd72aee9fb
|
||||
e562c72f16daadd243682c228c8a7efacda50bafa2e87cf1e5458d6f7c7d89966fdb2e0d599467eaeb4a5e11575f5f8aa5ed5f5f1c02a2f3a052ead6cbf55625
|
||||
572f37bb39afddaae5ea41a5956b57826abbdb0efc5abdfbd0758e14d86b9603afd2a9e52ac520c8799582a45fabe7aa5ea9d4f4aacd5ac76b3e5c6c6360e5a9
|
||||
7c2c6201e155bc76ff010000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f
|
||||
7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be
|
||||
9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980
|
||||
ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5b
|
||||
babac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e
|
||||
745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f
|
||||
2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000190200007468656d652f7468656d652f74
|
||||
68656d654d616e616765722e786d6c504b01022d0014000600080000002100aa5225dfc60600008b1a00001600000000000000000000000000d6020000746865
|
||||
6d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b0100002700000000000000000000000000d00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000cb0a00000000}
|
||||
{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
|
||||
617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
|
||||
6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
|
||||
656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
|
||||
{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 1;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 5;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 9;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Indent;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 header;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footer;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index heading;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of figures;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope return;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation reference;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 line number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 page number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote text;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of authorities;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 macro;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 toa heading;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Closing;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Signature;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 4;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Message Header;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Note Heading;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Block Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 FollowedHyperlink;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
|
||||
\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Document Map;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Plain Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 E-mail Signature;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Top of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Bottom of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal (Web);\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Acronym;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Cite;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Code;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Definition;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Keyboard;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Preformatted;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Sample;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Typewriter;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Variable;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation subject;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 No List;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 1;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Balloon Text;\lsdpriority39 \lsdlocked0 Table Grid;
|
||||
\lsdsemihidden1 \lsdlocked0 Placeholder Text;\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;
|
||||
\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;
|
||||
\lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;
|
||||
\lsdsemihidden1 \lsdlocked0 Revision;\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdpriority62 \lsdlocked0 Light Grid Accent 5;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
|
||||
\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
|
||||
\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
|
||||
\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
|
||||
\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
|
||||
\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
|
||||
\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
|
||||
\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
|
||||
\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
|
||||
\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
|
||||
\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
|
||||
\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
|
||||
\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
|
||||
\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
|
||||
\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
|
||||
\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
|
||||
\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
|
||||
\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
|
||||
\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
|
||||
\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
|
||||
\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
|
||||
\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
|
||||
\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
|
||||
\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
|
||||
\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
|
||||
\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
|
||||
4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
|
||||
d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000070b6
|
||||
04e9e589cf01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000105000000000000}}
|
||||
51
MasterPassword/CSharp/MPSetup/MPSetup.wixproj
Normal file
51
MasterPassword/CSharp/MPSetup/MPSetup.wixproj
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>3.8</ProductVersion>
|
||||
<ProjectGuid>a8f9aa78-b004-40f5-af04-c9c2daef940a</ProjectGuid>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputName>MPSetup</OutputName>
|
||||
<OutputType>Package</OutputType>
|
||||
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
|
||||
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
<DefineConstants>Debug</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Product.wxs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WixExtension Include="WixUIExtension">
|
||||
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
|
||||
<Name>WixUIExtension</Name>
|
||||
</WixExtension>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MasterPassword\MasterPassword.csproj">
|
||||
<Name>MasterPassword</Name>
|
||||
<Project>{0b647b7d-3e3f-497d-926d-69c05b48c000}</Project>
|
||||
<Private>True</Private>
|
||||
<DoNotHarvest>True</DoNotHarvest>
|
||||
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
|
||||
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(WixTargetsPath)" />
|
||||
<!--
|
||||
To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Wix.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
97
MasterPassword/CSharp/MPSetup/Product.wxs
Normal file
97
MasterPassword/CSharp/MPSetup/Product.wxs
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
MASTERPASSWORD FOR WINDOWS
|
||||
==========================
|
||||
Created by Michel Verhagen
|
||||
Copyright (C)2014 GuruCE Limited
|
||||
|
||||
Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
|
||||
Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
|
||||
Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
|
||||
Contains software provided by Replicon Inc. and used under this license:
|
||||
|
||||
Replicon.Cryptography.SCrypt
|
||||
Copyright (c) 2012, Replicon Inc.
|
||||
All rights reserved.
|
||||
-->
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Product Id="*" Name="$(var.MasterPassword.ProjectName)" Language="1033" Version="!(bind.FileVersion.ProjectOutput)" Manufacturer="GuruCE" UpgradeCode="40c052f9-f8e1-422c-b78c-83f980f3355b">
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
|
||||
|
||||
<MajorUpgrade Schedule="afterInstallValidate" DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
|
||||
|
||||
<Media Id="1" Cabinet="mpsetup.cab" EmbedCab="yes"></Media>
|
||||
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="ProgramFilesFolder">
|
||||
<Directory Id="INSTALLLOCATION" Name="$(var.MasterPassword.ProjectName)">
|
||||
<Component Id='Application' Guid='8E7510B9-592B-43E5-AFD2-F697A9957AFB'>
|
||||
<File Id='ProjectOutput' Name='$(var.MasterPassword.TargetFileName)' DiskId='1' Source='$(var.MasterPassword.TargetPath)' KeyPath='yes'>
|
||||
<Shortcut Id='startmenuAppShortcut' Directory='ProgramMenuDir' Name='$(var.MasterPassword.ProjectName)'
|
||||
WorkingDirectory='INSTALLDIR' Icon='masterpassword.ico' IconIndex='0' Advertise='yes' />
|
||||
</File>
|
||||
<File Id='Config' Name='$(var.MasterPassword.TargetFileName).config' DiskId='1' Source='$(var.MasterPassword.TargetDir)\$(var.MasterPassword.TargetFileName).config' KeyPath='no'/>
|
||||
<File Id='Newtonsoft.Json' Name='Newtonsoft.Json.dll' DiskId='1' Source='$(var.MasterPassword.TargetDir)\Newtonsoft.Json.dll' KeyPath='no'/>
|
||||
<File Id='Replicon.Cryptography.SCrypt' Name='Replicon.Cryptography.SCrypt.dll' DiskId='1' Source='$(var.MasterPassword.TargetDir)\Replicon.Cryptography.SCrypt.dll' KeyPath='no'/>
|
||||
</Component>
|
||||
<Component Id='UninstallShortcut' Guid='D6499F04-1FC0-45CA-949B-074DC1F9AEEB'>
|
||||
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
|
||||
<Shortcut Id='startmenuUninstallShortcut' Name='Uninstall $(var.MasterPassword.ProjectName)' Icon='masterpassword.ico' IconIndex='0'
|
||||
Target='[System64Folder]msiexec.exe' Arguments='/x [ProductCode]' Directory='ProgramMenuDir' Description='Uninstall $(var.MasterPassword.ProjectName)' />
|
||||
</Component>
|
||||
<Component Id='DesktopShortcut' Guid='87EB347B-6141-485A-9F15-4A2FFC1689B2'>
|
||||
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
|
||||
<Shortcut Id='desktopShortcut' Name='$(var.MasterPassword.ProjectName)' Icon='masterpassword.ico' IconIndex='0' Directory='DesktopFolder'
|
||||
Target='[!ProjectOutput]' WorkingDirectory='INSTALLDIR' Description='Start $(var.MasterPassword.ProjectName)' />
|
||||
</Component>
|
||||
|
||||
<!-- This empty component is to work around a bug in Windows Installer that will still show
|
||||
"Install to run from the network" even if AllowAdvertise is set to 'no' -->
|
||||
<Component Id='Empty' Guid='C948CC83-B207-4E9B-B5C4-DA8D68296F1B'>
|
||||
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
|
||||
</Component>
|
||||
|
||||
</Directory>
|
||||
</Directory>
|
||||
<Directory Id='ProgramMenuFolder' Name='Programs'>
|
||||
<Directory Id='ProgramMenuDir' Name='$(var.MasterPassword.ProjectName)'>
|
||||
<Component Id='ProgramMenuDir'>
|
||||
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
|
||||
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
<Directory Id='DesktopFolder' Name='Desktop' />
|
||||
</Directory>
|
||||
|
||||
<Feature Id='Complete' Title='$(var.MasterPassword.ProjectName)' Description='Installation of all components' Display='expand' ConfigurableDirectory='INSTALLLOCATION' Level='1' AllowAdvertise='no' Absent='disallow'>
|
||||
<!-- This empty component is to work around a bug in Windows Installer that will still show
|
||||
"Install to run from the network" even if AllowAdvertise is set to 'no' -->
|
||||
<ComponentRef Id='Empty' />
|
||||
<Feature Id='MainProgram' Title='MasterPassword' Description='The $(var.MasterPassword.ProjectName)' Level='1' AllowAdvertise='no' Absent='disallow'>
|
||||
<ComponentRef Id='Application' />
|
||||
<ComponentRef Id='UninstallShortcut' />
|
||||
<ComponentRef Id='ProgramMenuDir' />
|
||||
</Feature>
|
||||
<Feature Id='DesktopShortcut' Title='Desktop Shortcut' Description='A shortcut to the $(var.MasterPassword.ProjectName) on the desktop' Level='1' AllowAdvertise='no'>
|
||||
<ComponentRef Id='DesktopShortcut' />
|
||||
</Feature>
|
||||
</Feature>
|
||||
|
||||
<Property Id='WIXUI_INSTALLDIR' Value='INSTALLDIR' />
|
||||
|
||||
<UIRef Id='WixUI_FeatureTree' />
|
||||
<UIRef Id='WixUI_ErrorProgressText' />
|
||||
|
||||
<WixVariable Id='WixUILicenseRtf' Value='License agreement.rtf' />
|
||||
<WixVariable Id='WixUIBannerBmp' Value='SetupBanner.bmp' />
|
||||
<WixVariable Id='WixUIDialogBmp' Value='SplashScreen.bmp' />
|
||||
|
||||
<Icon Id='masterpassword.ico' SourceFile='$(var.MasterPassword.ProjectDir)\masterpassword.ico' />
|
||||
|
||||
<Property Id="ARPPRODUCTICON" Value="masterpassword.ico" />
|
||||
</Product>
|
||||
</Wix>
|
||||
BIN
MasterPassword/CSharp/MPSetup/SetupBanner.bmp
Normal file
BIN
MasterPassword/CSharp/MPSetup/SetupBanner.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
BIN
MasterPassword/CSharp/MPSetup/SetupBanner.psd
Normal file
BIN
MasterPassword/CSharp/MPSetup/SetupBanner.psd
Normal file
Binary file not shown.
BIN
MasterPassword/CSharp/MPSetup/SplashScreen.bmp
Normal file
BIN
MasterPassword/CSharp/MPSetup/SplashScreen.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 451 KiB |
BIN
MasterPassword/CSharp/MPSetup/SplashScreen.psd
Normal file
BIN
MasterPassword/CSharp/MPSetup/SplashScreen.psd
Normal file
Binary file not shown.
45
MasterPassword/CSharp/MasterPassword.sln
Normal file
45
MasterPassword/CSharp/MasterPassword.sln
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasterPassword", "MasterPassword\MasterPassword.csproj", "{0B647B7D-3E3F-497D-926D-69C05B48C000}"
|
||||
EndProject
|
||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MPSetup", "MPSetup\MPSetup.wixproj", "{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{0B647B7D-3E3F-497D-926D-69C05B48C000}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Debug|x86.Build.0 = Debug|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Release|Any CPU.Build.0 = Release|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Release|x86.ActiveCfg = Release|x86
|
||||
{A8F9AA78-B004-40F5-AF04-C9C2DAEF940A}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
18
MasterPassword/CSharp/MasterPassword/App.config
Normal file
18
MasterPassword/CSharp/MasterPassword/App.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="MasterPassword.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<MasterPassword.Properties.Settings>
|
||||
<setting name="c2c" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</MasterPassword.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
41
MasterPassword/CSharp/MasterPassword/MRUData.cs
Normal file
41
MasterPassword/CSharp/MasterPassword/MRUData.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MasterPassword
|
||||
{
|
||||
class MRUData
|
||||
{
|
||||
public MRUData(string userName, string siteName, int siteCounter, MasterPassword.MPType passwordType)
|
||||
{
|
||||
this.UserName = userName;
|
||||
this.SiteName = siteName;
|
||||
this.SiteCounter = siteCounter;
|
||||
this.PasswordType = passwordType;
|
||||
}
|
||||
public string UserName { get; set; }
|
||||
public string SiteName { get; set; }
|
||||
public int SiteCounter { get; set; }
|
||||
public MasterPassword.MPType PasswordType { get; set; }
|
||||
}
|
||||
}
|
||||
421
MasterPassword/CSharp/MasterPassword/MasterPassword.cs
Normal file
421
MasterPassword/CSharp/MasterPassword/MasterPassword.cs
Normal file
@@ -0,0 +1,421 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using Replicon.Cryptography.SCrypt;
|
||||
using System.Security.Cryptography;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace MasterPassword
|
||||
{
|
||||
static class MasterPassword
|
||||
{
|
||||
private const uint MP_N = 32768;
|
||||
private const uint MP_r = 8;
|
||||
private const uint MP_p = 2;
|
||||
private const uint MP_dkLen = 64;
|
||||
|
||||
private enum MPElementContentType
|
||||
{
|
||||
MPElementContentTypePassword,
|
||||
MPElementContentTypeNote,
|
||||
MPElementContentTypePicture,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum MPElementTypeClass
|
||||
{
|
||||
/** Generate the password. */
|
||||
MPElementTypeClassGenerated = 1 << 4,
|
||||
/** Store the password. */
|
||||
MPElementTypeClassStored = 1 << 5,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum MPElementFeature
|
||||
{
|
||||
/** Export the key-protected content data. */
|
||||
MPElementFeatureExportContent = 1 << 10,
|
||||
/** Never export content. */
|
||||
MPElementFeatureDevicePrivate = 1 << 11,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum MPElementType
|
||||
{
|
||||
MPElementTypeGeneratedMaximum = 0x0 | (int)MPElementTypeClass.MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedLong = 0x1 | (int)MPElementTypeClass.MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedMedium = 0x2 | (int)MPElementTypeClass.MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedBasic = 0x4 | (int)MPElementTypeClass.MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedShort = 0x3 | (int)MPElementTypeClass.MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedPIN = 0x5 | (int)MPElementTypeClass.MPElementTypeClassGenerated | 0x0,
|
||||
|
||||
MPElementTypeStoredPersonal = 0x0 | (int)MPElementTypeClass.MPElementTypeClassStored | (int)MPElementFeature.MPElementFeatureExportContent,
|
||||
MPElementTypeStoredDevicePrivate = 0x1 | (int)MPElementTypeClass.MPElementTypeClassStored | (int)MPElementFeature.MPElementFeatureDevicePrivate,
|
||||
}
|
||||
|
||||
public enum MPType
|
||||
{
|
||||
Maximum,
|
||||
Long,
|
||||
Medium,
|
||||
Basic,
|
||||
Short,
|
||||
PIN
|
||||
}
|
||||
|
||||
private static string Hex(byte[] bytes)
|
||||
{
|
||||
return BitConverter.ToString(bytes);
|
||||
}
|
||||
|
||||
private static string IDForBuf(byte[] bytes)
|
||||
{
|
||||
SHA256 sha256 = SHA256.Create();
|
||||
byte[] hash = sha256.ComputeHash(bytes);
|
||||
return BitConverter.ToString(hash);
|
||||
}
|
||||
|
||||
private static string CipherForType(MPElementType type, byte seedByte)
|
||||
{
|
||||
string retValue = "";
|
||||
if (((int)type & (int)MPElementTypeClass.MPElementTypeClassGenerated) > 0)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MPElementType.MPElementTypeGeneratedMaximum:
|
||||
{
|
||||
string[] ciphers = { "anoxxxxxxxxxxxxxxxxx", "axxxxxxxxxxxxxxxxxno" };
|
||||
retValue = ciphers[seedByte % 2];
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementType.MPElementTypeGeneratedLong:
|
||||
{
|
||||
string[] ciphers = { "CvcvnoCvcvCvcv", "CvcvCvcvnoCvcv", "CvcvCvcvCvcvno", "CvccnoCvcvCvcv", "CvccCvcvnoCvcv", "CvccCvcvCvcvno", "CvcvnoCvccCvcv", "CvcvCvccnoCvcv", "CvcvCvccCvcvno", "CvcvnoCvcvCvcc", "CvcvCvcvnoCvcc", "CvcvCvcvCvccno", "CvccnoCvccCvcv", "CvccCvccnoCvcv", "CvccCvccCvcvno", "CvcvnoCvccCvcc", "CvcvCvccnoCvcc", "CvcvCvccCvccno", "CvccnoCvcvCvcc", "CvccCvcvnoCvcc", "CvccCvcvCvccno" };
|
||||
retValue = ciphers[seedByte % 21];
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementType.MPElementTypeGeneratedMedium:
|
||||
{
|
||||
string[] ciphers = { "CvcnoCvc", "CvcCvcno" };
|
||||
retValue = ciphers[seedByte % 2];
|
||||
break;
|
||||
}
|
||||
case MPElementType.MPElementTypeGeneratedBasic:
|
||||
{
|
||||
string[] ciphers = { "aaanaaan", "aannaaan", "aaannaaa" };
|
||||
retValue = ciphers[seedByte % 3];
|
||||
break;
|
||||
}
|
||||
case MPElementType.MPElementTypeGeneratedShort:
|
||||
{
|
||||
retValue = "Cvcn";
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementType.MPElementTypeGeneratedPIN:
|
||||
{
|
||||
retValue = "nnnn";
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Debug.WriteLine("Unknown generated type: %d", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private static char CharacterFromClass(char characterClass, byte seedByte)
|
||||
{
|
||||
char retValue = char.MinValue;
|
||||
string classCharacters = "";
|
||||
switch (characterClass)
|
||||
{
|
||||
case 'V':
|
||||
classCharacters = "AEIOU";
|
||||
break;
|
||||
case 'C':
|
||||
classCharacters = "BCDFGHJKLMNPQRSTVWXYZ";
|
||||
break;
|
||||
case 'v':
|
||||
classCharacters = "aeiou";
|
||||
break;
|
||||
case 'c':
|
||||
classCharacters = "bcdfghjklmnpqrstvwxyz";
|
||||
break;
|
||||
case 'A':
|
||||
classCharacters = "AEIOUBCDFGHJKLMNPQRSTVWXYZ";
|
||||
break;
|
||||
case 'a':
|
||||
classCharacters = "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz";
|
||||
break;
|
||||
case 'n':
|
||||
classCharacters = "0123456789";
|
||||
break;
|
||||
case 'o':
|
||||
classCharacters = "@&%?,=[]_:-+*$#!'^~;()/.";
|
||||
break;
|
||||
case 'x':
|
||||
classCharacters = "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz0123456789!@#$%^&*()";
|
||||
break;
|
||||
default:
|
||||
Debug.WriteLine("Unknown character class: %c", characterClass);
|
||||
break;
|
||||
}
|
||||
if (classCharacters.Length > 0)
|
||||
retValue = classCharacters[seedByte % classCharacters.Length];
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
static byte[] EncryptStringToBytes(string plainText, byte[] Key, byte[] IV)
|
||||
{
|
||||
// Check arguments.
|
||||
if (plainText == null || plainText.Length <= 0)
|
||||
throw new ArgumentNullException("plainText");
|
||||
if (Key == null || Key.Length <= 0)
|
||||
throw new ArgumentNullException("Key");
|
||||
if (IV == null || IV.Length <= 0)
|
||||
throw new ArgumentNullException("Key");
|
||||
byte[] encrypted;
|
||||
// Create an RijndaelManaged object
|
||||
// with the specified key and IV.
|
||||
using (RijndaelManaged rijAlg = new RijndaelManaged())
|
||||
{
|
||||
rijAlg.Key = Key;
|
||||
rijAlg.IV = IV;
|
||||
|
||||
// Create a decrytor to perform the stream transform.
|
||||
ICryptoTransform encryptor = rijAlg.CreateEncryptor(rijAlg.Key, rijAlg.IV);
|
||||
|
||||
// Create the streams used for encryption.
|
||||
using (MemoryStream msEncrypt = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||
{
|
||||
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
|
||||
{ // Write all data to the stream.
|
||||
swEncrypt.Write(plainText);
|
||||
}
|
||||
encrypted = msEncrypt.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return the encrypted bytes from the memory stream.
|
||||
return encrypted;
|
||||
}
|
||||
|
||||
static string DecryptStringFromBytes(byte[] cipherText, byte[] Key, byte[] IV)
|
||||
{
|
||||
// Check arguments.
|
||||
if (cipherText == null || cipherText.Length <= 0)
|
||||
throw new ArgumentNullException("cipherText");
|
||||
if (Key == null || Key.Length <= 0)
|
||||
throw new ArgumentNullException("Key");
|
||||
if (IV == null || IV.Length <= 0)
|
||||
throw new ArgumentNullException("Key");
|
||||
|
||||
// Declare the string used to hold
|
||||
// the decrypted text.
|
||||
string plaintext = null;
|
||||
|
||||
// Create an RijndaelManaged object
|
||||
// with the specified key and IV.
|
||||
using (RijndaelManaged rijAlg = new RijndaelManaged())
|
||||
{
|
||||
rijAlg.Key = Key;
|
||||
rijAlg.IV = IV;
|
||||
|
||||
// Create a decrytor to perform the stream transform.
|
||||
ICryptoTransform decryptor = rijAlg.CreateDecryptor(rijAlg.Key, rijAlg.IV);
|
||||
|
||||
// Create the streams used for decryption.
|
||||
using (MemoryStream msDecrypt = new MemoryStream(cipherText))
|
||||
{
|
||||
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
|
||||
{
|
||||
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
|
||||
{ // Read the decrypted bytes from the decrypting stream
|
||||
// and place them in a string.
|
||||
plaintext = srDecrypt.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return plaintext;
|
||||
}
|
||||
|
||||
public static byte[] Encrypt(string masterPassword, string data)
|
||||
{
|
||||
byte[] retValue = new byte[0];
|
||||
if (masterPassword.Length > 0)
|
||||
{
|
||||
string mpNameSpace = "com.lyndir.masterpassword";
|
||||
byte[] mpNameSpaceBytes = new UTF8Encoding().GetBytes(mpNameSpace);
|
||||
byte[] masterPasswordBytes = new UTF8Encoding().GetBytes(masterPassword);
|
||||
byte[] masterKey = SCrypt.DeriveKey(masterPasswordBytes, mpNameSpaceBytes, MP_N, MP_r, MP_p, 32);
|
||||
using (RijndaelManaged rijndael = new RijndaelManaged())
|
||||
{
|
||||
rijndael.Key = masterKey;
|
||||
rijndael.GenerateIV();
|
||||
|
||||
byte[] encrypted = EncryptStringToBytes(data, rijndael.Key, rijndael.IV);
|
||||
retValue = new byte[rijndael.IV.Length + encrypted.Length];
|
||||
Array.Copy(rijndael.IV, retValue, rijndael.IV.Length);
|
||||
Array.Copy(encrypted, 0, retValue, rijndael.IV.Length, encrypted.Length);
|
||||
}
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
||||
public static string Decrypt(string masterPassword, byte[] data)
|
||||
{
|
||||
string retValue = "";
|
||||
if (masterPassword.Length > 0)
|
||||
{
|
||||
string mpNameSpace = "com.lyndir.masterpassword";
|
||||
byte[] mpNameSpaceBytes = new UTF8Encoding().GetBytes(mpNameSpace);
|
||||
byte[] masterPasswordBytes = new UTF8Encoding().GetBytes(masterPassword);
|
||||
byte[] masterKey = SCrypt.DeriveKey(masterPasswordBytes, mpNameSpaceBytes, MP_N, MP_r, MP_p, 32);
|
||||
|
||||
using (RijndaelManaged rijndael = new RijndaelManaged())
|
||||
{
|
||||
rijndael.Key = masterKey;
|
||||
byte[] iv = new byte[rijndael.IV.Length];
|
||||
Array.Copy(data, iv, iv.Length);
|
||||
rijndael.IV = iv;
|
||||
byte[] encrypted = new byte[data.Length - rijndael.IV.Length];
|
||||
Array.Copy(data, rijndael.IV.Length, encrypted, 0, encrypted.Length);
|
||||
retValue = DecryptStringFromBytes(encrypted, rijndael.Key, rijndael.IV);
|
||||
}
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
||||
public static string GetMasterPasswordKeySHA(string masterPassword)
|
||||
{
|
||||
string retValue = "";
|
||||
if (masterPassword.Length > 0)
|
||||
{
|
||||
string mpNameSpace = "com.lyndir.masterpassword";
|
||||
byte[] mpNameSpaceBytes = new UTF8Encoding().GetBytes(mpNameSpace);
|
||||
byte[] masterPasswordBytes = new UTF8Encoding().GetBytes(masterPassword);
|
||||
byte[] masterKey = SCrypt.DeriveKey(masterPasswordBytes, mpNameSpaceBytes, MP_N, MP_r, MP_p, MP_dkLen);
|
||||
retValue = IDForBuf(masterKey);
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
||||
public static string Calculate(string masterPassword, string userName, string siteName, int siteCounter, MPType mpType)
|
||||
{
|
||||
MPElementType[] passwordTypes = {MPElementType.MPElementTypeGeneratedMaximum,
|
||||
MPElementType.MPElementTypeGeneratedLong,
|
||||
MPElementType.MPElementTypeGeneratedMedium,
|
||||
MPElementType.MPElementTypeGeneratedBasic,
|
||||
MPElementType.MPElementTypeGeneratedShort,
|
||||
MPElementType.MPElementTypeGeneratedPIN};
|
||||
|
||||
MPElementType type = passwordTypes[(int)mpType];
|
||||
|
||||
string retValue = "";
|
||||
if ((masterPassword.Length > 0) && (userName.Length > 0) && (siteName.Length > 0))
|
||||
{
|
||||
string mpNameSpace = "com.lyndir.masterpassword";
|
||||
byte[] mpNameSpaceBytes = new UTF8Encoding().GetBytes(mpNameSpace);
|
||||
byte[] userNameBytes = new UTF8Encoding().GetBytes(userName);
|
||||
UInt32 n_userNameLength = (UInt32)IPAddress.HostToNetworkOrder(userNameBytes.Length);
|
||||
int masterKeySaltLength = mpNameSpaceBytes.Length + sizeof(UInt32) + userNameBytes.Length;
|
||||
IntPtr masterKeySalt = Marshal.AllocHGlobal(masterKeySaltLength);
|
||||
IntPtr mks = masterKeySalt;
|
||||
Marshal.Copy(mpNameSpaceBytes, 0, mks, mpNameSpaceBytes.Length);
|
||||
mks += mpNameSpaceBytes.Length;
|
||||
Marshal.Copy(BitConverter.GetBytes(n_userNameLength), 0, mks, sizeof(UInt32));
|
||||
mks += sizeof(UInt32);
|
||||
Marshal.Copy(userNameBytes, 0, mks, userNameBytes.Length);
|
||||
mks += userNameBytes.Length;
|
||||
if ((mks.ToInt32() - masterKeySalt.ToInt32()) == masterKeySaltLength)
|
||||
{
|
||||
byte[] masterKeySaltBytes = new byte[masterKeySaltLength];
|
||||
Marshal.Copy(masterKeySalt, masterKeySaltBytes, 0, masterKeySaltLength);
|
||||
//Debug.WriteLine("masterKeySalt ID: " + IDForBuf(masterKeySaltBytes));
|
||||
|
||||
byte[] masterPasswordBytes = new UTF8Encoding().GetBytes(masterPassword);
|
||||
byte[] masterKey = SCrypt.DeriveKey(masterPasswordBytes, masterKeySaltBytes, MP_N, MP_r, MP_p, MP_dkLen);
|
||||
|
||||
//Debug.WriteLine("masterPassword Hex: " + Hex(masterPasswordBytes));
|
||||
//Debug.WriteLine("masterPassword ID: " + IDForBuf(masterPasswordBytes));
|
||||
//Debug.WriteLine("masterKey ID: " + IDForBuf(masterKey));
|
||||
|
||||
byte[] siteNameBytes = new UTF8Encoding().GetBytes(siteName);
|
||||
UInt32 n_siteNameLength = (UInt32)IPAddress.HostToNetworkOrder(siteNameBytes.Length);
|
||||
UInt32 n_siteCounter = (UInt32)IPAddress.HostToNetworkOrder(siteCounter);
|
||||
int sitePasswordInfoLength = mpNameSpaceBytes.Length + sizeof(UInt32) + siteNameBytes.Length + sizeof(UInt32);
|
||||
IntPtr sitePasswordInfo = Marshal.AllocHGlobal(sitePasswordInfoLength);
|
||||
IntPtr sPI = sitePasswordInfo;
|
||||
Marshal.Copy(mpNameSpaceBytes, 0, sPI, mpNameSpaceBytes.Length);
|
||||
sPI += mpNameSpaceBytes.Length;
|
||||
Marshal.Copy(BitConverter.GetBytes(n_siteNameLength), 0, sPI, sizeof(UInt32));
|
||||
sPI += sizeof(UInt32);
|
||||
Marshal.Copy(siteNameBytes, 0, sPI, siteNameBytes.Length);
|
||||
sPI += siteNameBytes.Length;
|
||||
Marshal.Copy(BitConverter.GetBytes(n_siteCounter), 0, sPI, sizeof(UInt32));
|
||||
sPI += sizeof(UInt32);
|
||||
if ((sPI.ToInt32() - sitePasswordInfo.ToInt32()) == sitePasswordInfoLength)
|
||||
{
|
||||
byte[] sitePasswordInfoBytes = new byte[sitePasswordInfoLength];
|
||||
Marshal.Copy(sitePasswordInfo, sitePasswordInfoBytes, 0, sitePasswordInfoLength);
|
||||
//Debug.WriteLine("seed from: hmac-sha256(masterKey, 'com.lyndir.masterpassword' | {0} | {1} | {2})", Hex(BitConverter.GetBytes(n_siteNameLength)), siteName, Hex(BitConverter.GetBytes(n_siteCounter)));
|
||||
//Debug.WriteLine("sitePasswordInfo ID: " + IDForBuf(sitePasswordInfoBytes));
|
||||
|
||||
|
||||
HMACSHA256 hmacsha256 = new HMACSHA256(masterKey);
|
||||
byte[] sitePasswordSeed = hmacsha256.ComputeHash(sitePasswordInfoBytes);
|
||||
|
||||
//Debug.WriteLine("sitePasswordSeed ID: " + IDForBuf(sitePasswordSeed));
|
||||
|
||||
string cipher = CipherForType(type, sitePasswordSeed[0]);
|
||||
//Debug.WriteLine("type: {0}, cipher: {1}", type.ToString(), cipher);
|
||||
char[] sitePassword = new char[cipher.Length];
|
||||
if (cipher.Length <= 32)
|
||||
{
|
||||
for (int c = 0; c < cipher.Length; c++)
|
||||
{
|
||||
sitePassword[c] = CharacterFromClass(cipher[c], sitePasswordSeed[c + 1]);
|
||||
//Debug.WriteLine("class {0}, character {1}", cipher[c], sitePassword[c]);
|
||||
}
|
||||
retValue = new string(sitePassword);
|
||||
//Debug.WriteLine(retValue);
|
||||
}
|
||||
}
|
||||
Marshal.FreeHGlobal(sitePasswordInfo);
|
||||
}
|
||||
Marshal.FreeHGlobal(masterKeySalt);
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
138
MasterPassword/CSharp/MasterPassword/MasterPassword.csproj
Normal file
138
MasterPassword/CSharp/MasterPassword/MasterPassword.csproj
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0B647B7D-3E3F-497D-926D-69C05B48C000}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MasterPassword</RootNamespace>
|
||||
<AssemblyName>MasterPassword</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>MasterPassword.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Replicon.Cryptography.SCrypt">
|
||||
<HintPath>Replicon.Cryptography.SCrypt\Replicon.Cryptography.SCrypt.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="frmMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmMain.Designer.cs">
|
||||
<DependentUpon>frmMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MasterPassword.cs" />
|
||||
<Compile Include="MRUData.cs" />
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="frmMain.resx">
|
||||
<DependentUpon>frmMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="MasterPassword.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
BIN
MasterPassword/CSharp/MasterPassword/MasterPassword.ico
Normal file
BIN
MasterPassword/CSharp/MasterPassword/MasterPassword.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 205 KiB |
32
MasterPassword/CSharp/MasterPassword/NativeMethods.cs
Normal file
32
MasterPassword/CSharp/MasterPassword/NativeMethods.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MasterPassword
|
||||
{
|
||||
internal class NativeMethods
|
||||
{
|
||||
public const int HWND_BROADCAST = 0xffff;
|
||||
public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
|
||||
[DllImport("user32")]
|
||||
public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
|
||||
[DllImport("user32")]
|
||||
public static extern int RegisterWindowMessage(string message);
|
||||
}
|
||||
}
|
||||
48
MasterPassword/CSharp/MasterPassword/Program.cs
Normal file
48
MasterPassword/CSharp/MasterPassword/Program.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MasterPassword
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
static Mutex mutex = new Mutex(true, "MasterPassword");
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
if (mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new frmMain());
|
||||
mutex.ReleaseMutex();
|
||||
}
|
||||
else
|
||||
NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MasterPassword")]
|
||||
[assembly: AssemblyDescription("MasterPassword for Windows")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("GuruCE Limited")]
|
||||
[assembly: AssemblyProduct("MasterPassword")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a5519bdf-81ee-43f2-a46e-85198b4d5c77")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.4.0.0")]
|
||||
63
MasterPassword/CSharp/MasterPassword/Properties/Resources.Designer.cs
generated
Normal file
63
MasterPassword/CSharp/MasterPassword/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MasterPassword.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MasterPassword.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
MasterPassword/CSharp/MasterPassword/Properties/Resources.resx
Normal file
120
MasterPassword/CSharp/MasterPassword/Properties/Resources.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
39
MasterPassword/CSharp/MasterPassword/Properties/Settings.Designer.cs
generated
Normal file
39
MasterPassword/CSharp/MasterPassword/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MasterPassword.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
[global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
|
||||
public bool c2c {
|
||||
get {
|
||||
return ((bool)(this["c2c"]));
|
||||
}
|
||||
set {
|
||||
this["c2c"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MasterPassword.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="c2c" Roaming="true" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,53 @@
|
||||
Replicon.Cryptography.SCrypt
|
||||
Copyright (c) 2012, Replicon Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Replicon Inc. nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL REPLICON INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Contains software provided by Colin Percival and used under this license:
|
||||
|
||||
Copyright 2009 Colin Percival
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Replicon.Cryptography.SCrypt</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Replicon.Cryptography.SCrypt.SaltParseException">
|
||||
<summary>
|
||||
Exception thrown when a SCrypt salt string is unparsable.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Replicon.Cryptography.SCrypt.IKeyDerivationFunction">
|
||||
<summary>
|
||||
Interface wrapping an scrypt key-derivation function implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IKeyDerivationFunction.DeriveKey(System.Byte[],System.Byte[],System.UInt64,System.UInt32,System.UInt32,System.UInt32)">
|
||||
<summary>Key-derivation function.</summary>
|
||||
<param name="password">The password bytes to generate the key based upon.</param>
|
||||
<param name="salt">Random salt bytes to make the derived key unique.</param>
|
||||
<param name="N">CPU/memory cost parameter. Must be a value 2^N. 2^14 (16384) causes a calculation time
|
||||
of approximately 50-70ms on 2010 era hardware; each successive value (eg. 2^15, 2^16, ...) should
|
||||
double the amount of CPU time and memory required.</param>
|
||||
<param name="r">scrypt 'r' tuning parameter</param>
|
||||
<param name="p">scrypt 'p' tuning parameter (parallelization parameter); a large value of p can increase
|
||||
computational cost of scrypt without increasing the memory usage.</param>
|
||||
<param name="derivedKeyLengthBytes">The number of bytes of key to derive.</param>
|
||||
</member>
|
||||
<member name="T:Replicon.Cryptography.SCrypt.IPasswordHash">
|
||||
<summary>Wrapper for the scrypt key-derivation function that provides helper functions for a common use-case
|
||||
of scrypt as a password hashing algorithm.</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.GenerateSalt">
|
||||
<summary>Generate a salt for use with HashPassword, selecting reasonable default values for scrypt
|
||||
parameters that are appropriate for an interactive login verification workflow.</summary>
|
||||
<remarks>Uses the default values in DefaultSaltLengthBytes, Default_N, Default_r, Default_r, and
|
||||
DefaultHashLengthBytes.</remarks>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.GenerateSalt(System.UInt32,System.UInt64,System.UInt32,System.UInt32,System.UInt32)">
|
||||
<summary>Generate a random salt for use with HashPassword. In addition to the random salt, the salt value
|
||||
also contains the tuning parameters to use with the scrypt algorithm, as well as the size of the password
|
||||
hash to generate.</summary>
|
||||
<param name="saltLengthBytes">The number of bytes of random salt to generate. The goal for the salt is
|
||||
to be unique. 16 bytes gives a 2^128 possible salt options, and roughly an N in 2^64 chance of a salt
|
||||
collision for N salts, which seems reasonable. A larger salt requires more storage space, but doesn't
|
||||
affect the scrypt performance significantly.</param>
|
||||
<param name="N">CPU/memory cost parameter. Must be a value 2^N. 2^14 (16384) causes a calculation time
|
||||
of approximately 50-70ms on 2010 era hardware; each successive value (eg. 2^15, 2^16, ...) should
|
||||
double the amount of CPU time and memory required.</param>
|
||||
<param name="r">scrypt 'r' tuning parameter</param>
|
||||
<param name="p">scrypt 'p' tuning parameter (parallelization parameter); a large value of p can increase
|
||||
computational cost of scrypt without increasing the memory usage.</param>
|
||||
<param name="hashLengthBytes">The number of bytes to store the password hash in.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.HashPassword(System.String)">
|
||||
<summary>Generate a password hash using a newly generated salt, with default salt parameters.</summary>
|
||||
<param name="password">A password to hash.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.TryParseSalt(System.String,System.Byte[]@,System.UInt64@,System.UInt32@,System.UInt32@,System.UInt32@)">
|
||||
<summary>Attempt to parse the salt component of a salt or password and return the tuning parameters
|
||||
embedded in the salt.</summary>
|
||||
<param name="salt">Salt or hashed password to parse.</param>
|
||||
<param name="saltBytes">The randomly generated salt data. The length will match saltLengthBytes from
|
||||
GenerateSalt.</param>
|
||||
<param name="N">Matching value for GenerateSalt's N parameter.</param>
|
||||
<param name="r">Matching value for GenerateSalt's r parameter.</param>
|
||||
<param name="p">Matching value for GenerateSalt's p parameter.</param>
|
||||
<param name="hashLengthBytes">The number of bytes to store the password hash in.</param>
|
||||
<returns>True if the parsing was successful, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.ParseSalt(System.String,System.Byte[]@,System.UInt64@,System.UInt32@,System.UInt32@,System.UInt32@)">
|
||||
<summary>Parse the salt component of a salt or password and return the tuning parameters embedded in the
|
||||
salt.</summary>
|
||||
<exception cref="T:Replicon.Cryptography.SCrypt.SaltParseException">Throws SaltParseException if an error
|
||||
occurs while parsing the salt.</exception>
|
||||
<param name="salt">Salt or hashed password to parse.</param>
|
||||
<param name="saltBytes">The randomly generated salt data. The length will match saltLengthBytes from
|
||||
GenerateSalt.</param>
|
||||
<param name="N">Matching value for GenerateSalt's N parameter.</param>
|
||||
<param name="r">Matching value for GenerateSalt's r parameter.</param>
|
||||
<param name="p">Matching value for GenerateSalt's p parameter.</param>
|
||||
<param name="hashLengthBytes">The number of bytes to store the password hash in.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.HashPassword(System.String,System.String)">
|
||||
<summary>Generate a password hash using a specific password salt.</summary>
|
||||
<param name="password">A password to hash.</param>
|
||||
<param name="salt">Salt to hash the password with. This is often a password hash from a previous
|
||||
HashPassword call, which contains the salt of the original password call; in that case, the returned
|
||||
hash will be identical to the salt parameter if the password is the same password as the original.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.IPasswordHash.Verify(System.String,System.String)">
|
||||
<summary>Verify that a given password matches a given hash.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.IPasswordHash.DefaultSaltLengthBytes">
|
||||
<summary>Default value for saltLengthBytes used by parameterless GenerateSalt, currently 16 bytes.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.IPasswordHash.Default_N">
|
||||
<summary>Default value for N used by parameterless GenerateSalt, currently 2^14.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.IPasswordHash.Default_r">
|
||||
<summary>Default value for r used by parameterless GenerateSalt, currently 8.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.IPasswordHash.Default_p">
|
||||
<summary>Default value for p used by parameterless GenerateSalt, currently 1.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.IPasswordHash.DefaultHashLengthBytes">
|
||||
<summary>Default value for hashLengthBytes used by parameterless GenerateSalt, currently 32 bytes.</summary>
|
||||
</member>
|
||||
<member name="T:Replicon.Cryptography.SCrypt.SCrypt">
|
||||
<summary>Static wrapper for Factory.CreatePasswordHash().</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.GenerateSalt">
|
||||
<summary>Generate a salt for use with HashPassword, selecting reasonable default values for scrypt
|
||||
parameters that are appropriate for an interactive login verification workflow.</summary>
|
||||
<remarks>Uses the default values in DefaultSaltLengthBytes, Default_N, Default_r, Default_r, and
|
||||
DefaultHashLengthBytes.</remarks>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.GenerateSalt(System.UInt32,System.UInt64,System.UInt32,System.UInt32,System.UInt32)">
|
||||
<summary>Generate a random salt for use with HashPassword. In addition to the random salt, the salt value
|
||||
also contains the tuning parameters to use with the scrypt algorithm, as well as the size of the password
|
||||
hash to generate.</summary>
|
||||
<param name="saltLengthBytes">The number of bytes of random salt to generate. The goal for the salt is
|
||||
to be unique. 16 bytes gives a 2^128 possible salt options, and roughly an N in 2^64 chance of a salt
|
||||
collision for N salts, which seems reasonable. A larger salt requires more storage space, but doesn't
|
||||
affect the scrypt performance significantly.</param>
|
||||
<param name="N">CPU/memory cost parameter. Must be a value 2^N. 2^14 (16384) causes a calculation time
|
||||
of approximately 50-70ms on 2010 era hardware; each successive value (eg. 2^15, 2^16, ...) should
|
||||
double the amount of CPU time and memory required.</param>
|
||||
<param name="r">scrypt 'r' tuning parameter</param>
|
||||
<param name="p">scrypt 'p' tuning parameter (parallelization parameter); a large value of p can increase
|
||||
computational cost of scrypt without increasing the memory usage.</param>
|
||||
<param name="hashLengthBytes">The number of bytes to store the password hash in.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.HashPassword(System.String)">
|
||||
<summary>Generate a password hash using a newly generated salt, with default salt parameters.</summary>
|
||||
<param name="password">A password to hash.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.TryParseSalt(System.String,System.Byte[]@,System.UInt64@,System.UInt32@,System.UInt32@,System.UInt32@)">
|
||||
<summary>Attempt to parse the salt component of a salt or password and return the tuning parameters
|
||||
embedded in the salt.</summary>
|
||||
<param name="salt">Salt or hashed password to parse.</param>
|
||||
<param name="saltBytes">The randomly generated salt data. The length will match saltLengthBytes from
|
||||
GenerateSalt.</param>
|
||||
<param name="N">Matching value for GenerateSalt's N parameter.</param>
|
||||
<param name="r">Matching value for GenerateSalt's r parameter.</param>
|
||||
<param name="p">Matching value for GenerateSalt's p parameter.</param>
|
||||
<param name="hashLengthBytes">The number of bytes to store the password hash in.</param>
|
||||
<returns>True if the parsing was successful, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.ParseSalt(System.String,System.Byte[]@,System.UInt64@,System.UInt32@,System.UInt32@,System.UInt32@)">
|
||||
<summary>Parse the salt component of a salt or password and return the tuning parameters embedded in the
|
||||
salt.</summary>
|
||||
<exception cref="T:Replicon.Cryptography.SCrypt.SaltParseException">Throws SaltParseException if an error
|
||||
occurs while parsing the salt.</exception>
|
||||
<param name="salt">Salt or hashed password to parse.</param>
|
||||
<param name="saltBytes">The randomly generated salt data. The length will match saltLengthBytes from
|
||||
GenerateSalt.</param>
|
||||
<param name="N">Matching value for GenerateSalt's N parameter.</param>
|
||||
<param name="r">Matching value for GenerateSalt's r parameter.</param>
|
||||
<param name="p">Matching value for GenerateSalt's p parameter.</param>
|
||||
<param name="hashLengthBytes">The number of bytes to store the password hash in.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.HashPassword(System.String,System.String)">
|
||||
<summary>Generate a password hash using a specific password salt.</summary>
|
||||
<param name="password">A password to hash.</param>
|
||||
<param name="salt">Salt to hash the password with. This is often a password hash from a previous
|
||||
HashPassword call, which contains the salt of the original password call; in that case, the returned
|
||||
hash will be identical to the salt parameter if the password is the same password as the original.</param>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.Verify(System.String,System.String)">
|
||||
<summary>Verify that a given password matches a given hash.</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.SCrypt.DeriveKey(System.Byte[],System.Byte[],System.UInt64,System.UInt32,System.UInt32,System.UInt32)">
|
||||
<summary>The 'raw' scrypt key-derivation function.</summary>
|
||||
<param name="password">The password bytes to generate the key based upon.</param>
|
||||
<param name="salt">Random salt bytes to make the derived key unique.</param>
|
||||
<param name="N">CPU/memory cost parameter. Must be a value 2^N. 2^14 (16384) causes a calculation time
|
||||
of approximately 50-70ms on 2010 era hardware; each successive value (eg. 2^15, 2^16, ...) should
|
||||
double the amount of CPU time and memory required.</param>
|
||||
<param name="r">scrypt 'r' tuning parameter</param>
|
||||
<param name="p">scrypt 'p' tuning parameter (parallelization parameter); a large value of p can increase
|
||||
computational cost of scrypt without increasing the memory usage.</param>
|
||||
<param name="derivedKeyLengthBytes">The number of bytes of key to derive.</param>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.SCrypt.DefaultSaltLengthBytes">
|
||||
<summary>Default value for saltLengthBytes used by parameterless GenerateSalt, currently 16 bytes.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.SCrypt.Default_N">
|
||||
<summary>Default value for N used by parameterless GenerateSalt, currently 2^14.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.SCrypt.Default_r">
|
||||
<summary>Default value for r used by parameterless GenerateSalt, currently 8.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.SCrypt.Default_p">
|
||||
<summary>Default value for p used by parameterless GenerateSalt, currently 1.</summary>
|
||||
</member>
|
||||
<member name="P:Replicon.Cryptography.SCrypt.SCrypt.DefaultHashLengthBytes">
|
||||
<summary>Default value for hashLengthBytes used by parameterless GenerateSalt, currently 32 bytes.</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.MixedModeAssemblyKeyDerivationFunction.CopyStream(System.IO.Stream,System.IO.Stream)">
|
||||
<summary>
|
||||
There is a similar method in the .NET 4 base classes, but we need to implement our own to support .NET
|
||||
3.5 still.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.MixedModeAssemblyKeyDerivationFunction.EscapeExecutionContext``1(System.Func{``0})">
|
||||
<summary>
|
||||
CRT initialization when first accessing the mixed-mode assembly will attempt to initialize a CRT appdomain,
|
||||
which attempts to copy the current thread's execution context. However, because the new appdomain doesn't
|
||||
have a configuration matching the current appdomain, it often can't find the assemblies required to
|
||||
deserialize the principal, or other objects stored in the execution context. To work around this, we
|
||||
attempt to "escape" our execution context by spawning a new thread. I welcome ideas for how to make this
|
||||
more efficient.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Replicon.Cryptography.SCrypt.Factory">
|
||||
<summary>
|
||||
Factory for creating pre-defined implementations of IPasswordHash and IKeyDerivationFunction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.Factory.CreatePasswordHash">
|
||||
<summary>
|
||||
Create an IPasswordHash implementation, using the best available key-derivation function implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.Factory.CreatePasswordHash(Replicon.Cryptography.SCrypt.IKeyDerivationFunction)">
|
||||
<summary>
|
||||
Create an IPasswordHash implementation, using the provided key-derivation function implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.Factory.CreateKeyDerivationFunction">
|
||||
<summary>
|
||||
Create an IKeyDerivationFunction representing the best available key-derivation function implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Replicon.Cryptography.SCrypt.Factory.CreateNativeKeyDerivationFunction">
|
||||
<summary>
|
||||
Create an IKeyDerivationFunction implemented by a mixed-mode assembly. This is a high-performance
|
||||
implementation using SSE2, but requires support for C++/CLI mixed-mode assemblies (ie. doesn't work on
|
||||
Mono), and requires that the current environment be supported (.NET 3.5 or 4.0, x86 or x64).
|
||||
</summary>
|
||||
<remarks>If the mixed-mode assembly cannot be loaded, this method will... FIXME: what?</remarks>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
309
MasterPassword/CSharp/MasterPassword/frmMain.Designer.cs
generated
Normal file
309
MasterPassword/CSharp/MasterPassword/frmMain.Designer.cs
generated
Normal file
@@ -0,0 +1,309 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
namespace MasterPassword
|
||||
{
|
||||
partial class frmMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtUsername = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.cmbType = new System.Windows.Forms.ComboBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.nudCounter = new System.Windows.Forms.NumericUpDown();
|
||||
this.txtPassword = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtMasterPassword = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.btnGetPassword = new System.Windows.Forms.Button();
|
||||
this.cmbSite = new System.Windows.Forms.ComboBox();
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.chkC2C = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudCounter)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 73);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(55, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Full name:";
|
||||
//
|
||||
// txtUsername
|
||||
//
|
||||
this.txtUsername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUsername.Location = new System.Drawing.Point(77, 65);
|
||||
this.txtUsername.Name = "txtUsername";
|
||||
this.txtUsername.Size = new System.Drawing.Size(235, 20);
|
||||
this.txtUsername.TabIndex = 3;
|
||||
this.txtUsername.Leave += new System.EventHandler(this.txtUsername_Leave);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 100);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(34, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Type:";
|
||||
//
|
||||
// cmbType
|
||||
//
|
||||
this.cmbType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cmbType.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;
|
||||
this.cmbType.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbType.FormattingEnabled = true;
|
||||
this.cmbType.Items.AddRange(new object[] {
|
||||
"x - maximum (20 characters, contains symbols)",
|
||||
"l - long (Copy-friendly, 14 characters, contains symbols)",
|
||||
"m - medium (Copy-friendly, 8 characters, contains symbols)",
|
||||
"b - basic (8 characters, no symbols)",
|
||||
"s - short (Copy-friendly, 4 characters, no symbols)",
|
||||
"p - pin (4 numbers)"});
|
||||
this.cmbType.Location = new System.Drawing.Point(77, 92);
|
||||
this.cmbType.Name = "cmbType";
|
||||
this.cmbType.Size = new System.Drawing.Size(235, 21);
|
||||
this.cmbType.TabIndex = 4;
|
||||
this.cmbType.SelectedIndexChanged += new System.EventHandler(this.cmbType_SelectedIndexChanged);
|
||||
this.cmbType.Leave += new System.EventHandler(this.cmbType_Leave);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 46);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(28, 13);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "Site:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(12, 126);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(47, 13);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Counter:";
|
||||
//
|
||||
// nudCounter
|
||||
//
|
||||
this.nudCounter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nudCounter.Location = new System.Drawing.Point(77, 119);
|
||||
this.nudCounter.Maximum = new decimal(new int[] {
|
||||
100000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nudCounter.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nudCounter.Name = "nudCounter";
|
||||
this.nudCounter.Size = new System.Drawing.Size(73, 20);
|
||||
this.nudCounter.TabIndex = 5;
|
||||
this.nudCounter.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nudCounter.Leave += new System.EventHandler(this.nudCounter_Leave);
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtPassword.BackColor = System.Drawing.Color.LemonChiffon;
|
||||
this.txtPassword.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtPassword.Location = new System.Drawing.Point(77, 145);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.ReadOnly = true;
|
||||
this.txtPassword.Size = new System.Drawing.Size(235, 31);
|
||||
this.txtPassword.TabIndex = 8;
|
||||
this.txtPassword.TabStop = false;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(12, 155);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(56, 13);
|
||||
this.label5.TabIndex = 9;
|
||||
this.label5.Text = "Password:";
|
||||
//
|
||||
// txtMasterPassword
|
||||
//
|
||||
this.txtMasterPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtMasterPassword.Location = new System.Drawing.Point(77, 12);
|
||||
this.txtMasterPassword.Name = "txtMasterPassword";
|
||||
this.txtMasterPassword.PasswordChar = '*';
|
||||
this.txtMasterPassword.Size = new System.Drawing.Size(235, 20);
|
||||
this.txtMasterPassword.TabIndex = 0;
|
||||
this.txtMasterPassword.Leave += new System.EventHandler(this.txtMasterPassword_Leave);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(12, 20);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(65, 13);
|
||||
this.label6.TabIndex = 10;
|
||||
this.label6.Text = "Master pwd:";
|
||||
//
|
||||
// btnGetPassword
|
||||
//
|
||||
this.btnGetPassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnGetPassword.Enabled = false;
|
||||
this.btnGetPassword.Location = new System.Drawing.Point(224, 119);
|
||||
this.btnGetPassword.Name = "btnGetPassword";
|
||||
this.btnGetPassword.Size = new System.Drawing.Size(88, 23);
|
||||
this.btnGetPassword.TabIndex = 7;
|
||||
this.btnGetPassword.Text = "Get &Password";
|
||||
this.btnGetPassword.UseVisualStyleBackColor = true;
|
||||
this.btnGetPassword.Click += new System.EventHandler(this.btnGetPassword_Click);
|
||||
//
|
||||
// cmbSite
|
||||
//
|
||||
this.cmbSite.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cmbSite.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
|
||||
this.cmbSite.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.cmbSite.FormattingEnabled = true;
|
||||
this.cmbSite.Location = new System.Drawing.Point(77, 38);
|
||||
this.cmbSite.Name = "cmbSite";
|
||||
this.cmbSite.Size = new System.Drawing.Size(235, 21);
|
||||
this.cmbSite.TabIndex = 2;
|
||||
this.cmbSite.SelectedIndexChanged += new System.EventHandler(this.cmbSite_Check);
|
||||
this.cmbSite.Enter += new System.EventHandler(this.cmbSite_Enter);
|
||||
this.cmbSite.Leave += new System.EventHandler(this.cmbSite_Check);
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.Enabled = false;
|
||||
this.btnDelete.FlatAppearance.BorderSize = 0;
|
||||
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
|
||||
this.btnDelete.Location = new System.Drawing.Point(51, 40);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(19, 19);
|
||||
this.btnDelete.TabIndex = 1;
|
||||
this.btnDelete.TabStop = false;
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
//
|
||||
// chkC2C
|
||||
//
|
||||
this.chkC2C.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkC2C.AutoSize = true;
|
||||
this.chkC2C.Location = new System.Drawing.Point(156, 122);
|
||||
this.chkC2C.Name = "chkC2C";
|
||||
this.chkC2C.Size = new System.Drawing.Size(70, 17);
|
||||
this.chkC2C.TabIndex = 6;
|
||||
this.chkC2C.Text = "Clipboard";
|
||||
this.chkC2C.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(324, 182);
|
||||
this.Controls.Add(this.btnGetPassword);
|
||||
this.Controls.Add(this.chkC2C);
|
||||
this.Controls.Add(this.btnDelete);
|
||||
this.Controls.Add(this.cmbSite);
|
||||
this.Controls.Add(this.txtMasterPassword);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.txtPassword);
|
||||
this.Controls.Add(this.nudCounter);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.cmbType);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.txtUsername);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(800, 220);
|
||||
this.MinimumSize = new System.Drawing.Size(320, 220);
|
||||
this.Name = "frmMain";
|
||||
this.Text = "MasterPassword";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudCounter)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtUsername;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ComboBox cmbType;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.NumericUpDown nudCounter;
|
||||
private System.Windows.Forms.TextBox txtPassword;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtMasterPassword;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button btnGetPassword;
|
||||
private System.Windows.Forms.ComboBox cmbSite;
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.Windows.Forms.CheckBox chkC2C;
|
||||
}
|
||||
}
|
||||
|
||||
264
MasterPassword/CSharp/MasterPassword/frmMain.cs
Normal file
264
MasterPassword/CSharp/MasterPassword/frmMain.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
// MASTERPASSWORD FOR WINDOWS
|
||||
// --------------------------
|
||||
// Created by Michel Verhagen
|
||||
// Copyright (C)2014 GuruCE Limited
|
||||
//
|
||||
// Released under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||
//
|
||||
// Contains software provided by Maarten Billemont and used under the GPL v3 License.
|
||||
//
|
||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||
//
|
||||
// Contains software provided by Replicon Inc. and used under this license:
|
||||
//
|
||||
// Replicon.Cryptography.SCrypt
|
||||
// Copyright (c) 2012, Replicon Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
namespace MasterPassword
|
||||
{
|
||||
public partial class frmMain : Form
|
||||
{
|
||||
private const int PASSWORD_VISIBILITY_MS = 15 * 1000; // Show the password for 15 seconds, then remove from vision
|
||||
private Dictionary<string, MRUData> mruData = new Dictionary<string, MRUData>();
|
||||
private Timer timerVisibitlity = new Timer();
|
||||
public frmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
toolTip1.SetToolTip(btnDelete, "Delete site from list");
|
||||
|
||||
timerVisibitlity.Interval = PASSWORD_VISIBILITY_MS;
|
||||
timerVisibitlity.Tick += timerVisibitlity_Tick;
|
||||
|
||||
chkC2C.Checked = Properties.Settings.Default.c2c;
|
||||
|
||||
#region Test Case
|
||||
// Test case, should produce:
|
||||
// masterKeySalt ID: 8C-45-CA-48-46-73-5F-C7-29-ED-8B-52-E8-74-88-15-5E-18-56-B9-CD-CA-6D-FF-88-10-A6-E8-46-BE-ED-20
|
||||
// masterPassword Hex: 62-61-6E-61-6E-61-20-63-6F-6C-6F-72-65-64-20-64-75-63-6B-6C-69-6E-67
|
||||
// masterPassword ID: A7-20-D6-A4-20-75-33-DA-98-54-55-8B-15-3A-41-E0-55-AF-32-D9-EC-1F-2C-61-6F-90-8E-99-8E-50-37-2F
|
||||
// masterKey ID: AE-F3-B9-47-97-3D-21-19-4D-2D-34-28-D9-70-FE-88-5D-EB-62-B1-DA-A3-30-30-CF-AA-C4-05-6A-A6-36-33
|
||||
// seed from: hmac-sha256(masterKey, 'com.lyndir.masterpassword' | 00-00-00-15 | masterpasswordapp.com | 00-00-00-01)
|
||||
// sitePasswordInfo ID: 2A-CA-06-25-BA-02-3C-64-DB-2A-65-EF-03-C5-21-BB-E2-A2-88-EE-82-A1-9C-40-2E-C0-AF-AA-0F-85-EF-11
|
||||
// sitePasswordSeed ID: 60-71-19-F6-5D-F8-43-1A-5E-00-D8-61-39-A0-33-18-4D-21-56-C9-24-B3-BA-73-31-59-A0-BA-45-4C-E1-E6
|
||||
// type: MPElementTypeGeneratedLong, cipher: CvcvnoCvcvCvcc
|
||||
// class C, character D
|
||||
// class v, character o
|
||||
// class c, character r
|
||||
// class v, character a
|
||||
// class n, character 6
|
||||
// class o, character .
|
||||
// class C, character N
|
||||
// class v, character u
|
||||
// class c, character d
|
||||
// class v, character i
|
||||
// class C, character D
|
||||
// class v, character u
|
||||
// class c, character h
|
||||
// class c, character j
|
||||
// Dora6.NudiDuhj
|
||||
//MasterPassword.Calculate("banana colored duckling", "Robert Lee Mitchel", "masterpasswordapp.com", 1, MasterPassword.MPType.Long);
|
||||
#endregion Test Case
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == NativeMethods.WM_SHOWME)
|
||||
ShowMe();
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
private void ShowMe()
|
||||
{
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
WindowState = FormWindowState.Normal;
|
||||
// Bring window on top of everything else
|
||||
TopMost = true;
|
||||
// And set it back to normal
|
||||
TopMost = false;
|
||||
}
|
||||
|
||||
void timerVisibitlity_Tick(object sender, EventArgs e)
|
||||
{
|
||||
timerVisibitlity.Stop();
|
||||
txtPassword.Text = "";
|
||||
}
|
||||
|
||||
private bool LoadMRU(string fileName)
|
||||
{
|
||||
bool retValue = false;
|
||||
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName, fileName);
|
||||
if (File.Exists(appDataPath))
|
||||
{
|
||||
mruData.Clear();
|
||||
string json = "";
|
||||
using (BinaryReader br = new BinaryReader(File.Open(appDataPath, FileMode.Open)))
|
||||
{
|
||||
byte[] encrypted = br.ReadBytes((int)new FileInfo(appDataPath).Length);
|
||||
br.Close();
|
||||
json = MasterPassword.Decrypt(txtMasterPassword.Text, encrypted);
|
||||
}
|
||||
if (json.Length > 0)
|
||||
{
|
||||
mruData = JsonConvert.DeserializeObject<Dictionary<string, MRUData>>(json);
|
||||
// Populate siteNames combo
|
||||
List<string> siteNames = new List<string>(mruData.Keys);
|
||||
cmbSite.Items.Clear();
|
||||
cmbSite.Items.AddRange(siteNames.ToArray());
|
||||
retValue = true;
|
||||
}
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
||||
private void SaveMRU(string fileName)
|
||||
{
|
||||
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName, fileName);
|
||||
string json = JsonConvert.SerializeObject(mruData);
|
||||
byte[] encrypted = MasterPassword.Encrypt(txtMasterPassword.Text, json);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(appDataPath));
|
||||
using (BinaryWriter bw = new BinaryWriter(File.Create(appDataPath)))
|
||||
{
|
||||
bw.Write(encrypted);
|
||||
bw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnGetPassword_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (txtUsername.Text.Length == 0)
|
||||
return;
|
||||
if (cmbSite.Text.Length == 0)
|
||||
return;
|
||||
if (cmbType.SelectedIndex == -1)
|
||||
cmbType.SelectedIndex = 0;
|
||||
txtPassword.Text = MasterPassword.Calculate(txtMasterPassword.Text, txtUsername.Text, cmbSite.Text, (int)nudCounter.Value, (MasterPassword.MPType)cmbType.SelectedIndex);
|
||||
if (chkC2C.Checked)
|
||||
Clipboard.SetText(txtPassword.Text);
|
||||
timerVisibitlity.Stop();
|
||||
timerVisibitlity.Start();
|
||||
if (mruData.ContainsKey(cmbSite.Text))
|
||||
{ // Update mruData
|
||||
mruData[cmbSite.Text].PasswordType = (MasterPassword.MPType)cmbType.SelectedIndex;
|
||||
mruData[cmbSite.Text].SiteCounter = (int)nudCounter.Value;
|
||||
mruData[cmbSite.Text].UserName = txtUsername.Text;
|
||||
}
|
||||
else
|
||||
{ // Add mruData
|
||||
mruData.Add(cmbSite.Text, new MRUData(txtUsername.Text, cmbSite.Text, (int)nudCounter.Value, (MasterPassword.MPType)cmbType.SelectedIndex));
|
||||
// And add to list
|
||||
cmbSite.Items.Add(cmbSite.Text);
|
||||
}
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
string fileTitle = MasterPassword.GetMasterPasswordKeySHA(txtMasterPassword.Text);
|
||||
if (fileTitle.Length > 0)
|
||||
{
|
||||
fileTitle = fileTitle.Replace("-", string.Empty);
|
||||
SaveMRU(fileTitle + ".dat");
|
||||
}
|
||||
Properties.Settings.Default.c2c = chkC2C.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void cmbSite_Check(object sender, EventArgs e)
|
||||
{
|
||||
if (mruData.ContainsKey(cmbSite.Text))
|
||||
{ // Update other fields to last used
|
||||
cmbType.SelectedIndex = (int)mruData[cmbSite.Text].PasswordType;
|
||||
nudCounter.Value = mruData[cmbSite.Text].SiteCounter;
|
||||
txtUsername.Text = mruData[cmbSite.Text].UserName;
|
||||
}
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
private void UpdateButtonStates()
|
||||
{
|
||||
if ((txtMasterPassword.Text.Length > 0) && (txtUsername.Text.Length > 0) && (cmbSite.Text.Length > 0) && (cmbType.SelectedIndex != -1))
|
||||
btnGetPassword.Enabled = true;
|
||||
else
|
||||
btnGetPassword.Enabled = false;
|
||||
btnDelete.Enabled = mruData.ContainsKey(cmbSite.Text);
|
||||
}
|
||||
|
||||
private void txtMasterPassword_Leave(object sender, EventArgs e)
|
||||
{
|
||||
string fileTitle = MasterPassword.GetMasterPasswordKeySHA(txtMasterPassword.Text);
|
||||
if (fileTitle.Length > 0)
|
||||
{
|
||||
fileTitle = fileTitle.Replace("-", string.Empty);
|
||||
if (LoadMRU(fileTitle + ".dat"))
|
||||
cmbSite.Focus();
|
||||
else
|
||||
{
|
||||
txtUsername.Text = "";
|
||||
txtPassword.Text = "";
|
||||
cmbSite.Text = "";
|
||||
cmbType.SelectedIndex = -1;
|
||||
cmbSite.Items.Clear();
|
||||
mruData.Clear();
|
||||
nudCounter.Value = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (mruData.ContainsKey(cmbSite.Text))
|
||||
{
|
||||
mruData.Remove(cmbSite.Text);
|
||||
int index = cmbSite.FindStringExact(cmbSite.Text);
|
||||
if (index != -1)
|
||||
cmbSite.Items.RemoveAt(index);
|
||||
cmbSite.Text = "";
|
||||
txtUsername.Text = "";
|
||||
txtPassword.Text = "";
|
||||
nudCounter.Value = 1;
|
||||
cmbType.SelectedIndex = -1;
|
||||
cmbSite.Focus();
|
||||
UpdateButtonStates();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtUsername_Leave(object sender, EventArgs e)
|
||||
{
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
private void cmbType_Leave(object sender, EventArgs e)
|
||||
{
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
private void nudCounter_Leave(object sender, EventArgs e)
|
||||
{
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
private void cmbSite_Enter(object sender, EventArgs e)
|
||||
{
|
||||
txtUsername.Text = "";
|
||||
cmbType.SelectedIndex = -1;
|
||||
nudCounter.Value = 1;
|
||||
txtPassword.Text = "";
|
||||
UpdateButtonStates();
|
||||
}
|
||||
|
||||
private void cmbType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateButtonStates();
|
||||
}
|
||||
}
|
||||
}
|
||||
3637
MasterPassword/CSharp/MasterPassword/frmMain.resx
Normal file
3637
MasterPassword/CSharp/MasterPassword/frmMain.resx
Normal file
File diff suppressed because it is too large
Load Diff
4
MasterPassword/CSharp/MasterPassword/packages.config
Normal file
4
MasterPassword/CSharp/MasterPassword/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" />
|
||||
</packages>
|
||||
BIN
MasterPassword/CSharp/delete.ico
Normal file
BIN
MasterPassword/CSharp/delete.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -16,10 +16,11 @@
|
||||
//
|
||||
|
||||
#import "MPKey.h"
|
||||
#import "MPElementStoredEntity.h"
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
#import "MPStoredSiteEntity.h"
|
||||
#import "MPGeneratedSiteEntity.h"
|
||||
#import "MPSiteQuestionEntity.h"
|
||||
|
||||
#define MPAlgorithmDefaultVersion 1
|
||||
#define MPAlgorithmDefaultVersion 2
|
||||
#define MPAlgorithmDefault MPAlgorithmForVersion(MPAlgorithmDefaultVersion)
|
||||
|
||||
id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version);
|
||||
@@ -43,49 +44,56 @@ NSString *NSStringFromTimeToCrack(TimeToCrack timeToCrack);
|
||||
|
||||
@required
|
||||
- (NSUInteger)version;
|
||||
- (BOOL)migrateUser:(MPUserEntity *)user inContext:(NSManagedObjectContext *)moc;
|
||||
- (BOOL)migrateElement:(MPElementEntity *)element explicit:(BOOL)explicit;
|
||||
- (BOOL)tryMigrateUser:(MPUserEntity *)user inContext:(NSManagedObjectContext *)moc;
|
||||
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit;
|
||||
|
||||
- (MPKey *)keyForPassword:(NSString *)password ofUserNamed:(NSString *)userName;
|
||||
- (MPKey *)keyFromKeyData:(NSData *)keyData;
|
||||
- (NSData *)keyIDForKeyData:(NSData *)keyData;
|
||||
|
||||
- (NSString *)scopeForVariant:(MPElementVariant)variant;
|
||||
- (NSString *)nameOfType:(MPElementType)type;
|
||||
- (NSString *)shortNameOfType:(MPElementType)type;
|
||||
- (NSString *)classNameOfType:(MPElementType)type;
|
||||
- (Class)classOfType:(MPElementType)type;
|
||||
- (NSString *)scopeForVariant:(MPSiteVariant)variant;
|
||||
- (NSString *)nameOfType:(MPSiteType)type;
|
||||
- (NSString *)shortNameOfType:(MPSiteType)type;
|
||||
- (NSString *)classNameOfType:(MPSiteType)type;
|
||||
- (Class)classOfType:(MPSiteType)type;
|
||||
- (NSArray *)allTypes;
|
||||
- (NSArray *)allTypesStartingWith:(MPElementType)startingType;
|
||||
- (MPElementType)nextType:(MPElementType)type;
|
||||
- (MPElementType)previousType:(MPElementType)type;
|
||||
- (NSArray *)allTypesStartingWith:(MPSiteType)startingType;
|
||||
- (MPSiteType)nextType:(MPSiteType)type;
|
||||
- (MPSiteType)previousType:(MPSiteType)type;
|
||||
|
||||
- (NSString *)generateLoginForSiteNamed:(NSString *)name usingKey:(MPKey *)key;
|
||||
- (NSString *)generatePasswordForSiteNamed:(NSString *)name ofType:(MPElementType)type withCounter:(NSUInteger)counter
|
||||
- (NSString *)generatePasswordForSiteNamed:(NSString *)name ofType:(MPSiteType)type withCounter:(NSUInteger)counter
|
||||
usingKey:(MPKey *)key;
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPElementType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPElementVariant)variant usingKey:(MPKey *)key;
|
||||
- (NSString *)generateAnswerForSiteNamed:(NSString *)name onQuestion:(NSString *)question usingKey:(MPKey *)key;
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPSiteType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPSiteVariant)variant context:(NSString *)context usingKey:(MPKey *)key;
|
||||
|
||||
- (NSString *)storedLoginForElement:(MPElementStoredEntity *)element usingKey:(MPKey *)key;
|
||||
- (NSString *)storedPasswordForElement:(MPElementStoredEntity *)element usingKey:(MPKey *)key;
|
||||
- (NSString *)storedLoginForSite:(MPStoredSiteEntity *)site usingKey:(MPKey *)key;
|
||||
- (NSString *)storedPasswordForSite:(MPStoredSiteEntity *)site usingKey:(MPKey *)key;
|
||||
|
||||
- (BOOL)savePassword:(NSString *)clearPassword toElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey;
|
||||
- (BOOL)savePassword:(NSString *)clearPassword toSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey;
|
||||
|
||||
- (NSString *)resolveLoginForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey;
|
||||
- (NSString *)resolvePasswordForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey;
|
||||
- (NSString *)resolveLoginForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey;
|
||||
- (NSString *)resolvePasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey;
|
||||
- (NSString *)resolveAnswerForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey;
|
||||
- (NSString *)resolveAnswerForQuestion:(MPSiteQuestionEntity *)question usingKey:(MPKey *)siteKey;
|
||||
|
||||
- (void)resolveLoginForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey
|
||||
- (void)resolveLoginForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey
|
||||
result:(void ( ^ )(NSString *result))resultBlock;
|
||||
- (void)resolvePasswordForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey
|
||||
- (void)resolvePasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey
|
||||
result:(void ( ^ )(NSString *result))resultBlock;
|
||||
- (void)resolveAnswerForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey
|
||||
result:(void ( ^ )(NSString *result))resultBlock;
|
||||
- (void)resolveAnswerForQuestion:(MPSiteQuestionEntity *)question usingKey:(MPKey *)siteKey
|
||||
result:(void ( ^ )(NSString *result))resultBlock;
|
||||
|
||||
- (void)importProtectedPassword:(NSString *)protectedPassword protectedByKey:(MPKey *)importKey
|
||||
intoElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey;
|
||||
- (void)importClearTextPassword:(NSString *)clearPassword intoElement:(MPElementEntity *)element
|
||||
usingKey:(MPKey *)elementKey;
|
||||
- (NSString *)exportPasswordForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey;
|
||||
intoSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey;
|
||||
- (void)importClearTextPassword:(NSString *)clearPassword intoSite:(MPSiteEntity *)site
|
||||
usingKey:(MPKey *)siteKey;
|
||||
- (NSString *)exportPasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey;
|
||||
|
||||
- (BOOL)timeToCrack:(out TimeToCrack *)timeToCrack passwordOfType:(MPElementType)type byAttacker:(MPAttacker)attacker;
|
||||
- (BOOL)timeToCrack:(out TimeToCrack *)timeToCrack passwordOfType:(MPSiteType)type byAttacker:(MPAttacker)attacker;
|
||||
- (BOOL)timeToCrack:(out TimeToCrack *)timeToCrack passwordString:(NSString *)password byAttacker:(MPAttacker)attacker;
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,7 +24,7 @@ id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version) {
|
||||
versionToAlgorithm = [NSMutableDictionary dictionary];
|
||||
|
||||
id<MPAlgorithm> algorithm = versionToAlgorithm[@(version)];
|
||||
if (!algorithm) if ((algorithm = [NSClassFromString( strf( @"MPAlgorithmV%lu", (unsigned long)version ) ) new]))
|
||||
if (!algorithm && (algorithm = (id<MPAlgorithm>)[NSClassFromString( strf( @"MPAlgorithmV%lu", (unsigned long)version ) ) new]))
|
||||
versionToAlgorithm[@(version)] = algorithm;
|
||||
|
||||
return algorithm;
|
||||
@@ -35,6 +35,9 @@ id<MPAlgorithm> MPAlgorithmDefaultForBundleVersion(NSString *bundleVersion) {
|
||||
if (PearlCFBundleVersionCompare( bundleVersion, @"1.3" ) == NSOrderedAscending)
|
||||
// Pre-1.3
|
||||
return MPAlgorithmForVersion( 0 );
|
||||
if (PearlCFBundleVersionCompare( bundleVersion, @"2.1" ) == NSOrderedAscending)
|
||||
// Pre-2.1
|
||||
return MPAlgorithmForVersion( 1 );
|
||||
|
||||
return MPAlgorithmDefault;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
@interface MPAlgorithmV0 : NSObject<MPAlgorithm>
|
||||
|
||||
- (NSDictionary *)allCiphers;
|
||||
- (NSArray *)ciphersForType:(MPElementType)type;
|
||||
- (NSArray *)ciphersForType:(MPSiteType)type;
|
||||
- (NSArray *)cipherClasses;
|
||||
- (NSArray *)cipherClassCharacters;
|
||||
- (NSString *)charactersForCipherClass:(NSString *)cipherClass;
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
#import "MPAlgorithmV0.h"
|
||||
#import "MPEntities.h"
|
||||
#import "MPAppDelegate_Shared.h"
|
||||
#import "MPAppDelegate_InApp.h"
|
||||
#import "MPSiteQuestionEntity.h"
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
@@ -70,40 +73,40 @@
|
||||
return [(id<MPAlgorithm>)other version] == [self version];
|
||||
}
|
||||
|
||||
- (BOOL)migrateUser:(MPUserEntity *)user inContext:(NSManagedObjectContext *)moc {
|
||||
- (BOOL)tryMigrateUser:(MPUserEntity *)user inContext:(NSManagedObjectContext *)moc {
|
||||
|
||||
NSError *error = nil;
|
||||
NSFetchRequest *migrationRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPElementEntity class] )];
|
||||
NSFetchRequest *migrationRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPSiteEntity class] )];
|
||||
migrationRequest.predicate = [NSPredicate predicateWithFormat:@"version_ < %d AND user == %@", self.version, user];
|
||||
NSArray *migrationElements = [moc executeFetchRequest:migrationRequest error:&error];
|
||||
if (!migrationElements) {
|
||||
err( @"While looking for elements to migrate: %@", error );
|
||||
NSArray *migrationSites = [moc executeFetchRequest:migrationRequest error:&error];
|
||||
if (!migrationSites) {
|
||||
err( @"While looking for sites to migrate: %@", [error fullDescription] );
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL requiresExplicitMigration = NO;
|
||||
for (MPElementEntity *migrationElement in migrationElements)
|
||||
if (![migrationElement migrateExplicitly:NO])
|
||||
requiresExplicitMigration = YES;
|
||||
BOOL success = YES;
|
||||
for (MPSiteEntity *migrationSite in migrationSites)
|
||||
if (![migrationSite tryMigrateExplicitly:NO])
|
||||
success = NO;
|
||||
|
||||
return requiresExplicitMigration;
|
||||
return success;
|
||||
}
|
||||
|
||||
- (BOOL)migrateElement:(MPElementEntity *)element explicit:(BOOL)explicit {
|
||||
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit {
|
||||
|
||||
if (element.version != [self version] - 1)
|
||||
if (site.version != [self version] - 1)
|
||||
// Only migrate from previous version.
|
||||
return NO;
|
||||
|
||||
if (!explicit) {
|
||||
// This migration requires explicit permission.
|
||||
element.requiresExplicitMigration = YES;
|
||||
site.requiresExplicitMigration = YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Apply migration.
|
||||
element.requiresExplicitMigration = NO;
|
||||
element.version = [self version];
|
||||
site.requiresExplicitMigration = NO;
|
||||
site.version = [self version];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -136,129 +139,140 @@
|
||||
return [keyData hashWith:MP_hash];
|
||||
}
|
||||
|
||||
- (NSString *)scopeForVariant:(MPElementVariant)variant {
|
||||
- (NSString *)scopeForVariant:(MPSiteVariant)variant {
|
||||
|
||||
switch (variant) {
|
||||
case MPElementVariantPassword:
|
||||
case MPSiteVariantPassword:
|
||||
return @"com.lyndir.masterpassword";
|
||||
case MPElementVariantLogin:
|
||||
case MPSiteVariantLogin:
|
||||
return @"com.lyndir.masterpassword.login";
|
||||
case MPSiteVariantAnswer:
|
||||
return @"com.lyndir.masterpassword.answer";
|
||||
}
|
||||
|
||||
Throw( @"Unsupported variant: %ld", (long)variant );
|
||||
}
|
||||
|
||||
- (NSString *)nameOfType:(MPElementType)type {
|
||||
- (NSString *)nameOfType:(MPSiteType)type {
|
||||
|
||||
if (!type)
|
||||
return nil;
|
||||
|
||||
switch (type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
return @"Maximum Security Password";
|
||||
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
return @"Long Password";
|
||||
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
return @"Medium Password";
|
||||
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
return @"Basic Password";
|
||||
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
return @"Short Password";
|
||||
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
return @"PIN";
|
||||
|
||||
case MPElementTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedName:
|
||||
return @"Login Name";
|
||||
|
||||
case MPElementTypeStoredPersonal:
|
||||
case MPSiteTypeGeneratedPhrase:
|
||||
return @"Phrase";
|
||||
|
||||
case MPSiteTypeStoredPersonal:
|
||||
return @"Personal Password";
|
||||
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
case MPSiteTypeStoredDevicePrivate:
|
||||
return @"Device Private Password";
|
||||
}
|
||||
|
||||
Throw( @"Type not supported: %lu", (long)type );
|
||||
}
|
||||
|
||||
- (NSString *)shortNameOfType:(MPElementType)type {
|
||||
- (NSString *)shortNameOfType:(MPSiteType)type {
|
||||
|
||||
if (!type)
|
||||
return nil;
|
||||
|
||||
switch (type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
return @"Maximum";
|
||||
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
return @"Long";
|
||||
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
return @"Medium";
|
||||
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
return @"Basic";
|
||||
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
return @"Short";
|
||||
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
return @"PIN";
|
||||
|
||||
case MPElementTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedName:
|
||||
return @"Name";
|
||||
|
||||
case MPElementTypeStoredPersonal:
|
||||
case MPSiteTypeGeneratedPhrase:
|
||||
return @"Phrase";
|
||||
|
||||
case MPSiteTypeStoredPersonal:
|
||||
return @"Personal";
|
||||
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
case MPSiteTypeStoredDevicePrivate:
|
||||
return @"Device";
|
||||
}
|
||||
|
||||
Throw( @"Type not supported: %lu", (long)type );
|
||||
}
|
||||
|
||||
- (NSString *)classNameOfType:(MPElementType)type {
|
||||
- (NSString *)classNameOfType:(MPSiteType)type {
|
||||
|
||||
return NSStringFromClass( [self classOfType:type] );
|
||||
}
|
||||
|
||||
- (Class)classOfType:(MPElementType)type {
|
||||
- (Class)classOfType:(MPSiteType)type {
|
||||
|
||||
if (!type)
|
||||
Throw( @"No type given." );
|
||||
|
||||
switch (type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeGeneratedLong:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedLong:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeGeneratedMedium:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeGeneratedBasic:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeGeneratedShort:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedShort:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeGeneratedPIN:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeGeneratedName:
|
||||
return [MPElementGeneratedEntity class];
|
||||
case MPSiteTypeGeneratedName:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeStoredPersonal:
|
||||
return [MPElementStoredEntity class];
|
||||
case MPSiteTypeGeneratedPhrase:
|
||||
return [MPGeneratedSiteEntity class];
|
||||
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
return [MPElementStoredEntity class];
|
||||
case MPSiteTypeStoredPersonal:
|
||||
return [MPStoredSiteEntity class];
|
||||
|
||||
case MPSiteTypeStoredDevicePrivate:
|
||||
return [MPStoredSiteEntity class];
|
||||
}
|
||||
|
||||
Throw( @"Type not supported: %lu", (long)type );
|
||||
@@ -266,13 +280,13 @@
|
||||
|
||||
- (NSArray *)allTypes {
|
||||
|
||||
return [self allTypesStartingWith:MPElementTypeGeneratedMaximum];
|
||||
return [self allTypesStartingWith:MPSiteTypeGeneratedMaximum];
|
||||
}
|
||||
|
||||
- (NSArray *)allTypesStartingWith:(MPElementType)startingType {
|
||||
- (NSArray *)allTypesStartingWith:(MPSiteType)startingType {
|
||||
|
||||
NSMutableArray *allTypes = [[NSMutableArray alloc] initWithCapacity:8];
|
||||
MPElementType currentType = startingType;
|
||||
MPSiteType currentType = startingType;
|
||||
do {
|
||||
[allTypes addObject:@(currentType)];
|
||||
} while ((currentType = [self nextType:currentType]) != startingType);
|
||||
@@ -280,33 +294,33 @@
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
- (MPElementType)nextType:(MPElementType)type {
|
||||
- (MPSiteType)nextType:(MPSiteType)type {
|
||||
|
||||
switch (type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
return MPElementTypeGeneratedLong;
|
||||
case MPElementTypeGeneratedLong:
|
||||
return MPElementTypeGeneratedMedium;
|
||||
case MPElementTypeGeneratedMedium:
|
||||
return MPElementTypeGeneratedBasic;
|
||||
case MPElementTypeGeneratedBasic:
|
||||
return MPElementTypeGeneratedShort;
|
||||
case MPElementTypeGeneratedShort:
|
||||
return MPElementTypeGeneratedPIN;
|
||||
case MPElementTypeGeneratedPIN:
|
||||
return MPElementTypeStoredPersonal;
|
||||
case MPElementTypeStoredPersonal:
|
||||
return MPElementTypeStoredDevicePrivate;
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
return MPElementTypeGeneratedMaximum;
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
return MPSiteTypeGeneratedLong;
|
||||
case MPSiteTypeGeneratedLong:
|
||||
return MPSiteTypeGeneratedMedium;
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
return MPSiteTypeGeneratedBasic;
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
return MPSiteTypeGeneratedShort;
|
||||
case MPSiteTypeGeneratedShort:
|
||||
return MPSiteTypeGeneratedPIN;
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
return MPSiteTypeStoredPersonal;
|
||||
case MPSiteTypeStoredPersonal:
|
||||
return MPSiteTypeStoredDevicePrivate;
|
||||
case MPSiteTypeStoredDevicePrivate:
|
||||
return MPSiteTypeGeneratedMaximum;
|
||||
default:
|
||||
return MPElementTypeGeneratedLong;
|
||||
return MPSiteTypeGeneratedLong;
|
||||
}
|
||||
}
|
||||
|
||||
- (MPElementType)previousType:(MPElementType)type {
|
||||
- (MPSiteType)previousType:(MPSiteType)type {
|
||||
|
||||
MPElementType previousType = type, nextType = type;
|
||||
MPSiteType previousType = type, nextType = type;
|
||||
while ((nextType = [self nextType:nextType]) != type)
|
||||
previousType = nextType;
|
||||
|
||||
@@ -325,7 +339,7 @@
|
||||
return ciphers;
|
||||
}
|
||||
|
||||
- (NSArray *)ciphersForType:(MPElementType)type {
|
||||
- (NSArray *)ciphersForType:(MPSiteType)type {
|
||||
|
||||
NSString *typeClass = [self classNameOfType:type];
|
||||
NSString *typeName = [self nameOfType:type];
|
||||
@@ -349,42 +363,51 @@
|
||||
|
||||
- (NSString *)generateLoginForSiteNamed:(NSString *)name usingKey:(MPKey *)key {
|
||||
|
||||
return [self generateContentForSiteNamed:name ofType:MPElementTypeGeneratedName withCounter:1
|
||||
variant:MPElementVariantLogin usingKey:key];
|
||||
return [self generateContentForSiteNamed:name ofType:MPSiteTypeGeneratedName withCounter:1
|
||||
variant:MPSiteVariantLogin context:nil usingKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)generatePasswordForSiteNamed:(NSString *)name ofType:(MPElementType)type withCounter:(NSUInteger)counter
|
||||
- (NSString *)generatePasswordForSiteNamed:(NSString *)name ofType:(MPSiteType)type withCounter:(NSUInteger)counter
|
||||
usingKey:(MPKey *)key {
|
||||
|
||||
return [self generateContentForSiteNamed:name ofType:type withCounter:counter
|
||||
variant:MPElementVariantPassword usingKey:key];
|
||||
variant:MPSiteVariantPassword context:nil usingKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPElementType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPElementVariant)variant usingKey:(MPKey *)key {
|
||||
- (NSString *)generateAnswerForSiteNamed:(NSString *)name onQuestion:(NSString *)question usingKey:(MPKey *)key {
|
||||
|
||||
return [self generateContentForSiteNamed:name ofType:MPSiteTypeGeneratedPhrase withCounter:1
|
||||
variant:MPSiteVariantAnswer context:question usingKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPSiteType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPSiteVariant)variant context:(NSString *)context usingKey:(MPKey *)key {
|
||||
|
||||
// Determine the seed whose bytes will be used for calculating a password
|
||||
uint32_t ncounter = htonl( counter ), nnameLength = htonl( name.length );
|
||||
uint32_t ncounter = htonl( counter ), nnameLength = htonl( name.length ), ncontextLength = htonl( context.length );
|
||||
NSData *counterBytes = [NSData dataWithBytes:&ncounter length:sizeof( ncounter )];
|
||||
NSData *nameLengthBytes = [NSData dataWithBytes:&nnameLength length:sizeof( nnameLength )];
|
||||
NSString *scope = [self scopeForVariant:variant];;
|
||||
trc( @"seed from: hmac-sha256(%@, %@ | %@ | %@ | %@)",
|
||||
[key.keyData encodeBase64], scope, [nameLengthBytes encodeHex], name, [counterBytes encodeHex] );
|
||||
NSData *contextLengthBytes = [NSData dataWithBytes:&ncontextLength length:sizeof( ncontextLength )];
|
||||
NSString *scope = [self scopeForVariant:variant];
|
||||
trc( @"seed from: hmac-sha256(%@, %@ | %@ | %@ | %@ | %@)",
|
||||
[[key keyID] encodeHex], scope, [nameLengthBytes encodeHex], name, [counterBytes encodeHex], context );
|
||||
NSData *seed = [[NSData dataByConcatenatingDatas:
|
||||
[scope dataUsingEncoding:NSUTF8StringEncoding],
|
||||
nameLengthBytes,
|
||||
[name dataUsingEncoding:NSUTF8StringEncoding],
|
||||
counterBytes,
|
||||
context? contextLengthBytes: nil,
|
||||
[context dataUsingEncoding:NSUTF8StringEncoding],
|
||||
nil]
|
||||
hmacWith:PearlHashSHA256 key:key.keyData];
|
||||
trc( @"seed is: %@", [seed encodeBase64] );
|
||||
trc( @"seed is: %@", [seed encodeHex] );
|
||||
const char *seedBytes = seed.bytes;
|
||||
|
||||
// Determine the cipher from the first seed byte.
|
||||
NSAssert( [seed length], @"Missing seed." );
|
||||
NSArray *typeCiphers = [self ciphersForType:type];
|
||||
NSString *cipher = typeCiphers[htons( seedBytes[0] ) % [typeCiphers count]];
|
||||
trc( @"type %@, ciphers: %@, selected: %@", [self nameOfType:type], typeCiphers, cipher );
|
||||
trc( @"type %@ (%lu), ciphers: %@, selected: %@", [self nameOfType:type], (unsigned long)type, typeCiphers, cipher );
|
||||
|
||||
// Encode the content, character by character, using subsequent seed bytes and the cipher.
|
||||
NSAssert( [seed length] >= [cipher length] + 1, @"Insufficient seed bytes to encode cipher." );
|
||||
@@ -402,79 +425,80 @@
|
||||
return content;
|
||||
}
|
||||
|
||||
- (NSString *)storedLoginForElement:(MPElementStoredEntity *)element usingKey:(MPKey *)key {
|
||||
- (NSString *)storedLoginForSite:(MPStoredSiteEntity *)site usingKey:(MPKey *)key {
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)storedPasswordForElement:(MPElementStoredEntity *)element usingKey:(MPKey *)key {
|
||||
- (NSString *)storedPasswordForSite:(MPStoredSiteEntity *)site usingKey:(MPKey *)key {
|
||||
|
||||
return [self decryptContent:element.contentObject usingKey:key];
|
||||
return [self decryptContent:site.contentObject usingKey:key];
|
||||
}
|
||||
|
||||
- (BOOL)savePassword:(NSString *)clearContent toElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey {
|
||||
- (BOOL)savePassword:(NSString *)clearContent toSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
NSAssert( [elementKey.keyID isEqualToData:element.user.keyID], @"Element does not belong to current user." );
|
||||
switch (element.type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPElementTypeGeneratedName: {
|
||||
NSAssert( NO, @"Cannot save content to element with generated type %lu.", (long)element.type );
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
switch (site.type) {
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedPhrase: {
|
||||
wrn( @"Cannot save content to site with generated type %lu.", (long)site.type );
|
||||
return NO;
|
||||
}
|
||||
|
||||
case MPElementTypeStoredPersonal: {
|
||||
if (![element isKindOfClass:[MPElementStoredEntity class]]) {
|
||||
wrn( @"Element with stored type %lu is not an MPElementStoredEntity, but a %@.",
|
||||
(long)element.type, [element class] );
|
||||
case MPSiteTypeStoredPersonal: {
|
||||
if (![site isKindOfClass:[MPStoredSiteEntity class]]) {
|
||||
wrn( @"Site with stored type %lu is not an MPStoredSiteEntity, but a %@.",
|
||||
(long)site.type, [site class] );
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSData *encryptedContent = [[clearContent dataUsingEncoding:NSUTF8StringEncoding]
|
||||
encryptWithSymmetricKey:[elementKey subKeyOfLength:PearlCryptKeySize].keyData padding:YES];
|
||||
if ([((MPElementStoredEntity *)element).contentObject isEqualToData:encryptedContent])
|
||||
encryptWithSymmetricKey:[siteKey subKeyOfLength:PearlCryptKeySize].keyData padding:YES];
|
||||
if ([((MPStoredSiteEntity *)site).contentObject isEqualToData:encryptedContent])
|
||||
return NO;
|
||||
|
||||
((MPElementStoredEntity *)element).contentObject = encryptedContent;
|
||||
((MPStoredSiteEntity *)site).contentObject = encryptedContent;
|
||||
return YES;
|
||||
}
|
||||
case MPElementTypeStoredDevicePrivate: {
|
||||
if (![element isKindOfClass:[MPElementStoredEntity class]]) {
|
||||
wrn( @"Element with stored type %lu is not an MPElementStoredEntity, but a %@.",
|
||||
(long)element.type, [element class] );
|
||||
case MPSiteTypeStoredDevicePrivate: {
|
||||
if (![site isKindOfClass:[MPStoredSiteEntity class]]) {
|
||||
wrn( @"Site with stored type %lu is not an MPStoredSiteEntity, but a %@.",
|
||||
(long)site.type, [site class] );
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSData *encryptedContent = [[clearContent dataUsingEncoding:NSUTF8StringEncoding]
|
||||
encryptWithSymmetricKey:[elementKey subKeyOfLength:PearlCryptKeySize].keyData padding:YES];
|
||||
NSDictionary *elementQuery = [self queryForDevicePrivateElementNamed:element.name];
|
||||
encryptWithSymmetricKey:[siteKey subKeyOfLength:PearlCryptKeySize].keyData padding:YES];
|
||||
NSDictionary *siteQuery = [self queryForDevicePrivateSiteNamed:site.name];
|
||||
if (!encryptedContent)
|
||||
[PearlKeyChain deleteItemForQuery:elementQuery];
|
||||
[PearlKeyChain deleteItemForQuery:siteQuery];
|
||||
else
|
||||
[PearlKeyChain addOrUpdateItemForQuery:elementQuery withAttributes:@{
|
||||
[PearlKeyChain addOrUpdateItemForQuery:siteQuery withAttributes:@{
|
||||
(__bridge id)kSecValueData : encryptedContent,
|
||||
#if TARGET_OS_IPHONE
|
||||
(__bridge id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
|
||||
#endif
|
||||
}];
|
||||
((MPElementStoredEntity *)element).contentObject = nil;
|
||||
((MPStoredSiteEntity *)site).contentObject = nil;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
Throw( @"Unsupported type: %ld", (long)element.type );
|
||||
Throw( @"Unsupported type: %ld", (long)site.type );
|
||||
}
|
||||
|
||||
- (NSString *)resolveLoginForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey {
|
||||
- (NSString *)resolveLoginForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
dispatch_group_enter( group );
|
||||
__block NSString *result = nil;
|
||||
[self resolveLoginForElement:element usingKey:elementKey result:^(NSString *result_) {
|
||||
[self resolveLoginForSite:site usingKey:siteKey result:^(NSString *result_) {
|
||||
result = result_;
|
||||
dispatch_group_leave( group );
|
||||
}];
|
||||
@@ -483,12 +507,12 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)resolvePasswordForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey {
|
||||
- (NSString *)resolvePasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
dispatch_group_enter( group );
|
||||
__block NSString *result = nil;
|
||||
[self resolvePasswordForElement:element usingKey:elementKey result:^(NSString *result_) {
|
||||
[self resolvePasswordForSite:site usingKey:siteKey result:^(NSString *result_) {
|
||||
result = result_;
|
||||
dispatch_group_leave( group );
|
||||
}];
|
||||
@@ -497,88 +521,117 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)resolveLoginForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey result:(void ( ^ )(NSString *result))resultBlock {
|
||||
- (NSString *)resolveAnswerForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
NSAssert( [elementKey.keyID isEqualToData:element.user.keyID], @"Element does not belong to current user." );
|
||||
NSString *name = element.name;
|
||||
BOOL loginGenerated = element.loginGenerated;
|
||||
NSString *loginName = loginGenerated? nil: element.loginName;
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
dispatch_group_enter( group );
|
||||
__block NSString *result = nil;
|
||||
[self resolveAnswerForSite:site usingKey:siteKey result:^(NSString *result_) {
|
||||
result = result_;
|
||||
dispatch_group_leave( group );
|
||||
}];
|
||||
dispatch_group_wait( group, DISPATCH_TIME_FOREVER );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)resolveAnswerForQuestion:(MPSiteQuestionEntity *)question usingKey:(MPKey *)siteKey {
|
||||
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
dispatch_group_enter( group );
|
||||
__block NSString *result = nil;
|
||||
[self resolveAnswerForQuestion:question usingKey:siteKey result:^(NSString *result_) {
|
||||
result = result_;
|
||||
dispatch_group_leave( group );
|
||||
}];
|
||||
dispatch_group_wait( group, DISPATCH_TIME_FOREVER );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)resolveLoginForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey result:(void ( ^ )(NSString *result))resultBlock {
|
||||
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
NSString *name = site.name;
|
||||
BOOL loginGenerated = site.loginGenerated && [[MPAppDelegate_Shared get] isFeatureUnlocked:MPProductGenerateLogins];
|
||||
NSString *loginName = loginGenerated? nil: site.loginName;
|
||||
id<MPAlgorithm> algorithm = nil;
|
||||
if (!name.length)
|
||||
err( @"Missing name." );
|
||||
else if (!elementKey.keyData.length)
|
||||
else if (!siteKey.keyData.length)
|
||||
err( @"Missing key." );
|
||||
else
|
||||
algorithm = element.algorithm;
|
||||
algorithm = site.algorithm;
|
||||
|
||||
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
|
||||
if (loginGenerated)
|
||||
resultBlock( [algorithm generateLoginForSiteNamed:name usingKey:elementKey] );
|
||||
resultBlock( [algorithm generateLoginForSiteNamed:name usingKey:siteKey] );
|
||||
else
|
||||
resultBlock( loginName );
|
||||
} );
|
||||
}
|
||||
|
||||
- (void)resolvePasswordForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey result:(void ( ^ )(NSString *result))resultBlock {
|
||||
- (void)resolvePasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey result:(void ( ^ )(NSString *result))resultBlock {
|
||||
|
||||
NSAssert( [elementKey.keyID isEqualToData:element.user.keyID], @"Element does not belong to current user." );
|
||||
switch (element.type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPElementTypeGeneratedName: {
|
||||
if (![element isKindOfClass:[MPElementGeneratedEntity class]]) {
|
||||
wrn( @"Element with generated type %lu is not an MPElementGeneratedEntity, but a %@.",
|
||||
(long)element.type, [element class] );
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
switch (site.type) {
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedPhrase: {
|
||||
if (![site isKindOfClass:[MPGeneratedSiteEntity class]]) {
|
||||
wrn( @"Site with generated type %lu is not an MPGeneratedSiteEntity, but a %@.",
|
||||
(long)site.type, [site class] );
|
||||
break;
|
||||
}
|
||||
|
||||
NSString *name = element.name;
|
||||
MPElementType type = element.type;
|
||||
NSUInteger counter = ((MPElementGeneratedEntity *)element).counter;
|
||||
NSString *name = site.name;
|
||||
MPSiteType type = site.type;
|
||||
NSUInteger counter = ((MPGeneratedSiteEntity *)site).counter;
|
||||
id<MPAlgorithm> algorithm = nil;
|
||||
if (!element.name.length)
|
||||
if (!site.name.length)
|
||||
err( @"Missing name." );
|
||||
else if (!elementKey.keyData.length)
|
||||
else if (!siteKey.keyData.length)
|
||||
err( @"Missing key." );
|
||||
else
|
||||
algorithm = element.algorithm;
|
||||
algorithm = site.algorithm;
|
||||
|
||||
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
|
||||
NSString *result = [algorithm generatePasswordForSiteNamed:name ofType:type withCounter:counter usingKey:elementKey];
|
||||
NSString *result = [algorithm generatePasswordForSiteNamed:name ofType:type withCounter:counter usingKey:siteKey];
|
||||
resultBlock( result );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementTypeStoredPersonal: {
|
||||
if (![element isKindOfClass:[MPElementStoredEntity class]]) {
|
||||
wrn( @"Element with stored type %lu is not an MPElementStoredEntity, but a %@.",
|
||||
(long)element.type, [element class] );
|
||||
case MPSiteTypeStoredPersonal: {
|
||||
if (![site isKindOfClass:[MPStoredSiteEntity class]]) {
|
||||
wrn( @"Site with stored type %lu is not an MPStoredSiteEntity, but a %@.",
|
||||
(long)site.type, [site class] );
|
||||
break;
|
||||
}
|
||||
|
||||
NSData *encryptedContent = ((MPElementStoredEntity *)element).contentObject;
|
||||
NSData *encryptedContent = ((MPStoredSiteEntity *)site).contentObject;
|
||||
|
||||
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
|
||||
NSString *result = [self decryptContent:encryptedContent usingKey:elementKey];
|
||||
NSString *result = [self decryptContent:encryptedContent usingKey:siteKey];
|
||||
resultBlock( result );
|
||||
} );
|
||||
break;
|
||||
}
|
||||
case MPElementTypeStoredDevicePrivate: {
|
||||
NSAssert( [element isKindOfClass:[MPElementStoredEntity class]],
|
||||
@"Element with stored type %lu is not an MPElementStoredEntity, but a %@.", (long)element.type,
|
||||
[element class] );
|
||||
case MPSiteTypeStoredDevicePrivate: {
|
||||
NSAssert( [site isKindOfClass:[MPStoredSiteEntity class]],
|
||||
@"Site with stored type %lu is not an MPStoredSiteEntity, but a %@.", (long)site.type,
|
||||
[site class] );
|
||||
|
||||
NSDictionary *elementQuery = [self queryForDevicePrivateElementNamed:element.name];
|
||||
NSData *encryptedContent = [PearlKeyChain dataOfItemForQuery:elementQuery];
|
||||
NSDictionary *siteQuery = [self queryForDevicePrivateSiteNamed:site.name];
|
||||
NSData *encryptedContent = [PearlKeyChain dataOfItemForQuery:siteQuery];
|
||||
|
||||
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
|
||||
NSString *result = [self decryptContent:encryptedContent usingKey:elementKey];
|
||||
NSString *result = [self decryptContent:encryptedContent usingKey:siteKey];
|
||||
resultBlock( result );
|
||||
} );
|
||||
break;
|
||||
@@ -586,94 +639,135 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)resolveAnswerForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey result:(void ( ^ )(NSString *result))resultBlock {
|
||||
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
NSString *name = site.name;
|
||||
id<MPAlgorithm> algorithm = nil;
|
||||
if (!site.name.length)
|
||||
err( @"Missing name." );
|
||||
else if (!siteKey.keyData.length)
|
||||
err( @"Missing key." );
|
||||
else
|
||||
algorithm = site.algorithm;
|
||||
|
||||
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
|
||||
NSString *result = [algorithm generateAnswerForSiteNamed:name onQuestion:nil usingKey:siteKey];
|
||||
resultBlock( result );
|
||||
} );
|
||||
}
|
||||
|
||||
- (void)resolveAnswerForQuestion:(MPSiteQuestionEntity *)question usingKey:(MPKey *)siteKey
|
||||
result:(void ( ^ )(NSString *result))resultBlock {
|
||||
|
||||
NSAssert( [siteKey.keyID isEqualToData:question.site.user.keyID], @"Site does not belong to current user." );
|
||||
NSString *name = question.site.name;
|
||||
NSString *keyword = question.keyword;
|
||||
id<MPAlgorithm> algorithm = nil;
|
||||
if (!name.length)
|
||||
err( @"Missing name." );
|
||||
else if (!siteKey.keyData.length)
|
||||
err( @"Missing key." );
|
||||
else
|
||||
algorithm = question.site.algorithm;
|
||||
|
||||
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
|
||||
NSString *result = [algorithm generateAnswerForSiteNamed:name onQuestion:keyword usingKey:siteKey];
|
||||
resultBlock( result );
|
||||
} );
|
||||
}
|
||||
|
||||
- (void)importProtectedPassword:(NSString *)protectedContent protectedByKey:(MPKey *)importKey
|
||||
intoElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey {
|
||||
intoSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
NSAssert( [elementKey.keyID isEqualToData:element.user.keyID], @"Element does not belong to current user." );
|
||||
switch (element.type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPElementTypeGeneratedName:
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
switch (site.type) {
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedPhrase:
|
||||
break;
|
||||
|
||||
case MPElementTypeStoredPersonal: {
|
||||
if (![element isKindOfClass:[MPElementStoredEntity class]]) {
|
||||
wrn( @"Element with stored type %lu is not an MPElementStoredEntity, but a %@.",
|
||||
(long)element.type, [element class] );
|
||||
case MPSiteTypeStoredPersonal: {
|
||||
if (![site isKindOfClass:[MPStoredSiteEntity class]]) {
|
||||
wrn( @"Site with stored type %lu is not an MPStoredSiteEntity, but a %@.",
|
||||
(long)site.type, [site class] );
|
||||
break;
|
||||
}
|
||||
if ([importKey.keyID isEqualToData:elementKey.keyID])
|
||||
((MPElementStoredEntity *)element).contentObject = [protectedContent decodeBase64];
|
||||
if ([importKey.keyID isEqualToData:siteKey.keyID])
|
||||
((MPStoredSiteEntity *)site).contentObject = [protectedContent decodeBase64];
|
||||
|
||||
else {
|
||||
NSString *clearContent = [self decryptContent:[protectedContent decodeBase64] usingKey:importKey];
|
||||
[self importClearTextPassword:clearContent intoElement:element usingKey:elementKey];
|
||||
[self importClearTextPassword:clearContent intoSite:site usingKey:siteKey];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
case MPSiteTypeStoredDevicePrivate:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)importClearTextPassword:(NSString *)clearContent intoElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey {
|
||||
- (void)importClearTextPassword:(NSString *)clearContent intoSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
NSAssert( [elementKey.keyID isEqualToData:element.user.keyID], @"Element does not belong to current user." );
|
||||
switch (element.type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPElementTypeGeneratedName:
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
switch (site.type) {
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedPhrase:
|
||||
break;
|
||||
|
||||
case MPElementTypeStoredPersonal: {
|
||||
[self savePassword:clearContent toElement:element usingKey:elementKey];
|
||||
case MPSiteTypeStoredPersonal: {
|
||||
[self savePassword:clearContent toSite:site usingKey:siteKey];
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementTypeStoredDevicePrivate:
|
||||
case MPSiteTypeStoredDevicePrivate:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)exportPasswordForElement:(MPElementEntity *)element usingKey:(MPKey *)elementKey {
|
||||
- (NSString *)exportPasswordForSite:(MPSiteEntity *)site usingKey:(MPKey *)siteKey {
|
||||
|
||||
NSAssert( [elementKey.keyID isEqualToData:element.user.keyID], @"Element does not belong to current user." );
|
||||
if (!(element.type & MPElementFeatureExportContent))
|
||||
NSAssert( [siteKey.keyID isEqualToData:site.user.keyID], @"Site does not belong to current user." );
|
||||
if (!(site.type & MPSiteFeatureExportContent))
|
||||
return nil;
|
||||
|
||||
NSString *result = nil;
|
||||
switch (element.type) {
|
||||
case MPElementTypeGeneratedMaximum:
|
||||
case MPElementTypeGeneratedLong:
|
||||
case MPElementTypeGeneratedMedium:
|
||||
case MPElementTypeGeneratedBasic:
|
||||
case MPElementTypeGeneratedShort:
|
||||
case MPElementTypeGeneratedPIN:
|
||||
case MPElementTypeGeneratedName: {
|
||||
switch (site.type) {
|
||||
case MPSiteTypeGeneratedMaximum:
|
||||
case MPSiteTypeGeneratedLong:
|
||||
case MPSiteTypeGeneratedMedium:
|
||||
case MPSiteTypeGeneratedBasic:
|
||||
case MPSiteTypeGeneratedShort:
|
||||
case MPSiteTypeGeneratedPIN:
|
||||
case MPSiteTypeGeneratedName:
|
||||
case MPSiteTypeGeneratedPhrase: {
|
||||
result = nil;
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementTypeStoredPersonal: {
|
||||
if (![element isKindOfClass:[MPElementStoredEntity class]]) {
|
||||
wrn( @"Element with stored type %lu is not an MPElementStoredEntity, but a %@.",
|
||||
(long)element.type, [element class] );
|
||||
case MPSiteTypeStoredPersonal: {
|
||||
if (![site isKindOfClass:[MPStoredSiteEntity class]]) {
|
||||
wrn( @"Site with stored type %lu is not an MPStoredSiteEntity, but a %@.",
|
||||
(long)site.type, [site class] );
|
||||
break;
|
||||
}
|
||||
result = [((MPElementStoredEntity *)element).contentObject encodeBase64];
|
||||
result = [((MPStoredSiteEntity *)site).contentObject encodeBase64];
|
||||
break;
|
||||
}
|
||||
|
||||
case MPElementTypeStoredDevicePrivate: {
|
||||
case MPSiteTypeStoredDevicePrivate: {
|
||||
result = nil;
|
||||
break;
|
||||
}
|
||||
@@ -687,7 +781,7 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSDictionary *)queryForDevicePrivateElementNamed:(NSString *)name {
|
||||
- (NSDictionary *)queryForDevicePrivateSiteNamed:(NSString *)name {
|
||||
|
||||
return [PearlKeyChain createQueryForClass:kSecClassGenericPassword
|
||||
attributes:@{
|
||||
@@ -708,7 +802,7 @@
|
||||
return [[NSString alloc] initWithBytes:decryptedContent.bytes length:decryptedContent.length encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
- (BOOL)timeToCrack:(out TimeToCrack *)timeToCrack passwordOfType:(MPElementType)type byAttacker:(MPAttacker)attacker {
|
||||
- (BOOL)timeToCrack:(out TimeToCrack *)timeToCrack passwordOfType:(MPSiteType)type byAttacker:(MPAttacker)attacker {
|
||||
|
||||
if (!type)
|
||||
return NO;
|
||||
|
||||
@@ -25,33 +25,34 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (BOOL)migrateElement:(MPElementEntity *)element explicit:(BOOL)explicit {
|
||||
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit {
|
||||
|
||||
if (element.version != [self version] - 1)
|
||||
if (site.version != [self version] - 1)
|
||||
// Only migrate from previous version.
|
||||
return NO;
|
||||
|
||||
if (!explicit) {
|
||||
if (element.type & MPElementTypeClassGenerated) {
|
||||
if (site.type & MPSiteTypeClassGenerated) {
|
||||
// This migration requires explicit permission for types of the generated class.
|
||||
element.requiresExplicitMigration = YES;
|
||||
site.requiresExplicitMigration = YES;
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply migration.
|
||||
element.requiresExplicitMigration = NO;
|
||||
element.version = [self version];
|
||||
site.requiresExplicitMigration = NO;
|
||||
site.version = [self version];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPElementType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPElementVariant)variant usingKey:(MPKey *)key {
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPSiteType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPSiteVariant)variant context:(NSString *)context usingKey:(MPKey *)key {
|
||||
|
||||
// Determine the seed whose bytes will be used for calculating a password
|
||||
uint32_t ncounter = htonl( counter ), nnameLength = htonl( name.length );
|
||||
uint32_t ncounter = htonl( counter ), nnameLength = htonl( name.length ), ncontextLength = htonl( context.length );
|
||||
NSData *counterBytes = [NSData dataWithBytes:&ncounter length:sizeof( ncounter )];
|
||||
NSData *nameLengthBytes = [NSData dataWithBytes:&nnameLength length:sizeof( nnameLength )];
|
||||
NSData *contextLengthBytes = [NSData dataWithBytes:&ncontextLength length:sizeof( ncontextLength )];
|
||||
NSString *scope = [self scopeForVariant:variant];
|
||||
trc( @"seed from: hmac-sha256(%@, %@ | %@ | %@ | %@)",
|
||||
[[key keyID] encodeHex], scope, [nameLengthBytes encodeHex], name, [counterBytes encodeHex] );
|
||||
@@ -60,6 +61,8 @@
|
||||
nameLengthBytes,
|
||||
[name dataUsingEncoding:NSUTF8StringEncoding],
|
||||
counterBytes,
|
||||
context? contextLengthBytes: nil,
|
||||
[context dataUsingEncoding:NSUTF8StringEncoding],
|
||||
nil]
|
||||
hmacWith:PearlHashSHA256 key:key.keyData];
|
||||
trc( @"seed is: %@", [seed encodeHex] );
|
||||
@@ -69,7 +72,7 @@
|
||||
NSAssert( [seed length], @"Missing seed." );
|
||||
NSArray *typeCiphers = [self ciphersForType:type];
|
||||
NSString *cipher = typeCiphers[seedBytes[0] % [typeCiphers count]];
|
||||
trc( @"type %@ (%d), ciphers: %@, selected: %@", [self nameOfType:type], type, typeCiphers, cipher );
|
||||
trc( @"type %@ (%lu), ciphers: %@, selected: %@", [self nameOfType:type], (unsigned long)type, typeCiphers, cipher );
|
||||
|
||||
// Encode the content, character by character, using subsequent seed bytes and the cipher.
|
||||
NSAssert( [seed length] >= [cipher length] + 1, @"Insufficient seed bytes to encode cipher." );
|
||||
|
||||
21
MasterPassword/ObjC/MPAlgorithmV2.h
Normal file
21
MasterPassword/ObjC/MPAlgorithmV2.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
|
||||
*
|
||||
* See the enclosed file LICENSE for license information (LGPLv3). If you did
|
||||
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* @author Maarten Billemont <lhunath@lyndir.com>
|
||||
* @license http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*/
|
||||
|
||||
//
|
||||
// MPAlgorithmV1
|
||||
//
|
||||
// Created by Maarten Billemont on 17/07/12.
|
||||
// Copyright 2012 lhunath (Maarten Billemont). All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPAlgorithmV1.h"
|
||||
|
||||
@interface MPAlgorithmV2 : MPAlgorithmV1
|
||||
@end
|
||||
97
MasterPassword/ObjC/MPAlgorithmV2.m
Normal file
97
MasterPassword/ObjC/MPAlgorithmV2.m
Normal file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
|
||||
*
|
||||
* See the enclosed file LICENSE for license information (LGPLv3). If you did
|
||||
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* @author Maarten Billemont <lhunath@lyndir.com>
|
||||
* @license http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*/
|
||||
|
||||
//
|
||||
// MPAlgorithmV1
|
||||
//
|
||||
// Created by Maarten Billemont on 17/07/12.
|
||||
// Copyright 2012 lhunath (Maarten Billemont). All rights reserved.
|
||||
//
|
||||
|
||||
#import <objc/runtime.h>
|
||||
#import "MPAlgorithmV2.h"
|
||||
#import "MPEntities.h"
|
||||
|
||||
@implementation MPAlgorithmV2
|
||||
|
||||
- (NSUInteger)version {
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit {
|
||||
|
||||
if (site.version != [self version] - 1)
|
||||
// Only migrate from previous version.
|
||||
return NO;
|
||||
|
||||
if (!explicit) {
|
||||
if (site.type & MPSiteTypeClassGenerated && site.name.length != [site.name dataUsingEncoding:NSUTF8StringEncoding].length) {
|
||||
// This migration requires explicit permission for types of the generated class.
|
||||
site.requiresExplicitMigration = YES;
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply migration.
|
||||
site.requiresExplicitMigration = NO;
|
||||
site.version = [self version];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *)generateContentForSiteNamed:(NSString *)name ofType:(MPSiteType)type withCounter:(NSUInteger)counter
|
||||
variant:(MPSiteVariant)variant context:(NSString *)context usingKey:(MPKey *)key {
|
||||
|
||||
// Determine the seed whose bytes will be used for calculating a password
|
||||
NSData *nameBytes = [name dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSData *contextBytes = [context dataUsingEncoding:NSUTF8StringEncoding];
|
||||
uint32_t ncounter = htonl( counter ), nnameLength = htonl( nameBytes.length ), ncontextLength = htonl( contextBytes.length );
|
||||
NSData *counterBytes = [NSData dataWithBytes:&ncounter length:sizeof( ncounter )];
|
||||
NSData *nameLengthBytes = [NSData dataWithBytes:&nnameLength length:sizeof( nnameLength )];
|
||||
NSData *contextLengthBytes = [NSData dataWithBytes:&ncontextLength length:sizeof( ncontextLength )];
|
||||
NSString *scope = [self scopeForVariant:variant];
|
||||
NSData *scopeBytes = [scope dataUsingEncoding:NSUTF8StringEncoding];
|
||||
trc( @"seed from: hmac-sha256(%@, %@ | %@ | %@ | %@)",
|
||||
[[key keyID] encodeHex], scope, [nameLengthBytes encodeHex], name, [counterBytes encodeHex] );
|
||||
NSData *seed = [[NSData dataByConcatenatingDatas:
|
||||
scopeBytes,
|
||||
nameLengthBytes,
|
||||
nameBytes,
|
||||
counterBytes,
|
||||
context? contextLengthBytes: nil,
|
||||
contextBytes,
|
||||
nil]
|
||||
hmacWith:PearlHashSHA256 key:key.keyData];
|
||||
trc( @"seed is: %@", [seed encodeHex] );
|
||||
const unsigned char *seedBytes = seed.bytes;
|
||||
|
||||
// Determine the cipher from the first seed byte.
|
||||
NSAssert( [seed length], @"Missing seed." );
|
||||
NSArray *typeCiphers = [self ciphersForType:type];
|
||||
NSString *cipher = typeCiphers[seedBytes[0] % [typeCiphers count]];
|
||||
trc( @"type %@ (%lu), ciphers: %@, selected: %@", [self nameOfType:type], (unsigned long)type, typeCiphers, cipher );
|
||||
|
||||
// Encode the content, character by character, using subsequent seed bytes and the cipher.
|
||||
NSAssert( [seed length] >= [cipher length] + 1, @"Insufficient seed bytes to encode cipher." );
|
||||
NSMutableString *content = [NSMutableString stringWithCapacity:[cipher length]];
|
||||
for (NSUInteger c = 0; c < [cipher length]; ++c) {
|
||||
uint16_t keyByte = seedBytes[c + 1];
|
||||
NSString *cipherClass = [cipher substringWithRange:NSMakeRange( c, 1 )];
|
||||
NSString *cipherClassCharacters = [self charactersForCipherClass:cipherClass];
|
||||
NSString *character = [cipherClassCharacters substringWithRange:NSMakeRange( keyByte % [cipherClassCharacters length], 1 )];
|
||||
|
||||
trc( @"class %@ has characters: %@, index: %u, selected: %@", cipherClass, cipherClassCharacters, keyByte, character );
|
||||
[content appendString:character];
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
@end
|
||||
39
MasterPassword/ObjC/MPAppDelegate_InApp.h
Normal file
39
MasterPassword/ObjC/MPAppDelegate_InApp.h
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// MPAppDelegate_Key.h
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 24/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <StoreKit/StoreKit.h>
|
||||
#import "MPAppDelegate_Shared.h"
|
||||
|
||||
#define MPProductGenerateLogins @"com.lyndir.masterpassword.products.generatelogins"
|
||||
#define MPProductGenerateAnswers @"com.lyndir.masterpassword.products.generateanswers"
|
||||
#define MPProductOSIntegration @"com.lyndir.masterpassword.products.osintegration"
|
||||
#define MPProductTouchID @"com.lyndir.masterpassword.products.touchid"
|
||||
#define MPProductFuel @"com.lyndir.masterpassword.products.fuel"
|
||||
|
||||
#define MP_FUEL_HOURLY_RATE 30.f /* Tier 1 purchases/h ~> USD/h */
|
||||
|
||||
@protocol MPInAppDelegate
|
||||
|
||||
- (void)updateWithProducts:(NSArray /* SKProduct */ *)products;
|
||||
- (void)updateWithTransaction:(SKPaymentTransaction *)transaction;
|
||||
|
||||
@end
|
||||
|
||||
@interface MPAppDelegate_Shared(InApp)
|
||||
|
||||
- (void)registerProductsObserver:(id<MPInAppDelegate>)delegate;
|
||||
- (void)removeProductsObserver:(id<MPInAppDelegate>)delegate;
|
||||
|
||||
- (void)reloadProducts;
|
||||
- (BOOL)canMakePayments;
|
||||
- (BOOL)isFeatureUnlocked:(NSString *)productIdentifier;
|
||||
|
||||
- (void)restoreCompletedTransactions;
|
||||
- (void)purchaseProductWithIdentifier:(NSString *)productIdentifier quantity:(NSInteger)quantity;
|
||||
|
||||
@end
|
||||
181
MasterPassword/ObjC/MPAppDelegate_InApp.m
Normal file
181
MasterPassword/ObjC/MPAppDelegate_InApp.m
Normal file
@@ -0,0 +1,181 @@
|
||||
//
|
||||
// MPAppDelegate.m
|
||||
// MasterPassword
|
||||
//
|
||||
// Created by Maarten Billemont on 24/11/11.
|
||||
// Copyright (c) 2011 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPAppDelegate_InApp.h"
|
||||
|
||||
@interface MPAppDelegate_Shared(InApp_Private)<SKProductsRequestDelegate, SKPaymentTransactionObserver>
|
||||
@end
|
||||
|
||||
@implementation MPAppDelegate_Shared(InApp)
|
||||
|
||||
PearlAssociatedObjectProperty( NSArray*, Products, products );
|
||||
PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObservers );
|
||||
|
||||
- (void)registerProductsObserver:(id<MPInAppDelegate>)delegate {
|
||||
|
||||
if (!self.productObservers)
|
||||
self.productObservers = [NSMutableArray array];
|
||||
[self.productObservers addObject:delegate];
|
||||
|
||||
if (self.products)
|
||||
[delegate updateWithProducts:self.products];
|
||||
else
|
||||
[self reloadProducts];
|
||||
}
|
||||
|
||||
- (void)removeProductsObserver:(id<MPInAppDelegate>)delegate {
|
||||
|
||||
[self.productObservers removeObject:delegate];
|
||||
}
|
||||
|
||||
- (void)reloadProducts {
|
||||
|
||||
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:
|
||||
[[NSSet alloc] initWithObjects:MPProductGenerateLogins, MPProductGenerateAnswers, MPProductFuel, nil]];
|
||||
productsRequest.delegate = self;
|
||||
[productsRequest start];
|
||||
}
|
||||
|
||||
- (SKPaymentQueue *)paymentQueue {
|
||||
|
||||
static dispatch_once_t once = 0;
|
||||
dispatch_once( &once, ^{
|
||||
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
|
||||
} );
|
||||
|
||||
return [SKPaymentQueue defaultQueue];
|
||||
}
|
||||
|
||||
- (BOOL)canMakePayments {
|
||||
|
||||
return [SKPaymentQueue canMakePayments];
|
||||
}
|
||||
|
||||
- (BOOL)isFeatureUnlocked:(NSString *)productIdentifier {
|
||||
|
||||
if (![productIdentifier length])
|
||||
// Missing a product.
|
||||
return NO;
|
||||
if ([productIdentifier isEqualToString:MPProductFuel])
|
||||
// Consumable product.
|
||||
return NO;
|
||||
|
||||
#if ADHOC || DEBUG
|
||||
// All features are unlocked for beta / debug versions.
|
||||
return YES;
|
||||
#else
|
||||
// Check if product is purchased.
|
||||
return [[NSUserDefaults standardUserDefaults] objectForKey:productIdentifier] != nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)restoreCompletedTransactions {
|
||||
|
||||
[[self paymentQueue] restoreCompletedTransactions];
|
||||
}
|
||||
|
||||
- (void)purchaseProductWithIdentifier:(NSString *)productIdentifier quantity:(NSInteger)quantity {
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if (![[MPAppDelegate_Shared get] canMakePayments]) {
|
||||
[PearlAlert showAlertWithTitle:@"Store Not Set Up" message:
|
||||
@"Try logging using the App Store or from Settings."
|
||||
viewStyle:UIAlertViewStyleDefault initAlert:nil
|
||||
tappedButtonBlock:nil cancelTitle:@"Thanks" otherTitles:nil];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (SKProduct *product in self.products)
|
||||
if ([product.productIdentifier isEqualToString:productIdentifier]) {
|
||||
SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:product];
|
||||
payment.quantity = quantity;
|
||||
[[self paymentQueue] addPayment:payment];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - SKProductsRequestDelegate
|
||||
|
||||
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
|
||||
|
||||
inf( @"products: %@, invalid: %@", response.products, response.invalidProductIdentifiers );
|
||||
self.products = response.products;
|
||||
|
||||
for (id<MPInAppDelegate> productObserver in self.productObservers)
|
||||
[productObserver updateWithProducts:self.products];
|
||||
}
|
||||
|
||||
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[PearlAlert showAlertWithTitle:@"Purchase Failed" message:
|
||||
strf( @"%@\n\n%@", error.localizedDescription,
|
||||
@"Ensure you are online and try logging out and back into iTunes from your device's Settings." )
|
||||
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:nil
|
||||
cancelTitle:@"OK" otherTitles:nil];
|
||||
#else
|
||||
#endif
|
||||
err( @"StoreKit request (%@) failed: %@", request, [error fullDescription] );
|
||||
}
|
||||
|
||||
- (void)requestDidFinish:(SKRequest *)request {
|
||||
|
||||
dbg( @"StoreKit request (%@) finished.", request );
|
||||
}
|
||||
|
||||
#pragma mark - SKPaymentTransactionObserver
|
||||
|
||||
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
|
||||
|
||||
for (SKPaymentTransaction *transaction in transactions) {
|
||||
dbg( @"transaction updated: %@ -> %d", transaction.payment.productIdentifier, (int)(transaction.transactionState) );
|
||||
switch (transaction.transactionState) {
|
||||
case SKPaymentTransactionStatePurchased: {
|
||||
inf( @"purchased: %@", transaction.payment.productIdentifier );
|
||||
if ([transaction.payment.productIdentifier isEqualToString:MPProductFuel]) {
|
||||
float currentFuel = [[MPiOSConfig get].developmentFuelRemaining floatValue];
|
||||
float purchasedFuel = transaction.payment.quantity / MP_FUEL_HOURLY_RATE;
|
||||
[MPiOSConfig get].developmentFuelRemaining = @(currentFuel + purchasedFuel);
|
||||
if (![MPiOSConfig get].developmentFuelChecked || !currentFuel)
|
||||
[MPiOSConfig get].developmentFuelChecked = [NSDate date];
|
||||
}
|
||||
[[NSUserDefaults standardUserDefaults] setObject:transaction.transactionIdentifier
|
||||
forKey:transaction.payment.productIdentifier];
|
||||
[queue finishTransaction:transaction];
|
||||
break;
|
||||
}
|
||||
case SKPaymentTransactionStateRestored: {
|
||||
inf( @"restored: %@", transaction.payment.productIdentifier );
|
||||
[[NSUserDefaults standardUserDefaults] setObject:transaction.transactionIdentifier
|
||||
forKey:transaction.payment.productIdentifier];
|
||||
[queue finishTransaction:transaction];
|
||||
break;
|
||||
}
|
||||
case SKPaymentTransactionStatePurchasing:
|
||||
case SKPaymentTransactionStateDeferred:
|
||||
break;
|
||||
case SKPaymentTransactionStateFailed:
|
||||
err( @"Transaction failed: %@, reason: %@", transaction.payment.productIdentifier, [transaction.error fullDescription] );
|
||||
[queue finishTransaction:transaction];
|
||||
break;
|
||||
}
|
||||
|
||||
for (id<MPInAppDelegate> productObserver in self.productObservers)
|
||||
[productObserver updateWithTransaction:transaction];
|
||||
}
|
||||
if (![[NSUserDefaults standardUserDefaults] synchronize])
|
||||
wrn( @"Couldn't synchronize after transaction updates." );
|
||||
}
|
||||
|
||||
- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {
|
||||
|
||||
err( @"StoreKit restore failed: %@", [error fullDescription] );
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -9,6 +9,12 @@
|
||||
#import "MPAppDelegate_Key.h"
|
||||
#import "MPAppDelegate_Store.h"
|
||||
|
||||
@interface MPAppDelegate_Shared()
|
||||
|
||||
@property(strong, nonatomic) MPKey *key;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPAppDelegate_Shared(Key)
|
||||
|
||||
static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
@@ -85,8 +91,8 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
if ([password length] && (tryKey = [MPAlgorithmDefault keyForPassword:password ofUserNamed:user.name])) {
|
||||
user.keyID = tryKey.keyID;
|
||||
|
||||
// Migrate existing elements.
|
||||
[self migrateElementsForUser:user saveInContext:moc toKey:tryKey];
|
||||
// Migrate existing sites.
|
||||
[self migrateSitesForUser:user saveInContext:moc toKey:tryKey];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +122,8 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
|
||||
// No more methods left, fail if key still not known.
|
||||
if (!tryKey) {
|
||||
if (password) {
|
||||
if (password)
|
||||
inf( @"Login failed for: %@", user.userID );
|
||||
MPCheckpoint( MPCheckpointSignInFailed, nil );
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
@@ -153,28 +157,27 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
}];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPSignedInNotification object:self];
|
||||
MPCheckpoint( MPCheckpointSignedIn, nil );
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)migrateElementsForUser:(MPUserEntity *)user saveInContext:(NSManagedObjectContext *)moc toKey:(MPKey *)newKey {
|
||||
- (void)migrateSitesForUser:(MPUserEntity *)user saveInContext:(NSManagedObjectContext *)moc toKey:(MPKey *)newKey {
|
||||
|
||||
if (![user.elements count])
|
||||
if (![user.sites count])
|
||||
// Nothing to migrate.
|
||||
return;
|
||||
|
||||
MPKey *recoverKey = newKey;
|
||||
#ifdef PEARL_UIKIT
|
||||
PearlOverlay *activityOverlay = [PearlOverlay showProgressOverlayWithTitle:PearlString( @"Migrating %ld sites...",
|
||||
(long)[user.elements count] )];
|
||||
(long)[user.sites count] )];
|
||||
#endif
|
||||
|
||||
for (MPElementEntity *element in user.elements) {
|
||||
if (element.type & MPElementTypeClassStored) {
|
||||
for (MPSiteEntity *site in user.sites) {
|
||||
if (site.type & MPSiteTypeClassStored) {
|
||||
NSString *content;
|
||||
while (!(content = [element.algorithm storedPasswordForElement:(MPElementStoredEntity *)element usingKey:recoverKey])) {
|
||||
// Failed to decrypt element with the current recoveryKey. Ask user for a new one to use.
|
||||
while (!(content = [site.algorithm storedPasswordForSite:(MPStoredSiteEntity *)site usingKey:recoverKey])) {
|
||||
// Failed to decrypt site with the current recoveryKey. Ask user for a new one to use.
|
||||
__block NSString *masterPassword = nil;
|
||||
|
||||
#ifdef PEARL_UIKIT
|
||||
@@ -182,7 +185,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
dispatch_group_enter( recoverPasswordGroup );
|
||||
[PearlAlert showAlertWithTitle:@"Enter Old Master Password"
|
||||
message:PearlString( @"Your old master password is required to migrate the stored password for %@",
|
||||
element.name )
|
||||
site.name )
|
||||
viewStyle:UIAlertViewStyleSecureTextInput
|
||||
initAlert:nil tappedButtonBlock:^(UIAlertView *alert_, NSInteger buttonIndex_) {
|
||||
@try {
|
||||
@@ -202,7 +205,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
// Don't Migrate
|
||||
break;
|
||||
|
||||
recoverKey = [element.algorithm keyForPassword:masterPassword ofUserNamed:user.name];
|
||||
recoverKey = [site.algorithm keyForPassword:masterPassword ofUserNamed:user.name];
|
||||
}
|
||||
|
||||
if (!content)
|
||||
@@ -210,7 +213,7 @@ static NSDictionary *keyQuery(MPUserEntity *user) {
|
||||
break;
|
||||
|
||||
if (![recoverKey isEqualToKey:newKey])
|
||||
[element.algorithm savePassword:content toElement:element usingKey:newKey];
|
||||
[site.algorithm savePassword:content toSite:site usingKey:newKey];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,19 +9,20 @@
|
||||
#import "MPEntities.h"
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
@interface MPAppDelegate_Shared : PearlAppDelegate
|
||||
#else
|
||||
@interface MPAppDelegate_Shared : NSObject <PearlConfigDelegate>
|
||||
#endif
|
||||
|
||||
@property(strong, nonatomic) MPKey *key;
|
||||
@property(strong, nonatomic) NSManagedObjectID *activeUserOID;
|
||||
@property(strong, nonatomic, readonly) MPKey *key;
|
||||
@property(strong, nonatomic, readonly) NSManagedObjectID *activeUserOID;
|
||||
@property(strong, nonatomic, readonly) NSPersistentStoreCoordinator *storeCoordinator;
|
||||
|
||||
+ (instancetype)get;
|
||||
|
||||
- (MPUserEntity *)activeUserForMainThread;
|
||||
- (MPUserEntity *)activeUserInContext:(NSManagedObjectContext *)context;
|
||||
- (void)setActiveUser:(MPUserEntity *)activeUser;
|
||||
- (void)handleCoordinatorError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
#import "MPAppDelegate_Shared.h"
|
||||
#import "MPAppDelegate_Store.h"
|
||||
#import "MPAppDelegate_Key.h"
|
||||
#import "NSManagedObjectModel+KCOrderedAccessorFix.h"
|
||||
|
||||
@interface MPAppDelegate_Shared ()
|
||||
|
||||
@property(strong, nonatomic) MPKey *key;
|
||||
@property(strong, nonatomic) NSManagedObjectID *activeUserOID;
|
||||
@property(strong, nonatomic) NSPersistentStoreCoordinator *storeCoordinator;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPAppDelegate_Shared
|
||||
|
||||
@@ -23,6 +32,18 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
NSManagedObjectModel *model = [NSManagedObjectModel mergedModelFromBundles:nil];
|
||||
[model kc_generateOrderedSetAccessors];
|
||||
self.storeCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (MPUserEntity *)activeUserForMainThread {
|
||||
|
||||
return [self activeUserInContext:[MPAppDelegate_Shared managedObjectContextForMainThreadIfReady]];
|
||||
@@ -45,9 +66,13 @@
|
||||
|
||||
NSError *error;
|
||||
if (activeUser.objectID.isTemporaryID && ![activeUser.managedObjectContext obtainPermanentIDsForObjects:@[ activeUser ] error:&error])
|
||||
err(@"Failed to obtain a permanent object ID after setting active user: %@", error);
|
||||
err(@"Failed to obtain a permanent object ID after setting active user: %@", [error fullDescription]);
|
||||
|
||||
self.activeUserOID = activeUser.objectID;
|
||||
}
|
||||
|
||||
- (void)handleCoordinatorError:(NSError *)error {
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,10 +27,11 @@ typedef NS_ENUM( NSUInteger, MPImportResult ) {
|
||||
+ (BOOL)managedObjectContextPerformBlockAndWait:(void (^)(NSManagedObjectContext *context))mocBlock;
|
||||
|
||||
- (MPFixableResult)findAndFixInconsistenciesSaveInContext:(NSManagedObjectContext *)context;
|
||||
- (void)deleteAndResetStore;
|
||||
|
||||
/** @param completion The block to execute after adding the element, executed from the main thread with the new element in the main MOC. */
|
||||
- (void)addElementNamed:(NSString *)siteName completion:(void ( ^ )(MPElementEntity *element, NSManagedObjectContext *context))completion;
|
||||
- (MPElementEntity *)changeElement:(MPElementEntity *)element saveInContext:(NSManagedObjectContext *)context toType:(MPElementType)type;
|
||||
/** @param completion The block to execute after adding the site, executed from the main thread with the new site in the main MOC. */
|
||||
- (void)addSiteNamed:(NSString *)siteName completion:(void ( ^ )(MPSiteEntity *site, NSManagedObjectContext *context))completion;
|
||||
- (MPSiteEntity *)changeSite:(MPSiteEntity *)site saveInContext:(NSManagedObjectContext *)context toType:(MPSiteType)type;
|
||||
- (MPImportResult)importSites:(NSString *)importedSitesString
|
||||
askImportPassword:(NSString *(^)(NSString *userName))importPassword
|
||||
askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define STORE_OPTIONS
|
||||
#endif
|
||||
|
||||
#define MPStoreMigrationLevelKey @"MPMigrationLevelLocalStoreKey"
|
||||
#define MPMigrationLevelLocalStoreKey @"MPMigrationLevelLocalStoreKey"
|
||||
|
||||
typedef NS_ENUM( NSInteger, MPStoreMigrationLevel ) {
|
||||
MPStoreMigrationLevelV1,
|
||||
@@ -25,14 +25,14 @@ typedef NS_ENUM( NSInteger, MPStoreMigrationLevel ) {
|
||||
|
||||
@implementation MPAppDelegate_Shared(Store)
|
||||
|
||||
PearlAssociatedObjectProperty( id, SaveObserver, saveObserver );
|
||||
|
||||
PearlAssociatedObjectProperty( NSPersistentStoreCoordinator*, PersistentStoreCoordinator, persistentStoreCoordinator );
|
||||
PearlAssociatedObjectProperty( NSOperationQueue *, StoreQueue, storeQueue );
|
||||
|
||||
PearlAssociatedObjectProperty( NSManagedObjectContext*, PrivateManagedObjectContext, privateManagedObjectContext );
|
||||
|
||||
PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext, mainManagedObjectContext );
|
||||
|
||||
PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
|
||||
|
||||
#pragma mark - Core Data setup
|
||||
|
||||
+ (NSManagedObjectContext *)managedObjectContextForMainThreadIfReady {
|
||||
@@ -52,7 +52,12 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
return NO;
|
||||
|
||||
[mainManagedObjectContext performBlock:^{
|
||||
@try {
|
||||
mocBlock( mainManagedObjectContext );
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
err( @"While performing managed block:\n%@", [exception fullDescription] );
|
||||
}
|
||||
}];
|
||||
|
||||
return YES;
|
||||
@@ -65,7 +70,12 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
return NO;
|
||||
|
||||
[mainManagedObjectContext performBlockAndWait:^{
|
||||
@try {
|
||||
mocBlock( mainManagedObjectContext );
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
err( @"While performing managed block:\n%@", [exception fullDescription] );
|
||||
}
|
||||
}];
|
||||
|
||||
return YES;
|
||||
@@ -80,7 +90,12 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
|
||||
moc.parentContext = privateManagedObjectContextIfReady;
|
||||
[moc performBlock:^{
|
||||
@try {
|
||||
mocBlock( moc );
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
err( @"While performing managed block:\n%@", [exception fullDescription] );
|
||||
}
|
||||
}];
|
||||
|
||||
return YES;
|
||||
@@ -95,7 +110,12 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
|
||||
moc.parentContext = privateManagedObjectContextIfReady;
|
||||
[moc performBlockAndWait:^{
|
||||
@try {
|
||||
mocBlock( moc );
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
err( @"While performing managed block:\n%@", [exception fullDescription] );
|
||||
}
|
||||
}];
|
||||
|
||||
return YES;
|
||||
@@ -119,20 +139,28 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
inDomains:NSUserDomainMask] lastObject];
|
||||
return [[[applicationSupportURL
|
||||
URLByAppendingPathComponent:[NSBundle mainBundle].bundleIdentifier isDirectory:YES]
|
||||
URLByAppendingPathComponent:@"UbiquityStore" isDirectory:NO]
|
||||
URLByAppendingPathComponent:@"MasterPassword" isDirectory:NO]
|
||||
URLByAppendingPathExtension:@"sqlite"];
|
||||
}
|
||||
|
||||
- (void)loadStore {
|
||||
|
||||
@synchronized (self) {
|
||||
static dispatch_once_t once = 0;
|
||||
dispatch_once( &once, ^{
|
||||
(self.storeQueue = [NSOperationQueue new]).maxConcurrentOperationCount = 1;
|
||||
} );
|
||||
|
||||
// Do nothing if already fully set up, otherwise (re-)load the store.
|
||||
if (self.persistentStoreCoordinator && self.saveObserver && self.mainManagedObjectContext && self.privateManagedObjectContext)
|
||||
if (self.storeCoordinator && self.mainManagedObjectContext && self.privateManagedObjectContext)
|
||||
return;
|
||||
|
||||
[self.storeQueue addOperationWithBlock:^{
|
||||
// Do nothing if already fully set up, otherwise (re-)load the store.
|
||||
if (self.storeCoordinator && self.mainManagedObjectContext && self.privateManagedObjectContext)
|
||||
return;
|
||||
|
||||
// Unregister any existing observers and contexts.
|
||||
if (self.saveObserver)
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self.saveObserver];
|
||||
PearlRemoveNotificationObserversFrom( self.mainManagedObjectContext );
|
||||
[self.mainManagedObjectContext performBlockAndWait:^{
|
||||
[self.mainManagedObjectContext reset];
|
||||
self.mainManagedObjectContext = nil;
|
||||
@@ -142,56 +170,72 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
self.privateManagedObjectContext = nil;
|
||||
}];
|
||||
|
||||
// Don't load when the store is corrupted.
|
||||
if ([self.storeCorrupted boolValue])
|
||||
return;
|
||||
|
||||
// Check if migration is necessary.
|
||||
[self migrateStore];
|
||||
|
||||
// Create a new store coordinator.
|
||||
self.persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:
|
||||
[NSManagedObjectModel mergedModelFromBundles:nil]];
|
||||
NSError *error = nil;
|
||||
[self.persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[self localStoreURL]
|
||||
options:@{
|
||||
NSMigratePersistentStoresAutomaticallyOption : @YES,
|
||||
NSInferMappingModelAutomaticallyOption : @YES,
|
||||
STORE_OPTIONS
|
||||
} error:&error];
|
||||
|
||||
// Create our contexts and observer.
|
||||
// Install managed object contexts and observers.
|
||||
self.privateManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
|
||||
[self.privateManagedObjectContext performBlockAndWait:^{
|
||||
self.privateManagedObjectContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy;
|
||||
self.privateManagedObjectContext.persistentStoreCoordinator = self.persistentStoreCoordinator;
|
||||
self.privateManagedObjectContext.persistentStoreCoordinator = self.storeCoordinator;
|
||||
}];
|
||||
|
||||
self.mainManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
|
||||
self.mainManagedObjectContext.parentContext = self.privateManagedObjectContext;
|
||||
|
||||
self.saveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSManagedObjectContextDidSaveNotification
|
||||
object:self.privateManagedObjectContext queue:nil usingBlock:
|
||||
^(NSNotification *note) {
|
||||
// When privateManagedObjectContext is saved, import the changes into mainManagedObjectContext.
|
||||
[self.mainManagedObjectContext performBlock:^{
|
||||
[self.mainManagedObjectContext mergeChangesFromContextDidSaveNotification:note];
|
||||
}];
|
||||
PearlAddNotificationObserverTo( self.mainManagedObjectContext, NSManagedObjectContextDidSaveNotification,
|
||||
self.privateManagedObjectContext, nil, ^(NSManagedObjectContext *mainManagedObjectContext, NSNotification *note) {
|
||||
[mainManagedObjectContext performBlock:^{
|
||||
@try {
|
||||
[mainManagedObjectContext mergeChangesFromContextDidSaveNotification:note];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
err( @"While merging changes:\n%@",[exception fullDescription] );
|
||||
}
|
||||
}];
|
||||
} );
|
||||
|
||||
|
||||
// Create a new store coordinator.
|
||||
NSError *error = nil;
|
||||
NSURL *localStoreURL = [self localStoreURL];
|
||||
if (![[NSFileManager defaultManager] createDirectoryAtURL:[localStoreURL URLByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||
err( @"Couldn't create our application support directory: %@", [error fullDescription] );
|
||||
return;
|
||||
}
|
||||
if (![self.storeCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[self localStoreURL]
|
||||
options:@{
|
||||
NSMigratePersistentStoresAutomaticallyOption : @YES,
|
||||
NSInferMappingModelAutomaticallyOption : @YES,
|
||||
STORE_OPTIONS
|
||||
} error:&error]) {
|
||||
err( @"Failed to open store: %@", [error fullDescription] );
|
||||
self.storeCorrupted = @YES;
|
||||
[self handleCoordinatorError:error];
|
||||
return;
|
||||
}
|
||||
self.storeCorrupted = @NO;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillTerminateNotification object:UIApp
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
||||
^(NSNotification *note) {
|
||||
PearlAddNotificationObserver( UIApplicationWillTerminateNotification, UIApp, [NSOperationQueue mainQueue],
|
||||
^(MPAppDelegate_Shared *self, NSNotification *note) {
|
||||
[self.mainManagedObjectContext saveToStore];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification object:UIApp
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
||||
^(NSNotification *note) {
|
||||
} );
|
||||
PearlAddNotificationObserver( UIApplicationDidEnterBackgroundNotification, UIApp, [NSOperationQueue mainQueue],
|
||||
^(MPAppDelegate_Shared *self, NSNotification *note) {
|
||||
[self.mainManagedObjectContext saveToStore];
|
||||
}];
|
||||
} );
|
||||
#else
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillTerminateNotification object:NSApp
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
||||
^(NSNotification *note) {
|
||||
PearlAddNotificationObserver( NSApplicationWillTerminateNotification, NSApp, [NSOperationQueue mainQueue],
|
||||
^(MPAppDelegate_Shared *self, NSNotification *note) {
|
||||
[self.mainManagedObjectContext saveToStore];
|
||||
}];
|
||||
} );
|
||||
#endif
|
||||
|
||||
// Perform a data sanity check on the newly loaded store to find and fix any issues.
|
||||
@@ -199,6 +243,31 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
[MPAppDelegate_Shared managedObjectContextPerformBlockAndWait:^(NSManagedObjectContext *context) {
|
||||
[self findAndFixInconsistenciesSaveInContext:context];
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)deleteAndResetStore {
|
||||
|
||||
@synchronized (self) {
|
||||
// Unregister any existing observers and contexts.
|
||||
PearlRemoveNotificationObserversFrom( self.mainManagedObjectContext );
|
||||
[self.mainManagedObjectContext performBlockAndWait:^{
|
||||
[self.mainManagedObjectContext reset];
|
||||
self.mainManagedObjectContext = nil;
|
||||
}];
|
||||
[self.privateManagedObjectContext performBlockAndWait:^{
|
||||
[self.privateManagedObjectContext reset];
|
||||
self.privateManagedObjectContext = nil;
|
||||
}];
|
||||
NSError *error = nil;
|
||||
for (NSPersistentStore *store in self.storeCoordinator.persistentStores) {
|
||||
if (![self.storeCoordinator removePersistentStore:store error:&error])
|
||||
err( @"Couldn't remove persistence store from coordinator: %@", [error fullDescription] );
|
||||
}
|
||||
if (![[NSFileManager defaultManager] removeItemAtURL:self.localStoreURL error:&error])
|
||||
err( @"Couldn't remove persistence store at URL %@: %@", self.localStoreURL, [error fullDescription] );
|
||||
|
||||
[self loadStore];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +283,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
fetchRequest.entity = entity;
|
||||
NSArray *objects = [context executeFetchRequest:fetchRequest error:&error];
|
||||
if (!objects) {
|
||||
err( @"Failed to fetch %@ objects: %@", entity, error );
|
||||
err( @"Failed to fetch %@ objects: %@", entity, [error fullDescription] );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -239,23 +308,25 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
- (void)migrateStore {
|
||||
|
||||
MPStoreMigrationLevel migrationLevel = (signed)[[NSUserDefaults standardUserDefaults] integerForKey:MPStoreMigrationLevelKey];
|
||||
MPStoreMigrationLevel migrationLevel = (signed)[[NSUserDefaults standardUserDefaults] integerForKey:MPMigrationLevelLocalStoreKey];
|
||||
if (migrationLevel >= MPStoreMigrationLevelCurrent)
|
||||
// Local store up-to-date.
|
||||
return;
|
||||
|
||||
inf( @"Local store migration level: %d (current %d)", (signed)migrationLevel, (signed)MPStoreMigrationLevelCurrent );
|
||||
if (migrationLevel == MPStoreMigrationLevelV1 && ![self migrateV1LocalStore]) {
|
||||
if (migrationLevel <= MPStoreMigrationLevelV1 && ![self migrateV1LocalStore]) {
|
||||
inf( @"Failed to migrate old V1 to new local store." );
|
||||
return;
|
||||
}
|
||||
if (migrationLevel == MPStoreMigrationLevelV2 && ![self migrateV2LocalStore]) {
|
||||
if (migrationLevel <= MPStoreMigrationLevelV2 && ![self migrateV2LocalStore]) {
|
||||
inf( @"Failed to migrate old V2 to new local store." );
|
||||
return;
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:MPStoreMigrationLevelCurrent forKey:MPStoreMigrationLevelKey];
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:MPStoreMigrationLevelCurrent forKey:MPMigrationLevelLocalStoreKey];
|
||||
inf( @"Successfully migrated old to new local store." );
|
||||
if (![[NSUserDefaults standardUserDefaults] synchronize])
|
||||
wrn( @"Couldn't synchronize after store migration." );
|
||||
}
|
||||
|
||||
- (BOOL)migrateV1LocalStore {
|
||||
@@ -271,14 +342,16 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
inf( @"Migrating V1 local store" );
|
||||
NSURL *newLocalStoreURL = [self localStoreURL];
|
||||
NSError *error = nil;
|
||||
if (![[NSFileManager defaultManager] createDirectoryAtURL:[newLocalStoreURL URLByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||
err( @"Couldn't create our application support directory: %@", [error fullDescription] );
|
||||
return NO;
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:newLocalStoreURL.path isDirectory:NULL]) {
|
||||
inf( @"New local store already exists." );
|
||||
return YES;
|
||||
}
|
||||
if (![[NSFileManager defaultManager] moveItemAtURL:oldLocalStoreURL toURL:newLocalStoreURL error:&error]) {
|
||||
err( @"Couldn't move the old store to the new location: %@", [error fullDescription] );
|
||||
|
||||
NSError *error = nil;
|
||||
if (![NSPersistentStore migrateStore:oldLocalStoreURL withOptions:@{ STORE_OPTIONS }
|
||||
toStore:newLocalStoreURL withOptions:@{ STORE_OPTIONS }
|
||||
model:nil error:&error]) {
|
||||
err( @"Couldn't migrate the old store to the new location: %@", [error fullDescription] );
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -310,14 +383,22 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
inf( @"Migrating V2 local store" );
|
||||
NSURL *newLocalStoreURL = [self localStoreURL];
|
||||
NSError *error = nil;
|
||||
if (![[NSFileManager defaultManager] createDirectoryAtURL:[newLocalStoreURL URLByDeletingLastPathComponent]
|
||||
withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||
err( @"Couldn't create our application support directory: %@", [error fullDescription] );
|
||||
return NO;
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:newLocalStoreURL.path isDirectory:NULL]) {
|
||||
inf( @"New local store already exists." );
|
||||
return YES;
|
||||
}
|
||||
if (![[NSFileManager defaultManager] moveItemAtURL:oldLocalStoreURL toURL:newLocalStoreURL error:&error]) {
|
||||
err( @"Couldn't move the old store to the new location: %@", [error fullDescription] );
|
||||
|
||||
NSError *error = nil;
|
||||
if (![NSPersistentStore migrateStore:oldLocalStoreURL withOptions:@{
|
||||
NSMigratePersistentStoresAutomaticallyOption : @YES,
|
||||
NSInferMappingModelAutomaticallyOption : @YES,
|
||||
STORE_OPTIONS
|
||||
} toStore:newLocalStoreURL withOptions:@{
|
||||
NSMigratePersistentStoresAutomaticallyOption : @YES,
|
||||
NSInferMappingModelAutomaticallyOption : @YES,
|
||||
STORE_OPTIONS
|
||||
} model:nil error:&error]) {
|
||||
err( @"Couldn't migrate the old store to the new location: %@", [error fullDescription] );
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -326,7 +407,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
#pragma mark - Utilities
|
||||
|
||||
- (void)addElementNamed:(NSString *)siteName completion:(void ( ^ )(MPElementEntity *element, NSManagedObjectContext *context))completion {
|
||||
- (void)addSiteNamed:(NSString *)siteName completion:(void ( ^ )(MPSiteEntity *site, NSManagedObjectContext *context))completion {
|
||||
|
||||
if (![siteName length]) {
|
||||
completion( nil, nil );
|
||||
@@ -341,61 +422,61 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
return;
|
||||
}
|
||||
|
||||
MPElementType type = activeUser.defaultType;
|
||||
MPSiteType type = activeUser.defaultType;
|
||||
NSString *typeEntityName = [MPAlgorithmDefault classNameOfType:type];
|
||||
|
||||
MPElementEntity *element = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context];
|
||||
element.name = siteName;
|
||||
element.user = activeUser;
|
||||
element.type = type;
|
||||
element.lastUsed = [NSDate date];
|
||||
element.version = MPAlgorithmDefaultVersion;
|
||||
MPSiteEntity *site = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context];
|
||||
site.name = siteName;
|
||||
site.user = activeUser;
|
||||
site.type = type;
|
||||
site.lastUsed = [NSDate date];
|
||||
site.version = MPAlgorithmDefaultVersion;
|
||||
|
||||
NSError *error = nil;
|
||||
if (element.objectID.isTemporaryID && ![context obtainPermanentIDsForObjects:@[ element ] error:&error])
|
||||
err( @"Failed to obtain a permanent object ID after creating new element: %@", error );
|
||||
if (site.objectID.isTemporaryID && ![context obtainPermanentIDsForObjects:@[ site ] error:&error])
|
||||
err( @"Failed to obtain a permanent object ID after creating new site: %@", [error fullDescription] );
|
||||
|
||||
[context saveToStore];
|
||||
|
||||
completion( element, context );
|
||||
completion( site, context );
|
||||
}];
|
||||
}
|
||||
|
||||
- (MPElementEntity *)changeElement:(MPElementEntity *)element saveInContext:(NSManagedObjectContext *)context toType:(MPElementType)type {
|
||||
- (MPSiteEntity *)changeSite:(MPSiteEntity *)site saveInContext:(NSManagedObjectContext *)context toType:(MPSiteType)type {
|
||||
|
||||
if (element.type == type)
|
||||
return element;
|
||||
if (site.type == type)
|
||||
return site;
|
||||
|
||||
if ([element.algorithm classOfType:type] == element.typeClass) {
|
||||
element.type = type;
|
||||
if ([site.algorithm classOfType:type] == site.typeClass) {
|
||||
site.type = type;
|
||||
[context saveToStore];
|
||||
}
|
||||
|
||||
else {
|
||||
// Type requires a different class of element. Recreate the element.
|
||||
NSString *typeEntityName = [element.algorithm classNameOfType:type];
|
||||
MPElementEntity *newElement = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context];
|
||||
newElement.type = type;
|
||||
newElement.name = element.name;
|
||||
newElement.user = element.user;
|
||||
newElement.uses = element.uses;
|
||||
newElement.lastUsed = element.lastUsed;
|
||||
newElement.version = element.version;
|
||||
newElement.loginName = element.loginName;
|
||||
// Type requires a different class of site. Recreate the site.
|
||||
NSString *typeEntityName = [site.algorithm classNameOfType:type];
|
||||
MPSiteEntity *newSite = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context];
|
||||
newSite.type = type;
|
||||
newSite.name = site.name;
|
||||
newSite.user = site.user;
|
||||
newSite.uses = site.uses;
|
||||
newSite.lastUsed = site.lastUsed;
|
||||
newSite.version = site.version;
|
||||
newSite.loginName = site.loginName;
|
||||
|
||||
NSError *error = nil;
|
||||
if (![context obtainPermanentIDsForObjects:@[ newElement ] error:&error])
|
||||
err( @"Failed to obtain a permanent object ID after changing object type: %@", error );
|
||||
if (![context obtainPermanentIDsForObjects:@[ newSite ] error:&error])
|
||||
err( @"Failed to obtain a permanent object ID after changing object type: %@", [error fullDescription] );
|
||||
|
||||
[context deleteObject:element];
|
||||
[context deleteObject:site];
|
||||
[context saveToStore];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPElementUpdatedNotification object:element.objectID];
|
||||
element = newElement;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPSiteUpdatedNotification object:site.objectID];
|
||||
site = newSite;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPElementUpdatedNotification object:element.objectID];
|
||||
return element;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPSiteUpdatedNotification object:site.objectID];
|
||||
return site;
|
||||
}
|
||||
|
||||
- (MPImportResult)importSites:(NSString *)importedSitesString
|
||||
@@ -431,7 +512,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
initWithPattern:@"^#[[:space:]]*([^:]+): (.*)"
|
||||
options:(NSRegularExpressionOptions)0 error:&error];
|
||||
if (error) {
|
||||
err( @"Error loading the header pattern: %@", error );
|
||||
err( @"Error loading the header pattern: %@", [error fullDescription] );
|
||||
return MPImportResultInternalError;
|
||||
}
|
||||
}
|
||||
@@ -445,7 +526,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
options:(NSRegularExpressionOptions)0 error:&error]
|
||||
];
|
||||
if (error) {
|
||||
err( @"Error loading the site patterns: %@", error );
|
||||
err( @"Error loading the site patterns: %@", [error fullDescription] );
|
||||
return MPImportResultInternalError;
|
||||
}
|
||||
}
|
||||
@@ -460,9 +541,9 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
NSData *importKeyID = nil;
|
||||
BOOL headerStarted = NO, headerEnded = NO, clearText = NO;
|
||||
NSArray *importedSiteLines = [importedSitesString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
|
||||
NSMutableSet *elementsToDelete = [NSMutableSet set];
|
||||
NSMutableArray *importedSiteElements = [NSMutableArray arrayWithCapacity:[importedSiteLines count]];
|
||||
NSFetchRequest *elementFetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPElementEntity class] )];
|
||||
NSMutableSet *sitesToDelete = [NSMutableSet set];
|
||||
NSMutableArray *importedSiteSites = [NSMutableArray arrayWithCapacity:[importedSiteLines count]];
|
||||
NSFetchRequest *siteFetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPSiteEntity class] )];
|
||||
for (NSString *importedSiteLine in importedSiteLines) {
|
||||
if ([importedSiteLine hasPrefix:@"#"]) {
|
||||
// Comment or header
|
||||
@@ -484,10 +565,10 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
err( @"Invalid header format in line: %@", importedSiteLine );
|
||||
return MPImportResultMalformedInput;
|
||||
}
|
||||
NSTextCheckingResult *headerElements = [[headerPattern matchesInString:importedSiteLine options:(NSMatchingOptions)0
|
||||
NSTextCheckingResult *headerSites = [[headerPattern matchesInString:importedSiteLine options:(NSMatchingOptions)0
|
||||
range:NSMakeRange( 0, [importedSiteLine length] )] lastObject];
|
||||
NSString *headerName = [importedSiteLine substringWithRange:[headerElements rangeAtIndex:1]];
|
||||
NSString *headerValue = [importedSiteLine substringWithRange:[headerElements rangeAtIndex:2]];
|
||||
NSString *headerName = [importedSiteLine substringWithRange:[headerSites rangeAtIndex:1]];
|
||||
NSString *headerValue = [importedSiteLine substringWithRange:[headerSites rangeAtIndex:2]];
|
||||
if ([headerName isEqualToString:@"User Name"]) {
|
||||
importUserName = headerValue;
|
||||
|
||||
@@ -495,7 +576,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
userFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@", importUserName];
|
||||
NSArray *users = [context executeFetchRequest:userFetchRequest error:&error];
|
||||
if (!users) {
|
||||
err( @"While looking for user: %@, error: %@", importUserName, error );
|
||||
err( @"While looking for user: %@, error: %@", importUserName, [error fullDescription] );
|
||||
return MPImportResultInternalError;
|
||||
}
|
||||
if ([users count] > 1) {
|
||||
@@ -579,27 +660,27 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
// Find existing site.
|
||||
if (user) {
|
||||
elementFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@ AND user == %@", siteName, user];
|
||||
NSArray *existingSites = [context executeFetchRequest:elementFetchRequest error:&error];
|
||||
siteFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@ AND user == %@", siteName, user];
|
||||
NSArray *existingSites = [context executeFetchRequest:siteFetchRequest error:&error];
|
||||
if (!existingSites) {
|
||||
err( @"Lookup of existing sites failed for site: %@, user: %@, error: %@", siteName, user.userID, error );
|
||||
err( @"Lookup of existing sites failed for site: %@, user: %@, error: %@", siteName, user.userID, [error fullDescription] );
|
||||
return MPImportResultInternalError;
|
||||
}
|
||||
if ([existingSites count]) {
|
||||
dbg( @"Existing sites: %@", existingSites );
|
||||
[elementsToDelete addObjectsFromArray:existingSites];
|
||||
[sitesToDelete addObjectsFromArray:existingSites];
|
||||
}
|
||||
}
|
||||
[importedSiteElements addObject:@[ lastUsed, uses, type, version, counter, loginName, siteName, exportContent ]];
|
||||
[importedSiteSites addObject:@[ lastUsed, uses, type, version, counter, loginName, siteName, exportContent ]];
|
||||
dbg( @"Will import site: lastUsed=%@, uses=%@, type=%@, version=%@, counter=%@, loginName=%@, siteName=%@, exportContent=%@",
|
||||
lastUsed, uses, type, version, counter, loginName, siteName, exportContent );
|
||||
}
|
||||
|
||||
// Ask for confirmation to import these sites and the master password of the user.
|
||||
inf( @"Importing %lu sites, deleting %lu sites, for user: %@", (unsigned long)[importedSiteElements count],
|
||||
(unsigned long)[elementsToDelete count], [MPUserEntity idFor:importUserName] );
|
||||
NSString *userMasterPassword = askUserPassword( user? user.name: importUserName, [importedSiteElements count],
|
||||
[elementsToDelete count] );
|
||||
inf( @"Importing %lu sites, deleting %lu sites, for user: %@", (unsigned long)[importedSiteSites count],
|
||||
(unsigned long)[sitesToDelete count], [MPUserEntity idFor:importUserName] );
|
||||
NSString *userMasterPassword = askUserPassword( user? user.name: importUserName, [importedSiteSites count],
|
||||
[sitesToDelete count] );
|
||||
if (!userMasterPassword) {
|
||||
inf( @"Import cancelled." );
|
||||
return MPImportResultCancelled;
|
||||
@@ -615,8 +696,8 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
|
||||
// Delete existing sites.
|
||||
if (elementsToDelete.count)
|
||||
[elementsToDelete enumerateObjectsUsingBlock:^(id obj, BOOL *stop) {
|
||||
if (sitesToDelete.count)
|
||||
[sitesToDelete enumerateObjectsUsingBlock:^(id obj, BOOL *stop) {
|
||||
inf( @"Deleting site: %@, it will be replaced by an imported site.", [obj name] );
|
||||
[context deleteObject:obj];
|
||||
}];
|
||||
@@ -637,10 +718,10 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
}
|
||||
|
||||
// Import new sites.
|
||||
for (NSArray *siteElements in importedSiteElements) {
|
||||
for (NSArray *siteElements in importedSiteSites) {
|
||||
NSDate *lastUsed = [[NSDateFormatter rfc3339DateFormatter] dateFromString:siteElements[0]];
|
||||
NSUInteger uses = (unsigned)[siteElements[1] integerValue];
|
||||
MPElementType type = (MPElementType)[siteElements[2] integerValue];
|
||||
MPSiteType type = (MPSiteType)[siteElements[2] integerValue];
|
||||
NSUInteger version = (unsigned)[siteElements[3] integerValue];
|
||||
NSUInteger counter = [siteElements[4] length]? (unsigned)[siteElements[4] integerValue]: NSNotFound;
|
||||
NSString *loginName = [siteElements[5] length]? siteElements[5]: nil;
|
||||
@@ -649,31 +730,34 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
|
||||
// Create new site.
|
||||
NSString *typeEntityName = [MPAlgorithmForVersion( version ) classNameOfType:type];
|
||||
MPElementEntity *element = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context];
|
||||
element.name = siteName;
|
||||
element.loginName = loginName;
|
||||
element.user = user;
|
||||
element.type = type;
|
||||
element.uses = uses;
|
||||
element.lastUsed = lastUsed;
|
||||
element.version = version;
|
||||
if (!typeEntityName) {
|
||||
err( @"Invalid site type in import file: %@ has type %lu", siteName, (long)type );
|
||||
return MPImportResultInternalError;
|
||||
}
|
||||
MPSiteEntity *site = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context];
|
||||
site.name = siteName;
|
||||
site.loginName = loginName;
|
||||
site.user = user;
|
||||
site.type = type;
|
||||
site.uses = uses;
|
||||
site.lastUsed = lastUsed;
|
||||
site.version = version;
|
||||
if ([exportContent length]) {
|
||||
if (clearText)
|
||||
[element.algorithm importClearTextPassword:exportContent intoElement:element usingKey:userKey];
|
||||
[site.algorithm importClearTextPassword:exportContent intoSite:site usingKey:userKey];
|
||||
else
|
||||
[element.algorithm importProtectedPassword:exportContent protectedByKey:importKey intoElement:element usingKey:userKey];
|
||||
[site.algorithm importProtectedPassword:exportContent protectedByKey:importKey intoSite:site usingKey:userKey];
|
||||
}
|
||||
if ([element isKindOfClass:[MPElementGeneratedEntity class]] && counter != NSNotFound)
|
||||
((MPElementGeneratedEntity *)element).counter = counter;
|
||||
if ([site isKindOfClass:[MPGeneratedSiteEntity class]] && counter != NSNotFound)
|
||||
((MPGeneratedSiteEntity *)site).counter = counter;
|
||||
|
||||
dbg( @"Created Element: %@", [element debugDescription] );
|
||||
dbg( @"Created Site: %@", [site debugDescription] );
|
||||
}
|
||||
|
||||
if (![context saveToStore])
|
||||
return MPImportResultInternalError;
|
||||
|
||||
inf( @"Import completed successfully." );
|
||||
MPCheckpoint( MPCheckpointSitesImported, nil );
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPSitesImportedNotification object:nil userInfo:@{
|
||||
MPSitesImportedNotificationUserKey : user
|
||||
@@ -712,27 +796,27 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
[export appendFormat:@"# used used type name\t name\tpassword\n"];
|
||||
|
||||
// Sites.
|
||||
for (MPElementEntity *element in activeUser.elements) {
|
||||
NSDate *lastUsed = element.lastUsed;
|
||||
NSUInteger uses = element.uses;
|
||||
MPElementType type = element.type;
|
||||
NSUInteger version = element.version;
|
||||
for (MPSiteEntity *site in activeUser.sites) {
|
||||
NSDate *lastUsed = site.lastUsed;
|
||||
NSUInteger uses = site.uses;
|
||||
MPSiteType type = site.type;
|
||||
NSUInteger version = site.version;
|
||||
NSUInteger counter = 0;
|
||||
NSString *loginName = element.loginName;
|
||||
NSString *siteName = element.name;
|
||||
NSString *loginName = site.loginName;
|
||||
NSString *siteName = site.name;
|
||||
NSString *content = nil;
|
||||
|
||||
// Generated-specific
|
||||
if ([element isKindOfClass:[MPElementGeneratedEntity class]])
|
||||
counter = ((MPElementGeneratedEntity *)element).counter;
|
||||
if ([site isKindOfClass:[MPGeneratedSiteEntity class]])
|
||||
counter = ((MPGeneratedSiteEntity *)site).counter;
|
||||
|
||||
|
||||
// Determine the content to export.
|
||||
if (!(type & MPElementFeatureDevicePrivate)) {
|
||||
if (!(type & MPSiteFeatureDevicePrivate)) {
|
||||
if (revealPasswords)
|
||||
content = [element.algorithm resolvePasswordForElement:element usingKey:self.key];
|
||||
else if (type & MPElementFeatureExportContent)
|
||||
content = [element.algorithm exportPasswordForElement:element usingKey:self.key];
|
||||
content = [site.algorithm resolvePasswordForSite:site usingKey:self.key];
|
||||
else if (type & MPSiteFeatureExportContent)
|
||||
content = [site.algorithm exportPasswordForSite:site usingKey:self.key];
|
||||
}
|
||||
|
||||
[export appendFormat:@"%@ %8ld %8s %25s\t%25s\t%@\n",
|
||||
@@ -741,10 +825,6 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
|
||||
[(loginName?: @"") UTF8String], [siteName UTF8String], content?: @""];
|
||||
}
|
||||
|
||||
MPCheckpoint( MPCheckpointSitesExported, @{
|
||||
@"showPasswords" : @(revealPasswords)
|
||||
} );
|
||||
|
||||
return export;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// MPElementEntity.h
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
@class MPUserEntity;
|
||||
|
||||
@interface MPElementEntity : NSManagedObject
|
||||
|
||||
//@property (nonatomic, retain) id content; // Hide here, reveal in MPElementStoredEntity
|
||||
@property (nonatomic, retain) NSDate * lastUsed;
|
||||
@property (nonatomic, retain) NSString * loginName;
|
||||
@property (nonatomic, retain) NSString * name;
|
||||
@property (nonatomic, retain) NSNumber * requiresExplicitMigration_;
|
||||
@property (nonatomic, retain) NSNumber * type_;
|
||||
@property (nonatomic, retain) NSNumber * uses_;
|
||||
@property (nonatomic, retain) NSNumber * version_;
|
||||
@property (nonatomic, retain) NSNumber * loginGenerated_;
|
||||
@property (nonatomic, retain) MPUserEntity *user;
|
||||
|
||||
@end
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// MPElementGeneratedEntity.m
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
|
||||
|
||||
@implementation MPElementGeneratedEntity
|
||||
|
||||
@dynamic counter_;
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// MPElementStoredEntity.h
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
#import "MPElementEntity.h"
|
||||
|
||||
|
||||
@interface MPElementStoredEntity : MPElementEntity
|
||||
|
||||
@property (nonatomic, retain) NSData * contentObject;
|
||||
|
||||
@end
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// MPElementStoredEntity.m
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPElementStoredEntity.h"
|
||||
|
||||
|
||||
@implementation MPElementStoredEntity
|
||||
|
||||
@dynamic contentObject;
|
||||
|
||||
@end
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MPElementEntities.h
|
||||
// MPEntities.h
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 31/05/12.
|
||||
@@ -7,9 +7,9 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MPElementEntity.h"
|
||||
#import "MPElementStoredEntity.h"
|
||||
#import "MPElementGeneratedEntity.h"
|
||||
#import "MPSiteEntity.h"
|
||||
#import "MPStoredSiteEntity.h"
|
||||
#import "MPGeneratedSiteEntity.h"
|
||||
#import "MPUserEntity.h"
|
||||
#import "MPAlgorithm.h"
|
||||
#import "MPFixable.h"
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface MPElementEntity(MP)<MPFixable>
|
||||
@interface MPSiteEntity(MP)<MPFixable>
|
||||
|
||||
@property(assign) BOOL loginGenerated;
|
||||
@property(assign) MPElementType type;
|
||||
@property(assign) MPSiteType type;
|
||||
@property(readonly) NSString *typeName;
|
||||
@property(readonly) NSString *typeShortName;
|
||||
@property(readonly) NSString *typeClassName;
|
||||
@@ -36,7 +36,7 @@
|
||||
@property(readonly) id<MPAlgorithm> algorithm;
|
||||
|
||||
- (NSUInteger)use;
|
||||
- (BOOL)migrateExplicitly:(BOOL)explicit;
|
||||
- (BOOL)tryMigrateExplicitly:(BOOL)explicit;
|
||||
- (NSString *)resolveLoginUsingKey:(MPKey *)key;
|
||||
- (NSString *)resolvePasswordUsingKey:(MPKey *)key;
|
||||
- (void)resolveLoginUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface MPElementGeneratedEntity(MP)
|
||||
@interface MPGeneratedSiteEntity(MP)
|
||||
|
||||
@property(assign) NSUInteger counter;
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
@property(assign) NSUInteger avatar;
|
||||
@property(assign) BOOL saveKey;
|
||||
@property(assign) MPElementType defaultType;
|
||||
@property(assign) MPSiteType defaultType;
|
||||
@property(readonly) NSString *userID;
|
||||
|
||||
+ (NSString *)idFor:(NSString *)userName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MPElementEntities.m
|
||||
// MPEntities.m
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 31/05/12.
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#import "MPEntities.h"
|
||||
#import "MPAppDelegate_Shared.h"
|
||||
#import "MPAppDelegate_Store.h"
|
||||
|
||||
@implementation NSManagedObjectContext(MP)
|
||||
|
||||
@@ -24,7 +23,7 @@
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
success = NO;
|
||||
err( @"While saving: %@", exception );
|
||||
err( @"While saving: %@", [exception fullDescription] );
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -34,16 +33,16 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPElementEntity(MP)
|
||||
@implementation MPSiteEntity(MP)
|
||||
|
||||
- (MPFixableResult)findAndFixInconsistenciesInContext:(NSManagedObjectContext *)context {
|
||||
|
||||
return MPFixableResultNoProblems;
|
||||
}
|
||||
|
||||
- (MPElementType)type {
|
||||
- (MPSiteType)type {
|
||||
|
||||
return (MPElementType)[self.type_ unsignedIntegerValue];
|
||||
return (MPSiteType)[self.type_ unsignedIntegerValue];
|
||||
}
|
||||
|
||||
- (void)setLoginGenerated:(BOOL)aLoginGenerated {
|
||||
@@ -56,7 +55,7 @@
|
||||
return [self.loginGenerated_ boolValue];
|
||||
}
|
||||
|
||||
- (void)setType:(MPElementType)aType {
|
||||
- (void)setType:(MPSiteType)aType {
|
||||
|
||||
self.type_ = @(aType);
|
||||
}
|
||||
@@ -129,56 +128,63 @@
|
||||
|
||||
- (NSString *)debugDescription {
|
||||
|
||||
@try {
|
||||
return strf( @"{%@: name=%@, user=%@, type=%lu, uses=%ld, lastUsed=%@, version=%ld, loginName=%@, requiresExplicitMigration=%d}",
|
||||
NSStringFromClass( [self class] ), self.name, self.user.name, (long)self.type, (long)self.uses, self.lastUsed,
|
||||
(long)self.version,
|
||||
self.loginName, self.requiresExplicitMigration );
|
||||
} @catch (NSException *exception) {
|
||||
return strf( @"{%@: inaccessible: %@}",
|
||||
NSStringFromClass( [self class] ), [exception fullDescription] );
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)migrateExplicitly:(BOOL)explicit {
|
||||
- (BOOL)tryMigrateExplicitly:(BOOL)explicit {
|
||||
|
||||
while (self.version < MPAlgorithmDefaultVersion)
|
||||
if ([MPAlgorithmForVersion( self.version + 1 ) migrateElement:self explicit:explicit])
|
||||
inf( @"%@ migration to version: %ld succeeded for element: %@",
|
||||
explicit? @"Explicit": @"Automatic", (long)self.version + 1, self );
|
||||
else {
|
||||
wrn( @"%@ migration to version: %ld failed for element: %@",
|
||||
explicit? @"Explicit": @"Automatic", (long)self.version + 1, self );
|
||||
while (self.version < MPAlgorithmDefaultVersion) {
|
||||
NSUInteger toVersion = self.version + 1;
|
||||
if (![MPAlgorithmForVersion( toVersion ) tryMigrateSite:self explicit:explicit]) {
|
||||
wrn( @"%@ migration to version: %ld failed for site: %@",
|
||||
explicit? @"Explicit": @"Automatic", (long)toVersion, self );
|
||||
return NO;
|
||||
}
|
||||
|
||||
inf( @"%@ migration to version: %ld succeeded for site: %@",
|
||||
explicit? @"Explicit": @"Automatic", (long)toVersion, self );
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *)resolveLoginUsingKey:(MPKey *)key {
|
||||
|
||||
return [self.algorithm resolveLoginForElement:self usingKey:key];
|
||||
return [self.algorithm resolveLoginForSite:self usingKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)resolvePasswordUsingKey:(MPKey *)key {
|
||||
|
||||
return [self.algorithm resolvePasswordForElement:self usingKey:key];
|
||||
return [self.algorithm resolvePasswordForSite:self usingKey:key];
|
||||
}
|
||||
|
||||
- (void)resolveLoginUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result {
|
||||
|
||||
[self.algorithm resolveLoginForElement:self usingKey:key result:result];
|
||||
[self.algorithm resolveLoginForSite:self usingKey:key result:result];
|
||||
}
|
||||
|
||||
- (void)resolvePasswordUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result {
|
||||
|
||||
[self.algorithm resolvePasswordForElement:self usingKey:key result:result];
|
||||
[self.algorithm resolvePasswordForSite:self usingKey:key result:result];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPElementGeneratedEntity(MP)
|
||||
@implementation MPGeneratedSiteEntity(MP)
|
||||
|
||||
- (MPFixableResult)findAndFixInconsistenciesInContext:(NSManagedObjectContext *)context {
|
||||
|
||||
MPFixableResult result = [super findAndFixInconsistenciesInContext:context];
|
||||
|
||||
if (!self.type || self.type == (MPElementType)NSNotFound || ![[self.algorithm allTypes] containsObject:self.type_])
|
||||
if (!self.type || self.type == (MPSiteType)NSNotFound || ![[self.algorithm allTypes] containsObject:self.type_])
|
||||
// Invalid self.type
|
||||
result = MPApplyFix( result, ^MPFixableResult {
|
||||
wrn( @"Invalid type for: %@ of %@, type: %ld. Will use %ld instead.",
|
||||
@@ -186,18 +192,18 @@
|
||||
self.type = self.user.defaultType;
|
||||
return MPFixableResultProblemsFixed;
|
||||
} );
|
||||
if (!self.type || self.type == (MPElementType)NSNotFound || ![[self.algorithm allTypes] containsObject:self.type_])
|
||||
if (!self.type || self.type == (MPSiteType)NSNotFound || ![[self.algorithm allTypes] containsObject:self.type_])
|
||||
// Invalid self.user.defaultType
|
||||
result = MPApplyFix( result, ^MPFixableResult {
|
||||
wrn( @"Invalid type for: %@ of %@, type: %ld. Will use %ld instead.",
|
||||
self.name, self.user.name, (long)self.type, (long)MPElementTypeGeneratedLong );
|
||||
self.type = MPElementTypeGeneratedLong;
|
||||
self.name, self.user.name, (long)self.type, (long)MPSiteTypeGeneratedLong );
|
||||
self.type = MPSiteTypeGeneratedLong;
|
||||
return MPFixableResultProblemsFixed;
|
||||
} );
|
||||
if (![self isKindOfClass:[self.algorithm classOfType:self.type]])
|
||||
// Mismatch between self.type and self.class
|
||||
result = MPApplyFix( result, ^MPFixableResult {
|
||||
for (MPElementType newType = self.type; self.type != (newType = [self.algorithm nextType:newType]);)
|
||||
for (MPSiteType newType = self.type; self.type != (newType = [self.algorithm nextType:newType]);)
|
||||
if ([self isKindOfClass:[self.algorithm classOfType:newType]]) {
|
||||
wrn( @"Mismatching type for: %@ of %@, type: %lu, class: %@. Will use %ld instead.",
|
||||
self.name, self.user.name, (long)self.type, self.class, (long)newType );
|
||||
@@ -225,7 +231,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPElementStoredEntity(MP)
|
||||
@implementation MPStoredSiteEntity(MP)
|
||||
|
||||
- (MPFixableResult)findAndFixInconsistenciesInContext:(NSManagedObjectContext *)context {
|
||||
|
||||
@@ -236,7 +242,7 @@
|
||||
MPKey *key = [MPAppDelegate_Shared get].key;
|
||||
if (key && [[MPAppDelegate_Shared get] activeUserInContext:context] == self.user) {
|
||||
wrn( @"Content object not encrypted for: %@ of %@. Will re-encrypt.", self.name, self.user.name );
|
||||
[self.algorithm savePassword:[self.contentObject description] toElement:self usingKey:key];
|
||||
[self.algorithm savePassword:[self.contentObject description] toSite:self usingKey:key];
|
||||
return MPFixableResultProblemsFixed;
|
||||
}
|
||||
|
||||
@@ -271,12 +277,12 @@
|
||||
self.saveKey_ = @(aSaveKey);
|
||||
}
|
||||
|
||||
- (MPElementType)defaultType {
|
||||
- (MPSiteType)defaultType {
|
||||
|
||||
return (MPElementType)[self.defaultType_ unsignedIntegerValue]?: MPElementTypeGeneratedLong;
|
||||
return (MPSiteType)[self.defaultType_ unsignedIntegerValue]?: MPSiteTypeGeneratedLong;
|
||||
}
|
||||
|
||||
- (void)setDefaultType:(MPElementType)aDefaultType {
|
||||
- (void)setDefaultType:(MPSiteType)aDefaultType {
|
||||
|
||||
self.defaultType_ = @(aDefaultType);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
//
|
||||
// MPElementGeneratedEntity.h
|
||||
// MasterPassword-iOS
|
||||
// MPGeneratedSiteEntity.h
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
#import "MPElementEntity.h"
|
||||
#import "MPSiteEntity.h"
|
||||
|
||||
|
||||
@interface MPElementGeneratedEntity : MPElementEntity
|
||||
@interface MPGeneratedSiteEntity : MPSiteEntity
|
||||
|
||||
@property (nonatomic, retain) NSNumber * counter_;
|
||||
|
||||
16
MasterPassword/ObjC/MPGeneratedSiteEntity.m
Normal file
16
MasterPassword/ObjC/MPGeneratedSiteEntity.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MPGeneratedSiteEntity.m
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPGeneratedSiteEntity.h"
|
||||
|
||||
|
||||
@implementation MPGeneratedSiteEntity
|
||||
|
||||
@dynamic counter_;
|
||||
|
||||
@end
|
||||
41
MasterPassword/ObjC/MPSiteEntity.h
Normal file
41
MasterPassword/ObjC/MPSiteEntity.h
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// MPSiteEntity.h
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
@class MPSiteQuestionEntity, MPUserEntity;
|
||||
|
||||
@interface MPSiteEntity : NSManagedObject
|
||||
|
||||
//@property (nonatomic, retain) id content; // Hide here, reveal in MPStoredSiteEntity
|
||||
@property (nonatomic, retain) NSDate * lastUsed;
|
||||
@property (nonatomic, retain) NSNumber * loginGenerated_;
|
||||
@property (nonatomic, retain) NSString * loginName;
|
||||
@property (nonatomic, retain) NSString * name;
|
||||
@property (nonatomic, retain) NSNumber * requiresExplicitMigration_;
|
||||
@property (nonatomic, retain) NSNumber * type_;
|
||||
@property (nonatomic, retain) NSNumber * uses_;
|
||||
@property (nonatomic, retain) NSNumber * version_;
|
||||
@property (nonatomic, retain) NSOrderedSet *questions;
|
||||
@property (nonatomic, retain) MPUserEntity *user;
|
||||
@end
|
||||
|
||||
@interface MPSiteEntity (CoreDataGeneratedAccessors)
|
||||
|
||||
- (void)insertObject:(MPSiteQuestionEntity *)value inQuestionsAtIndex:(NSUInteger)idx;
|
||||
- (void)removeObjectFromQuestionsAtIndex:(NSUInteger)idx;
|
||||
- (void)insertQuestions:(NSArray *)value atIndexes:(NSIndexSet *)indexes;
|
||||
- (void)removeQuestionsAtIndexes:(NSIndexSet *)indexes;
|
||||
- (void)replaceObjectInQuestionsAtIndex:(NSUInteger)idx withObject:(MPSiteQuestionEntity *)value;
|
||||
- (void)replaceQuestionsAtIndexes:(NSIndexSet *)indexes withQuestions:(NSArray *)values;
|
||||
- (void)addQuestionsObject:(MPSiteQuestionEntity *)value;
|
||||
- (void)removeQuestionsObject:(MPSiteQuestionEntity *)value;
|
||||
- (void)addQuestions:(NSOrderedSet *)values;
|
||||
- (void)removeQuestions:(NSOrderedSet *)values;
|
||||
@end
|
||||
@@ -1,26 +1,28 @@
|
||||
//
|
||||
// MPElementEntity.m
|
||||
// MasterPassword-iOS
|
||||
// MPSiteEntity.m
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPElementEntity.h"
|
||||
#import "MPSiteEntity.h"
|
||||
#import "MPSiteQuestionEntity.h"
|
||||
#import "MPUserEntity.h"
|
||||
|
||||
|
||||
@implementation MPElementEntity
|
||||
@implementation MPSiteEntity
|
||||
|
||||
//@dynamic content;
|
||||
@dynamic lastUsed;
|
||||
@dynamic loginGenerated_;
|
||||
@dynamic loginName;
|
||||
@dynamic name;
|
||||
@dynamic requiresExplicitMigration_;
|
||||
@dynamic type_;
|
||||
@dynamic uses_;
|
||||
@dynamic version_;
|
||||
@dynamic loginGenerated_;
|
||||
@dynamic questions;
|
||||
@dynamic user;
|
||||
|
||||
@end
|
||||
19
MasterPassword/ObjC/MPSiteQuestionEntity.h
Normal file
19
MasterPassword/ObjC/MPSiteQuestionEntity.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MPSiteQuestionEntity.h
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-27.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
@class MPSiteEntity;
|
||||
|
||||
@interface MPSiteQuestionEntity : NSManagedObject
|
||||
|
||||
@property (nonatomic, retain) NSString * keyword;
|
||||
@property (nonatomic, retain) MPSiteEntity *site;
|
||||
|
||||
@end
|
||||
18
MasterPassword/ObjC/MPSiteQuestionEntity.m
Normal file
18
MasterPassword/ObjC/MPSiteQuestionEntity.m
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MPSiteQuestionEntity.m
|
||||
// MasterPassword-iOS
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-27.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPSiteQuestionEntity.h"
|
||||
#import "MPSiteEntity.h"
|
||||
|
||||
|
||||
@implementation MPSiteQuestionEntity
|
||||
|
||||
@dynamic keyword;
|
||||
@dynamic site;
|
||||
|
||||
@end
|
||||
18
MasterPassword/ObjC/MPStoredSiteEntity.h
Normal file
18
MasterPassword/ObjC/MPStoredSiteEntity.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MPStoredSiteEntity.h
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
#import "MPSiteEntity.h"
|
||||
|
||||
|
||||
@interface MPStoredSiteEntity : MPSiteEntity
|
||||
|
||||
@property (nonatomic, retain) NSData *contentObject;
|
||||
|
||||
@end
|
||||
16
MasterPassword/ObjC/MPStoredSiteEntity.m
Normal file
16
MasterPassword/ObjC/MPStoredSiteEntity.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MPStoredSiteEntity.m
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPStoredSiteEntity.h"
|
||||
|
||||
|
||||
@implementation MPStoredSiteEntity
|
||||
|
||||
@dynamic contentObject;
|
||||
|
||||
@end
|
||||
@@ -8,83 +8,52 @@
|
||||
|
||||
#import "MPKey.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPElementTypeClass) {
|
||||
typedef NS_ENUM( NSUInteger, MPSiteTypeClass ) {
|
||||
/** Generate the password. */
|
||||
MPElementTypeClassGenerated = 1 << 4,
|
||||
MPSiteTypeClassGenerated = 1 << 4,
|
||||
/** Store the password. */
|
||||
MPElementTypeClassStored = 1 << 5,
|
||||
MPSiteTypeClassStored = 1 << 5,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPElementVariant) {
|
||||
typedef NS_ENUM( NSUInteger, MPSiteVariant ) {
|
||||
/** Generate the password. */
|
||||
MPElementVariantPassword,
|
||||
MPSiteVariantPassword,
|
||||
/** Generate the login name. */
|
||||
MPElementVariantLogin,
|
||||
MPSiteVariantLogin,
|
||||
/** Generate a security answer. */
|
||||
MPSiteVariantAnswer,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPElementFeature) {
|
||||
typedef NS_ENUM( NSUInteger, MPSiteFeature ) {
|
||||
/** Export the key-protected content data. */
|
||||
MPElementFeatureExportContent = 1 << 10,
|
||||
MPSiteFeatureExportContent = 1 << 10,
|
||||
/** Never export content. */
|
||||
MPElementFeatureDevicePrivate = 1 << 11,
|
||||
MPSiteFeatureDevicePrivate = 1 << 11,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPElementType) {
|
||||
MPElementTypeGeneratedMaximum = 0x0 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedLong = 0x1 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedMedium = 0x2 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedBasic = 0x4 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedShort = 0x3 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedPIN = 0x5 | MPElementTypeClassGenerated | 0x0,
|
||||
MPElementTypeGeneratedName = 0xF | MPElementTypeClassGenerated | 0x0,
|
||||
typedef NS_ENUM(NSUInteger, MPSiteType) {
|
||||
MPSiteTypeGeneratedMaximum = 0x0 | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedLong = 0x1 | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedMedium = 0x2 | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedBasic = 0x4 | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedShort = 0x3 | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedPIN = 0x5 | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedName = 0xE | MPSiteTypeClassGenerated | 0x0,
|
||||
MPSiteTypeGeneratedPhrase = 0xF | MPSiteTypeClassGenerated | 0x0,
|
||||
|
||||
MPElementTypeStoredPersonal = 0x0 | MPElementTypeClassStored | MPElementFeatureExportContent,
|
||||
MPElementTypeStoredDevicePrivate = 0x1 | MPElementTypeClassStored | MPElementFeatureDevicePrivate,
|
||||
MPSiteTypeStoredPersonal = 0x0 | MPSiteTypeClassStored | MPSiteFeatureExportContent,
|
||||
MPSiteTypeStoredDevicePrivate = 0x1 | MPSiteTypeClassStored | MPSiteFeatureDevicePrivate,
|
||||
};
|
||||
|
||||
#define MPErrorDomain @"MPErrorDomain"
|
||||
|
||||
#define MPCheckpointHelpChapter @"MPCheckpointHelpChapter"
|
||||
#define MPCheckpointCopyToPasteboard @"MPCheckpointCopyToPasteboard"
|
||||
#define MPCheckpointCopyLoginNameToPasteboard @"MPCheckpointCopyLoginNameToPasteboard"
|
||||
#define MPCheckpointResetPasswordCounter @"MPCheckpointResetPasswordCounter"
|
||||
#define MPCheckpointIncrementPasswordCounter @"MPCheckpointIncrementPasswordCounter"
|
||||
#define MPCheckpointEditPassword @"MPCheckpointEditPassword"
|
||||
#define MPCheckpointEditLoginName @"MPCheckpointEditLoginName"
|
||||
#define MPCheckpointUseType @"MPCheckpointUseType"
|
||||
#define MPCheckpointDeleteElement @"MPCheckpointDeleteElement"
|
||||
#define MPCheckpointShowGuide @"MPCheckpointShowGuide"
|
||||
#define MPCheckpointShowSetup @"MPCheckpointShowSetup"
|
||||
#define MPCheckpointChangeMP @"MPCheckpointChangeMP"
|
||||
#define MPCheckpointMPErrorUbiquity @"MPCheckpointMPErrorUbiquity"
|
||||
#define MPCheckpointLocalStoreReset @"MPCheckpointLocalStoreReset"
|
||||
#define MPCheckpointCloudStoreReset @"MPCheckpointCloudStoreReset"
|
||||
#define MPCheckpointSignInFailed @"MPCheckpointSignInFailed"
|
||||
#define MPCheckpointSignedIn @"MPCheckpointSignedIn"
|
||||
#define MPCheckpointConfig @"MPCheckpointConfig"
|
||||
#define MPCheckpointCloud @"MPCheckpointCloud"
|
||||
#define MPCheckpointSitesImported @"MPCheckpointSitesImported"
|
||||
#define MPCheckpointSitesExported @"MPCheckpointSitesExported"
|
||||
#define MPCheckpointExplicitMigration @"MPCheckpointExplicitMigration"
|
||||
#define MPCheckpointReview @"MPCheckpointReview"
|
||||
#define MPCheckpointApps @"MPCheckpointApps"
|
||||
#define MPCheckpointApp @"MPCheckpointApp"
|
||||
#define MPCheckpointEmergencyGenerator @"MPCheckpointEmergencyGenerator"
|
||||
#define MPCheckpointLogs @"MPCheckpointLogs"
|
||||
#define MPCheckpointStarted @"MPCheckpointStarted"
|
||||
|
||||
#define MPSignedInNotification @"MPSignedInNotification"
|
||||
#define MPSignedOutNotification @"MPSignedOutNotification"
|
||||
#define MPKeyForgottenNotification @"MPKeyForgottenNotification"
|
||||
#define MPElementUpdatedNotification @"MPElementUpdatedNotification"
|
||||
#define MPSiteUpdatedNotification @"MPSiteUpdatedNotification"
|
||||
#define MPCheckConfigNotification @"MPCheckConfigNotification"
|
||||
#define MPSitesImportedNotification @"MPSitesImportedNotification"
|
||||
#define MPFoundInconsistenciesNotification @"MPFoundInconsistenciesNotification"
|
||||
|
||||
#define MPSitesImportedNotificationUserKey @"MPSitesImportedNotificationUserKey"
|
||||
#define MPInconsistenciesFixResultUserKey @"MPInconsistenciesFixResultUserKey"
|
||||
|
||||
static void MPCheckpoint(NSString *checkpoint, NSDictionary *attributes) {
|
||||
|
||||
inf(@"%@: %@", checkpoint, attributes);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
//
|
||||
// MPUserEntity.h
|
||||
// MasterPassword-iOS
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
@class MPElementEntity;
|
||||
@class MPSiteEntity;
|
||||
|
||||
@interface MPUserEntity : NSManagedObject
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
@property (nonatomic, retain) NSDate * lastUsed;
|
||||
@property (nonatomic, retain) NSString * name;
|
||||
@property (nonatomic, retain) NSNumber * saveKey_;
|
||||
@property (nonatomic, retain) NSSet *elements;
|
||||
@property (nonatomic, retain) NSSet *sites;
|
||||
@end
|
||||
|
||||
@interface MPUserEntity (CoreDataGeneratedAccessors)
|
||||
|
||||
- (void)addElementsObject:(MPElementEntity *)value;
|
||||
- (void)removeElementsObject:(MPElementEntity *)value;
|
||||
- (void)addElements:(NSSet *)values;
|
||||
- (void)removeElements:(NSSet *)values;
|
||||
- (void)addSitesObject:(MPSiteEntity *)value;
|
||||
- (void)removeSitesObject:(MPSiteEntity *)value;
|
||||
- (void)addSites:(NSSet *)values;
|
||||
- (void)removeSites:(NSSet *)values;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//
|
||||
// MPUserEntity.m
|
||||
// MasterPassword-iOS
|
||||
// MasterPassword-Mac
|
||||
//
|
||||
// Created by Maarten Billemont on 2014-09-14.
|
||||
// Created by Maarten Billemont on 2014-09-21.
|
||||
// Copyright (c) 2014 Lyndir. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPUserEntity.h"
|
||||
#import "MPElementEntity.h"
|
||||
#import "MPSiteEntity.h"
|
||||
|
||||
|
||||
@implementation MPUserEntity
|
||||
@@ -18,6 +18,6 @@
|
||||
@dynamic lastUsed;
|
||||
@dynamic name;
|
||||
@dynamic saveKey_;
|
||||
@dynamic elements;
|
||||
@dynamic sites;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,13 +8,12 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MPAppDelegate_Shared.h"
|
||||
#import "RHStatusItemView.h"
|
||||
#import "MPPasswordWindowController.h"
|
||||
#import "MPInitialWindowController.h"
|
||||
|
||||
@interface MPMacAppDelegate : MPAppDelegate_Shared<NSApplicationDelegate>
|
||||
|
||||
@property(nonatomic, strong) RHStatusItemView *statusView;
|
||||
@property(nonatomic, strong) NSStatusItem *statusView;
|
||||
@property(nonatomic, strong) MPPasswordWindowController *passwordWindowController;
|
||||
@property(nonatomic, strong) MPInitialWindowController *initialWindowController;
|
||||
@property(nonatomic, weak) IBOutlet NSMenuItem *lockItem;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#import "MPMacAppDelegate.h"
|
||||
#import "MPAppDelegate_Key.h"
|
||||
#import "MPAppDelegate_Store.h"
|
||||
#import "MPPasswordWindowController.h"
|
||||
#import "PearlProfiler.h"
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <ServiceManagement/ServiceManagement.h>
|
||||
|
||||
@@ -75,36 +73,43 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
} forKeyPath:@"activeUser" options:0 context:nil];
|
||||
|
||||
// Status item.
|
||||
self.statusView = [[RHStatusItemView alloc] initWithStatusBarItem:
|
||||
[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]];
|
||||
self.statusView = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
||||
self.statusView.image = [NSImage imageNamed:@"menu-icon"];
|
||||
self.statusView.image.template = YES;
|
||||
self.statusView.menu = self.statusMenu;
|
||||
self.statusView.target = self;
|
||||
self.statusView.action = @selector( showMenu );
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:USMStoreDidChangeNotification object:nil
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
PearlAddNotificationObserver( NSPersistentStoreCoordinatorStoresWillChangeNotification, self.storeCoordinator, nil,
|
||||
^(id self, NSNotification *note) {
|
||||
PearlMainQueue( ^{
|
||||
[self updateUsers];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:USMStoreDidImportChangesNotification object:nil
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
} );
|
||||
} );
|
||||
PearlAddNotificationObserver( NSPersistentStoreCoordinatorStoresDidChangeNotification, self.storeCoordinator, nil,
|
||||
^(id self, NSNotification *note) {
|
||||
PearlMainQueue( ^{
|
||||
[self updateUsers];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
} );
|
||||
} );
|
||||
PearlAddNotificationObserver( MPCheckConfigNotification, nil, nil,
|
||||
^(MPMacAppDelegate *self, NSNotification *note) {
|
||||
PearlMainQueue( ^{
|
||||
NSString *key = note.object;
|
||||
if (!key || [key isEqualToString:NSStringFromSelector( @selector( hidePasswords ) )])
|
||||
if (!key || [key isEqualToString:NSStringFromSelector( @
|
||||
selector( hidePasswords ) )])
|
||||
self.hidePasswordsItem.state = [[MPConfig get].hidePasswords boolValue]? NSOnState: NSOffState;
|
||||
if (!key || [key isEqualToString:NSStringFromSelector( @selector( rememberLogin ) )])
|
||||
if (!key || [key isEqualToString:NSStringFromSelector( @
|
||||
selector( rememberLogin ) )])
|
||||
self.rememberPasswordItem.state = [[MPConfig get].rememberLogin boolValue]? NSOnState: NSOffState;
|
||||
}];
|
||||
} );
|
||||
} );
|
||||
[self updateUsers];
|
||||
|
||||
// Global hotkey.
|
||||
EventHotKeyRef hotKeyRef;
|
||||
EventTypeSpec hotKeyEvents[1] = { { .eventClass = kEventClassKeyboard, .eventKind = kEventHotKeyPressed } };
|
||||
OSStatus status = InstallApplicationEventHandler( NewEventHandlerUPP( MPHotKeyHander ), GetEventTypeCount( hotKeyEvents ),
|
||||
hotKeyEvents, (__bridge void *)self, NULL );
|
||||
OSStatus status = InstallApplicationEventHandler( NewEventHandlerUPP( MPHotKeyHander ), GetEventTypeCount( hotKeyEvents ), hotKeyEvents, (__bridge void *)self, NULL );
|
||||
if (status != noErr)
|
||||
err( @"Error installing application event handler: %i", (int)status );
|
||||
status = RegisterEventHotKey( 35 /* p */, controlKey + cmdKey, MPShowHotKey, GetApplicationEventTarget(), 0, &hotKeyRef );
|
||||
@@ -178,12 +183,9 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
NSArray *jobs = (__bridge_transfer NSArray *)SMCopyAllJobDictionaries( kSMDomainUserLaunchd );
|
||||
|
||||
for (NSDictionary *job in jobs)
|
||||
if ([LOGIN_HELPER_BUNDLE_ID isEqualToString:[job objectForKey:@"Label"]]) {
|
||||
dbg( @"loginItemEnabled: %@", @([[job objectForKey:@"OnDemand"] boolValue]) );
|
||||
return [[job objectForKey:@"OnDemand"] boolValue];
|
||||
}
|
||||
if ([LOGIN_HELPER_BUNDLE_ID isEqualToString:job[@"Label"]])
|
||||
return [job[@"OnDemand"] boolValue];
|
||||
|
||||
dbg( @"loginItemEnabled: not found" );
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -229,7 +231,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url]
|
||||
returningResponse:&response error:&error];
|
||||
if (error)
|
||||
err( @"While reading imported sites from %@: %@", url, error );
|
||||
err( @"While reading imported sites from %@: %@", url, [error fullDescription] );
|
||||
if (!importedSitesData)
|
||||
return;
|
||||
|
||||
@@ -305,9 +307,9 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
- (IBAction)togglePreference:(id)sender {
|
||||
|
||||
if (sender == self.hidePasswordsItem)
|
||||
[MPConfig get].hidePasswords = [NSNumber numberWithBool:![[MPConfig get].hidePasswords boolValue]];
|
||||
[MPConfig get].hidePasswords = @(![[MPConfig get].hidePasswords boolValue]);
|
||||
if (sender == self.rememberPasswordItem)
|
||||
[MPConfig get].rememberLogin = [NSNumber numberWithBool:![[MPConfig get].rememberLogin boolValue]];
|
||||
[MPConfig get].rememberLogin = @(![[MPConfig get].rememberLogin boolValue]);
|
||||
if (sender == self.openAtLoginItem)
|
||||
[self setLoginItemEnabled:self.openAtLoginItem.state != NSOnState];
|
||||
if (sender == self.savePasswordItem) {
|
||||
@@ -346,7 +348,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
[moc saveToStore];
|
||||
NSError *error = nil;
|
||||
if (![moc obtainPermanentIDsForObjects:@[ newUser ] error:&error])
|
||||
err( @"Failed to obtain permanent object ID for new user: %@", error );
|
||||
err( @"Failed to obtain permanent object ID for new user: %@", [error fullDescription] );
|
||||
|
||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
||||
[self updateUsers];
|
||||
@@ -391,7 +393,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
|
||||
- (IBAction)showPopup:(id)sender {
|
||||
|
||||
[self.statusView popUpMenu];
|
||||
[self.statusView popUpStatusItemMenu:self.statusView.menu];
|
||||
}
|
||||
|
||||
- (IBAction)showPasswordWindow:(id)sender {
|
||||
@@ -409,13 +411,10 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
}
|
||||
|
||||
// Don't show window if we weren't already running (ie. if we haven't been activated before).
|
||||
PearlProfiler *profiler = [PearlProfiler profilerForTask:@"passwordWindowController"];
|
||||
if (!self.passwordWindowController)
|
||||
self.passwordWindowController = [[MPPasswordWindowController alloc] initWithWindowNibName:@"MPPasswordWindowController"];
|
||||
[profiler finishJob:@"init"];
|
||||
|
||||
[self.passwordWindowController showWindow:self];
|
||||
[profiler finishJob:@"show"];
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
@@ -464,7 +463,9 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
[[[NSFileCoordinator alloc] initWithFilePresenter:nil] coordinateWritingItemAtURL:savePanel.URL options:0 error:&coordinateError
|
||||
byAccessor:^(NSURL *newURL) {
|
||||
NSError *writeError = nil;
|
||||
if (![exportedSites writeToURL:newURL atomically:NO encoding:NSUTF8StringEncoding error:&writeError])
|
||||
if (![exportedSites writeToURL:newURL atomically:NO
|
||||
encoding:NSUTF8StringEncoding
|
||||
error:&writeError])
|
||||
PearlMainQueue( ^{
|
||||
[[NSAlert alertWithError:writeError] runModal];
|
||||
} );
|
||||
@@ -510,7 +511,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO] ];
|
||||
NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error];
|
||||
if (!users)
|
||||
err( @"Failed to load users: %@", error );
|
||||
err( @"Failed to load users: %@", [error fullDescription] );
|
||||
|
||||
if (![users count]) {
|
||||
NSMenuItem *noUsersItem = [self.usersItem.submenu addItemWithTitle:@"No users" action:NULL keyEquivalent:@""];
|
||||
@@ -543,7 +544,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
|
||||
[self updateMenuItems];
|
||||
|
||||
[self.statusView popUpMenu];
|
||||
[self.statusView popUpStatusItemMenu:self.statusView.menu];
|
||||
}
|
||||
|
||||
- (void)updateMenuItems {
|
||||
@@ -596,30 +597,6 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UbiquityStoreManagerDelegate
|
||||
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didLoadStoreForCoordinator:(NSPersistentStoreCoordinator *)coordinator
|
||||
isCloud:(BOOL)isCloudStore {
|
||||
|
||||
[super ubiquityStoreManager:manager didLoadStoreForCoordinator:coordinator isCloud:isCloudStore];
|
||||
|
||||
if (isCloudStore) {
|
||||
NSAlert *alert = [NSAlert new];
|
||||
alert.messageText = @"iCloud Support Deprecated";
|
||||
alert.informativeText = @"Master Password is moving away from iCloud due to limited platform support and reliability issues. "
|
||||
@"\n\nMaster Password's generated passwords do not require syncing. "
|
||||
@"Your sites will always have the same passwords on all your devices. "
|
||||
@"\n\niCloud continues to work for now but will be deactivated in a future update. "
|
||||
@"Disable iCloud now to copy your iCloud sites to your device and avoid losing them when iCloud becomes discontinued.";
|
||||
[alert addButtonWithTitle:@"Disable iCloud"];
|
||||
[alert addButtonWithTitle:@"Ignore For Now"];
|
||||
|
||||
NSInteger response = [alert runModal];
|
||||
if (response == NSAlertFirstButtonReturn)
|
||||
[[self storeManager] migrateCloudToLocal];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - PearlConfigDelegate
|
||||
|
||||
- (void)didUpdateConfigForKey:(SEL)configKey fromValue:(id)oldValue {
|
||||
|
||||
@@ -9,16 +9,15 @@
|
||||
*/
|
||||
|
||||
//
|
||||
// MPEmergencySegue.h
|
||||
// MPEmergencySegue
|
||||
// MPNoStateButton.h
|
||||
// MPNoStateButton
|
||||
//
|
||||
// Created by lhunath on 2014-04-09.
|
||||
// Created by lhunath on 14-10-27.
|
||||
// Copyright, lhunath (Maarten Billemont) 2014. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MPEmergencySegue : UIStoryboardSegue
|
||||
|
||||
@property(nonatomic) BOOL unwind;
|
||||
@interface MPNoStateButtonCell : NSButtonCell
|
||||
@end
|
||||
31
MasterPassword/ObjC/Mac/MPNoStateButton.m
Normal file
31
MasterPassword/ObjC/Mac/MPNoStateButton.m
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
|
||||
*
|
||||
* See the enclosed file LICENSE for license information (LGPLv3). If you did
|
||||
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* @author Maarten Billemont <lhunath@lyndir.com>
|
||||
* @license http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*/
|
||||
|
||||
//
|
||||
// MPNoStateButton.h
|
||||
// MPNoStateButton
|
||||
//
|
||||
// Created by lhunath on 14-10-27.
|
||||
// Copyright, lhunath (Maarten Billemont) 2014. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPNoStateButton.h"
|
||||
|
||||
|
||||
@implementation MPNoStateButtonCell {
|
||||
|
||||
}
|
||||
|
||||
- (void)setState:(NSInteger)state {
|
||||
|
||||
[super setState:NSOnState];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -17,26 +17,26 @@
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MPElementModel.h"
|
||||
#import "MPElementsTableView.h"
|
||||
#import "MPSiteModel.h"
|
||||
#import "MPSitesTableView.h"
|
||||
|
||||
@class MPMacAppDelegate;
|
||||
|
||||
@interface MPPasswordWindowController : NSWindowController<NSTextViewDelegate, NSTextFieldDelegate, NSTableViewDataSource, NSTableViewDelegate>
|
||||
|
||||
@property(nonatomic) NSMutableArray *elements;
|
||||
@property(nonatomic) NSMutableArray *sites;
|
||||
@property(nonatomic) NSString *masterPassword;
|
||||
@property(nonatomic) BOOL alternatePressed;
|
||||
@property(nonatomic) BOOL locked;
|
||||
@property(nonatomic) BOOL newUser;
|
||||
|
||||
@property(nonatomic, weak) IBOutlet NSArrayController *elementsController;
|
||||
@property(nonatomic, weak) IBOutlet NSArrayController *sitesController;
|
||||
@property(nonatomic, weak) IBOutlet NSImageView *blurView;
|
||||
@property(nonatomic, weak) IBOutlet NSTextField *inputLabel;
|
||||
@property(nonatomic, weak) IBOutlet NSTextField *securePasswordField;
|
||||
@property(nonatomic, weak) IBOutlet NSTextField *revealPasswordField;
|
||||
@property(nonatomic, weak) IBOutlet NSSearchField *siteField;
|
||||
@property(nonatomic, weak) IBOutlet MPElementsTableView *siteTable;
|
||||
@property(nonatomic, weak) IBOutlet MPSitesTableView *siteTable;
|
||||
@property(nonatomic, weak) IBOutlet NSProgressIndicator *progressView;
|
||||
|
||||
@property(nonatomic, strong) IBOutlet NSBox *passwordTypesBox;
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
#import "MPPasswordWindowController.h"
|
||||
#import "MPMacAppDelegate.h"
|
||||
#import "MPAppDelegate_Store.h"
|
||||
#import "MPElementModel.h"
|
||||
#import "MPAppDelegate_Key.h"
|
||||
#import "PearlProfiler.h"
|
||||
|
||||
#define MPAlertIncorrectMP @"MPAlertIncorrectMP"
|
||||
#define MPAlertChangeMP @"MPAlertChangeMP"
|
||||
@@ -34,11 +32,11 @@
|
||||
|
||||
@interface MPPasswordWindowController()
|
||||
|
||||
@property(nonatomic, copy) NSString *currentSiteText;
|
||||
@property(nonatomic, strong) CAGradientLayer *siteGradient;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPPasswordWindowController { BOOL _skipTextChange; }
|
||||
@implementation MPPasswordWindowController
|
||||
|
||||
#pragma mark - Life
|
||||
|
||||
@@ -67,7 +65,9 @@
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillResignActiveNotification object:nil
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
#ifndef DEBUG
|
||||
[self fadeOut];
|
||||
#endif
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:MPSignedInNotification object:nil
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
@@ -77,7 +77,7 @@
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
[self updateUser];
|
||||
}];
|
||||
[self observeKeyPath:@"elementsController.selection"
|
||||
[self observeKeyPath:@"sitesController.selection"
|
||||
withBlock:^(id from, id to, NSKeyValueChange cause, id _self) {
|
||||
[_self updateSelection];
|
||||
}];
|
||||
@@ -100,7 +100,7 @@
|
||||
BOOL alternatePressed = (theEvent.modifierFlags & NSAlternateKeyMask) != 0;
|
||||
if (alternatePressed != self.alternatePressed) {
|
||||
self.alternatePressed = alternatePressed;
|
||||
[self.selectedElement updateContent];
|
||||
[self.selectedSite updateContent];
|
||||
|
||||
if (self.locked) {
|
||||
NSTextField *passwordField = self.securePasswordField;
|
||||
@@ -118,7 +118,6 @@
|
||||
|
||||
- (void)doCommandBySelector:(SEL)commandSelector {
|
||||
|
||||
dbg( @"doCommandBySelector: %@", NSStringFromSelector( commandSelector ) );
|
||||
[self handleCommand:commandSelector];
|
||||
}
|
||||
|
||||
@@ -126,13 +125,10 @@
|
||||
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector {
|
||||
|
||||
dbg( @"@control:%@ textView:%@ doCommandBySelector:%@", control, fieldEditor, NSStringFromSelector( commandSelector ) );
|
||||
if (control == self.siteField) {
|
||||
if ([NSStringFromSelector( commandSelector ) rangeOfString:@"delete"].location == 0) {
|
||||
_skipTextChange = YES;
|
||||
if ([NSStringFromSelector( commandSelector ) rangeOfString:@"delete"].location == 0)
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
if (control == self.securePasswordField || control == self.revealPasswordField) {
|
||||
if (commandSelector == @selector( insertNewline: ))
|
||||
return NO;
|
||||
@@ -169,16 +165,15 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (IBAction)doSearchElements:(id)sender {
|
||||
- (IBAction)doSearchSites:(id)sender {
|
||||
|
||||
[self updateElements];
|
||||
[self updateSites];
|
||||
}
|
||||
|
||||
#pragma mark - NSTextViewDelegate
|
||||
|
||||
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector {
|
||||
|
||||
dbg( @"textView:%@doCommandBySelector:%@", textView, NSStringFromSelector( commandSelector ) );
|
||||
return [self handleCommand:commandSelector];
|
||||
}
|
||||
|
||||
@@ -186,7 +181,7 @@
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
||||
|
||||
return (NSInteger)[self.elements count];
|
||||
return (NSInteger)[self.sites count];
|
||||
}
|
||||
|
||||
#pragma mark - NSTableViewDelegate
|
||||
@@ -229,9 +224,10 @@
|
||||
switch (returnCode) {
|
||||
case NSAlertFirstButtonReturn: {
|
||||
// "Create" button.
|
||||
[[MPMacAppDelegate get] addElementNamed:[self.siteField stringValue] completion:^(MPElementEntity *element, NSManagedObjectContext *context) {
|
||||
if (element)
|
||||
PearlMainQueue( ^{ [self updateElements]; } );
|
||||
[[MPMacAppDelegate get] addSiteNamed:[self.siteField stringValue] completion:
|
||||
^(MPSiteEntity *site, NSManagedObjectContext *context) {
|
||||
if (site)
|
||||
PearlMainQueue( ^{ [self updateSites]; } );
|
||||
}];
|
||||
break;
|
||||
}
|
||||
@@ -243,11 +239,11 @@
|
||||
switch (returnCode) {
|
||||
case NSAlertFirstButtonReturn: {
|
||||
// "Save" button.
|
||||
MPElementType type = (MPElementType)[self.passwordTypesMatrix.selectedCell tag];
|
||||
MPSiteType type = (MPSiteType)[self.passwordTypesMatrix.selectedCell tag];
|
||||
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
||||
MPElementEntity *entity = [[MPMacAppDelegate get] changeElement:[self.selectedElement entityInContext:context]
|
||||
MPSiteEntity *entity = [[MPMacAppDelegate get] changeSite:[self.selectedSite entityInContext:context]
|
||||
saveInContext:context toType:type];
|
||||
if ([entity isKindOfClass:[MPElementStoredEntity class]] && ![(MPElementStoredEntity *)entity contentObject].length)
|
||||
if ([entity isKindOfClass:[MPStoredSiteEntity class]] && ![(MPStoredSiteEntity *)entity contentObject].length)
|
||||
PearlMainQueue( ^{
|
||||
[self changePassword:nil];
|
||||
} );
|
||||
@@ -264,7 +260,7 @@
|
||||
// "Save" button.
|
||||
NSString *loginName = [(NSSecureTextField *)alert.accessoryView stringValue];
|
||||
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
||||
MPElementEntity *entity = [self.selectedElement entityInContext:context];
|
||||
MPSiteEntity *entity = [self.selectedSite entityInContext:context];
|
||||
entity.loginName = loginName;
|
||||
[context saveToStore];
|
||||
}];
|
||||
@@ -280,8 +276,8 @@
|
||||
// "Save" button.
|
||||
NSString *password = [(NSSecureTextField *)alert.accessoryView stringValue];
|
||||
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
||||
MPElementEntity *entity = [self.selectedElement entityInContext:context];
|
||||
[entity.algorithm savePassword:password toElement:entity usingKey:[MPMacAppDelegate get].key];
|
||||
MPSiteEntity *entity = [self.selectedSite entityInContext:context];
|
||||
[entity.algorithm savePassword:password toSite:entity usingKey:[MPMacAppDelegate get].key];
|
||||
[context saveToStore];
|
||||
}];
|
||||
break;
|
||||
@@ -295,7 +291,7 @@
|
||||
case NSAlertFirstButtonReturn: {
|
||||
// "Delete" button.
|
||||
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
||||
[context deleteObject:[self.selectedElement entityInContext:context]];
|
||||
[context deleteObject:[self.selectedSite entityInContext:context]];
|
||||
[context saveToStore];
|
||||
}];
|
||||
break;
|
||||
@@ -308,24 +304,19 @@
|
||||
|
||||
#pragma mark - State
|
||||
|
||||
- (NSString *)query {
|
||||
- (void)insertObject:(MPSiteModel *)model inSitesAtIndex:(NSUInteger)index {
|
||||
|
||||
return [self.siteField.stringValue stringByReplacingCharactersInRange:self.siteField.currentEditor.selectedRange withString:@""]?: @"";
|
||||
[self.sites insertObject:model atIndex:index];
|
||||
}
|
||||
|
||||
- (void)insertObject:(MPElementModel *)model inElementsAtIndex:(NSUInteger)index {
|
||||
- (void)removeObjectFromSitesAtIndex:(NSUInteger)index {
|
||||
|
||||
[self.elements insertObject:model atIndex:index];
|
||||
[self.sites removeObjectAtIndex:index];
|
||||
}
|
||||
|
||||
- (void)removeObjectFromElementsAtIndex:(NSUInteger)index {
|
||||
- (MPSiteModel *)selectedSite {
|
||||
|
||||
[self.elements removeObjectAtIndex:index];
|
||||
}
|
||||
|
||||
- (MPElementModel *)selectedElement {
|
||||
|
||||
return [self.elementsController.selectedObjects firstObject];
|
||||
return [self.sitesController.selectedObjects firstObject];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
@@ -336,13 +327,13 @@
|
||||
[[MPMacAppDelegate get] showPopup:sender];
|
||||
}
|
||||
|
||||
- (IBAction)deleteElement:(id)sender {
|
||||
- (IBAction)deleteSite:(id)sender {
|
||||
|
||||
NSAlert *alert = [NSAlert new];
|
||||
[alert addButtonWithTitle:@"Delete"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
[alert setMessageText:@"Delete Site?"];
|
||||
[alert setInformativeText:strf( @"Do you want to delete the site named:\n\n%@", self.selectedElement.siteName )];
|
||||
[alert setInformativeText:strf( @"Do you want to delete the site named:\n\n%@", self.selectedSite.name )];
|
||||
[alert beginSheetModalForWindow:self.window modalDelegate:self
|
||||
didEndSelector:@selector( alertDidEnd:returnCode:contextInfo: ) contextInfo:MPAlertDeleteSite];
|
||||
}
|
||||
@@ -353,9 +344,9 @@
|
||||
[alert addButtonWithTitle:@"Save"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
[alert setMessageText:@"Change Login Name"];
|
||||
[alert setInformativeText:strf( @"Enter the login name for: %@", self.selectedElement.siteName )];
|
||||
[alert setInformativeText:strf( @"Enter the login name for: %@", self.selectedSite.name )];
|
||||
NSTextField *loginField = [[NSTextField alloc] initWithFrame:NSMakeRect( 0, 0, 200, 22 )];
|
||||
loginField.stringValue = self.selectedElement.loginName?: @"";
|
||||
loginField.stringValue = self.selectedSite.loginName?: @"";
|
||||
[loginField selectText:self];
|
||||
[alert setAccessoryView:loginField];
|
||||
[alert layout];
|
||||
@@ -380,14 +371,14 @@
|
||||
|
||||
- (IBAction)changePassword:(id)sender {
|
||||
|
||||
if (!self.selectedElement.stored)
|
||||
if (!self.selectedSite.stored)
|
||||
return;
|
||||
|
||||
NSAlert *alert = [NSAlert new];
|
||||
[alert addButtonWithTitle:@"Save"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
[alert setMessageText:@"Change Password"];
|
||||
[alert setInformativeText:strf( @"Enter the new password for: %@", self.selectedElement.siteName )];
|
||||
[alert setInformativeText:strf( @"Enter the new password for: %@", self.selectedSite.name )];
|
||||
[alert setAccessoryView:[[NSSecureTextField alloc] initWithFrame:NSMakeRect( 0, 0, 200, 22 )]];
|
||||
[alert layout];
|
||||
[alert beginSheetModalForWindow:self.window modalDelegate:self
|
||||
@@ -396,19 +387,20 @@
|
||||
|
||||
- (IBAction)changeType:(id)sender {
|
||||
|
||||
MPElementModel *element = self.selectedElement;
|
||||
NSArray *types = [element.algorithm allTypesStartingWith:MPElementTypeGeneratedPIN];
|
||||
MPSiteModel *site = self.selectedSite;
|
||||
NSArray *types = [site.algorithm allTypesStartingWith:MPSiteTypeGeneratedPIN];
|
||||
[self.passwordTypesMatrix renewRows:(NSInteger)[types count] columns:1];
|
||||
for (NSUInteger t = 0; t < [types count]; ++t) {
|
||||
MPElementType type = [types[t] unsignedIntegerValue];
|
||||
NSString *title = [element.algorithm nameOfType:type];
|
||||
if (type & MPElementTypeClassGenerated)
|
||||
title = [element.algorithm generatePasswordForSiteNamed:element.siteName ofType:type
|
||||
withCounter:element.counter usingKey:[MPMacAppDelegate get].key];
|
||||
MPSiteType type = [types[t] unsignedIntegerValue];
|
||||
NSString *title = [site.algorithm nameOfType:type];
|
||||
if (type & MPSiteTypeClassGenerated)
|
||||
title = [site.algorithm generatePasswordForSiteNamed:site.name ofType:type
|
||||
withCounter:site.counter
|
||||
usingKey:[MPMacAppDelegate get].key];
|
||||
|
||||
NSButtonCell *cell = [self.passwordTypesMatrix cellAtRow:(NSInteger)t column:0];
|
||||
cell.tag = type;
|
||||
cell.state = type == element.type? NSOnState: NSOffState;
|
||||
cell.state = type == site.type? NSOnState: NSOffState;
|
||||
cell.title = title;
|
||||
}
|
||||
|
||||
@@ -416,7 +408,7 @@
|
||||
[alert addButtonWithTitle:@"Save"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
[alert setMessageText:@"Change Password Type"];
|
||||
[alert setInformativeText:strf( @"Choose a new password type for: %@", element.siteName )];
|
||||
[alert setInformativeText:strf( @"Choose a new password type for: %@", site.name )];
|
||||
[alert setAccessoryView:self.passwordTypesBox];
|
||||
[alert layout];
|
||||
[alert beginSheetModalForWindow:self.window modalDelegate:self
|
||||
@@ -428,11 +420,11 @@
|
||||
- (BOOL)handleCommand:(SEL)commandSelector {
|
||||
|
||||
if (commandSelector == @selector( moveUp: )) {
|
||||
[self.elementsController selectPrevious:self];
|
||||
[self.sitesController selectPrevious:self];
|
||||
return YES;
|
||||
}
|
||||
if (commandSelector == @selector( moveDown: )) {
|
||||
[self.elementsController selectNext:self];
|
||||
[self.sitesController selectNext:self];
|
||||
return YES;
|
||||
}
|
||||
if (commandSelector == @selector( insertNewline: )) {
|
||||
@@ -449,19 +441,19 @@
|
||||
|
||||
- (void)useSite {
|
||||
|
||||
MPElementModel *selectedElement = [self selectedElement];
|
||||
if (selectedElement) {
|
||||
MPSiteModel *selectedSite = [self selectedSite];
|
||||
if (selectedSite) {
|
||||
// Performing action while content is available. Copy it.
|
||||
[self copyContent:selectedElement.content];
|
||||
[self copyContent:selectedSite.content];
|
||||
|
||||
[self fadeOut];
|
||||
|
||||
NSUserNotification *notification = [NSUserNotification new];
|
||||
notification.title = @"Password Copied";
|
||||
if (selectedElement.loginName.length)
|
||||
notification.subtitle = strf( @"%@ at %@", selectedElement.loginName, selectedElement.siteName );
|
||||
if (selectedSite.loginName.length)
|
||||
notification.subtitle = strf( @"%@ at %@", selectedSite.loginName, selectedSite.name );
|
||||
else
|
||||
notification.subtitle = selectedElement.siteName;
|
||||
notification.subtitle = selectedSite.name;
|
||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
|
||||
}
|
||||
else {
|
||||
@@ -499,73 +491,56 @@
|
||||
}
|
||||
}
|
||||
|
||||
[self updateElements];
|
||||
[self updateSites];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)updateElements {
|
||||
- (void)updateSites {
|
||||
|
||||
if (![MPMacAppDelegate get].key) {
|
||||
self.elements = nil;
|
||||
self.sites = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
PearlProfiler *profiler = [PearlProfiler profilerForTask:@"updateElements"];
|
||||
NSString *query = [self query];
|
||||
[profiler finishJob:@"query"];
|
||||
static NSRegularExpression *fuzzyRE;
|
||||
static dispatch_once_t once = 0;
|
||||
dispatch_once( &once, ^{
|
||||
fuzzyRE = [NSRegularExpression regularExpressionWithPattern:@"(.)" options:0 error:nil];
|
||||
} );
|
||||
|
||||
NSString *queryString = self.siteField.stringValue;
|
||||
NSString *queryPattern = [queryString stringByReplacingMatchesOfExpression:fuzzyRE withTemplate:@"*$1*"];
|
||||
NSMutableArray *fuzzyGroups = [NSMutableArray new];
|
||||
[fuzzyRE enumerateMatchesInString:queryString options:0 range:NSMakeRange( 0, queryString.length )
|
||||
usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
|
||||
[fuzzyGroups addObject:[queryString substringWithRange:result.range] ];
|
||||
}];
|
||||
[MPMacAppDelegate managedObjectContextPerformBlockAndWait:^(NSManagedObjectContext *context) {
|
||||
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPElementEntity class] )];
|
||||
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"lastUsed" ascending:NO]];
|
||||
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"(%@ == '' OR name BEGINSWITH[cd] %@) AND user == %@",
|
||||
query, query, [[MPMacAppDelegate get] activeUserInContext:context]];
|
||||
[profiler finishJob:@"setup fetch"];
|
||||
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPSiteEntity class] )];
|
||||
fetchRequest.sortDescriptors = @[ [[NSSortDescriptor alloc] initWithKey:@"lastUsed" ascending:NO] ];
|
||||
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"(%@ == '' OR name LIKE[cd] %@) AND user == %@",
|
||||
queryPattern, queryPattern, [MPMacAppDelegate get].activeUserOID];
|
||||
|
||||
NSError *error = nil;
|
||||
NSArray *siteResults = [context executeFetchRequest:fetchRequest error:&error];
|
||||
if (!siteResults) {
|
||||
err( @"While fetching elements for completion: %@", error );
|
||||
err( @"While fetching sites for completion: %@", [error fullDescription] );
|
||||
return;
|
||||
}
|
||||
[profiler finishJob:@"do fetch"];
|
||||
|
||||
NSMutableArray *newElements = [NSMutableArray arrayWithCapacity:[siteResults count]];
|
||||
for (MPElementEntity *element in siteResults)
|
||||
[newElements addObject:[[MPElementModel alloc] initWithEntity:element]];
|
||||
[profiler finishJob:@"make models"];
|
||||
self.elements = newElements;
|
||||
[profiler finishJob:@"update elements"];
|
||||
NSMutableArray *newSites = [NSMutableArray arrayWithCapacity:[siteResults count]];
|
||||
for (MPSiteEntity *site in siteResults)
|
||||
[newSites addObject:[[MPSiteModel alloc] initWithEntity:site fuzzyGroups:fuzzyGroups]];
|
||||
self.sites = newSites;
|
||||
}];
|
||||
[profiler finishJob:@"done"];
|
||||
}
|
||||
|
||||
- (void)updateSelection {
|
||||
|
||||
if (_skipTextChange) {
|
||||
_skipTextChange = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *siteName = self.selectedElement.siteName;
|
||||
if (!siteName)
|
||||
return;
|
||||
|
||||
if ([self.window isKeyWindow] && [self.siteField isEqual:[self.window firstResponder]]) {
|
||||
NSRange siteNameQueryRange = [siteName rangeOfString:[self query]];
|
||||
self.siteField.stringValue = siteName;
|
||||
|
||||
if (siteNameQueryRange.location == 0)
|
||||
self.siteField.currentEditor.selectedRange =
|
||||
NSMakeRange( siteNameQueryRange.length, siteName.length - siteNameQueryRange.length );
|
||||
}
|
||||
|
||||
[self.siteTable scrollRowToVisible:(NSInteger)self.elementsController.selectionIndex];
|
||||
[self updateGradient];
|
||||
}
|
||||
|
||||
- (void)updateGradient {
|
||||
[self.siteTable scrollRowToVisible:(NSInteger)self.sitesController.selectionIndex];
|
||||
|
||||
NSView *siteScrollView = self.siteTable.superview.superview;
|
||||
NSRect selectedCellFrame = [self.siteTable frameOfCellAtColumn:0 row:((NSInteger)self.elementsController.selectionIndex)];
|
||||
NSRect selectedCellFrame = [self.siteTable frameOfCellAtColumn:0 row:((NSInteger)self.sitesController.selectionIndex)];
|
||||
CGFloat selectedOffset = [siteScrollView convertPoint:selectedCellFrame.origin fromView:self.siteTable].y;
|
||||
CGFloat gradientOpacity = selectedOffset / siteScrollView.bounds.size.height;
|
||||
self.siteGradient.colors = @[
|
||||
@@ -589,14 +564,14 @@
|
||||
|
||||
- (void)copyContent:(NSString *)content {
|
||||
|
||||
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
|
||||
[[NSPasteboard generalPasteboard] declareTypes:@[ NSStringPboardType ] owner:nil];
|
||||
if (![[NSPasteboard generalPasteboard] setString:content forType:NSPasteboardTypeString]) {
|
||||
wrn( @"Couldn't copy password to pasteboard." );
|
||||
return;
|
||||
}
|
||||
|
||||
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *moc) {
|
||||
[[self.selectedElement entityInContext:moc] use];
|
||||
[[self.selectedSite entityInContext:moc] use];
|
||||
[moc saveToStore];
|
||||
}];
|
||||
}
|
||||
@@ -606,7 +581,6 @@
|
||||
if ([self.window isOnActiveSpace] && self.window.alphaValue)
|
||||
return;
|
||||
|
||||
PearlProfiler *profiler = [PearlProfiler profilerForTask:@"fadeIn"];
|
||||
CGDirectDisplayID displayID = [self.window.screen.deviceDescription[@"NSScreenNumber"] unsignedIntValue];
|
||||
CGImageRef capturedImage = CGDisplayCreateImage( displayID );
|
||||
if (!capturedImage || CGImageGetWidth( capturedImage ) <= 1) {
|
||||
@@ -614,11 +588,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
[profiler finishJob:@"captured window: %d, on screen: %@", displayID, self.window.screen.deviceDescription];
|
||||
NSImage *screenImage = [[NSImage alloc] initWithCGImage:capturedImage size:NSMakeSize(
|
||||
CGImageGetWidth( capturedImage ) / self.window.backingScaleFactor,
|
||||
CGImageGetHeight( capturedImage ) / self.window.backingScaleFactor )];
|
||||
[profiler finishJob:@"image size: %@, bytes: %ld", NSStringFromSize( screenImage.size ), screenImage.TIFFRepresentation.length];
|
||||
|
||||
NSImage *smallImage = [[NSImage alloc] initWithSize:NSMakeSize(
|
||||
CGImageGetWidth( capturedImage ) / 20,
|
||||
@@ -630,16 +602,12 @@
|
||||
operation:NSCompositeSourceOver
|
||||
fraction:1.0];
|
||||
[smallImage unlockFocus];
|
||||
[profiler finishJob:@"small image size: %@, bytes: %ld", NSStringFromSize( screenImage.size ), screenImage.TIFFRepresentation.length];
|
||||
|
||||
self.blurView.image = smallImage;
|
||||
[profiler finishJob:@"assigned image"];
|
||||
|
||||
[self.window setFrame:self.window.screen.frame display:YES];
|
||||
[profiler finishJob:@"assigned frame"];
|
||||
[NSAnimationContext currentContext].timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
|
||||
self.window.animator.alphaValue = 1.0;
|
||||
[profiler finishJob:@"animating window"];
|
||||
}
|
||||
|
||||
- (void)fadeOut {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user