motion-provisioning 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b943a1370641d985fcc5ff8b17e1d7d371972e491c8af1b2f34ebd9bbdb950ef
4
- data.tar.gz: 322e1d8e91d79cad29bd87f07689b9290406e116e11d33c5155b125e53fb745f
3
+ metadata.gz: 0e5eb84d598dcfa9dafb47c3391a8a94ae2dc3b2f5961e748237e5b290250b12
4
+ data.tar.gz: 5325af62491a2016c2a27e58ecc3385248e40ec37984cd940d20b8e8e19c2c48
5
5
  SHA512:
6
- metadata.gz: b5f3fa4e86d33e2a03e4bb7f54b3d61242eeab905a0b3876df8bf9e698d3933fe237db8d49e1403570d5b33e87c21dfd4a4c4d6aacb8ad727bb2e7c2697f40d5
7
- data.tar.gz: d135cf35c5cf17a2bfabd89d9a62073ad085c12bd2b05cbd11d67890c6dd77b7f4feecb975370d60ce8aaa769650f6c0985dc7e8454cb581644677783a9bbf77
6
+ metadata.gz: 256c4993b4af03cd0b36493b82c870d28e9534bc872944f43364ff8f394227aa8abb96811e113ac043133ac9c4815ce7444caa1e82f2568bf1cdc7d6a25fe675
7
+ data.tar.gz: 150beea08fcc7b495bf6339a598616c541c7ed9751aad40740d99ccd38619fd22c1a630541b77e3dea3ecd8053630cdb57b3a185c5a1ecc825b32e62809e56cb
data/README.md CHANGED
@@ -184,6 +184,9 @@ Or to recreate the development certificate:
184
184
 
185
185
  rake device recreate_certificate=1
186
186
 
187
+ Or to recreate the distribution certificate:
188
+
189
+ rake archive:distribution recreate_certificate=1
187
190
 
188
191
  ## Entitlements and App Services
189
192
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+
5
+ require "irb"
6
+ IRB.start
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+ rake generate_certificates
8
+ rake build_export_private_key
9
+
@@ -0,0 +1,144 @@
1
+ /*
2
+ * This file contains modified code with copyright:
3
+ *
4
+ * Copyright (c) 2003-2010,2012,2014 Apple Inc. All Rights Reserved.
5
+ *
6
+ * Covered by the APPLE PUBLIC SOURCE LICENSE
7
+ * (http://opensource.apple.com/license/apsl/)
8
+ */
9
+
10
+ #import <CoreFoundation/CoreFoundation.h>
11
+ #import <Security/Security.h>
12
+
13
+ #define DEBUG 0
14
+
15
+ unsigned char
16
+ hexValue(char c)
17
+ {
18
+ static const char digits[] = "0123456789abcdef";
19
+ char *p;
20
+ if (p = strchr(digits, tolower(c)))
21
+ return p - digits;
22
+ else
23
+ return 0;
24
+ }
25
+
26
+ void
27
+ fromHex(const char *hexDigits, CSSM_DATA *data)
28
+ {
29
+ size_t bytes = strlen(hexDigits) / 2; // (discards malformed odd end)
30
+ if (bytes > data->Length)
31
+ return;
32
+ // length(bytes); // (will assert if we try to grow it)
33
+ size_t n;
34
+ for (n = 0; n < bytes; n++) {
35
+ data->Data[n] = (uint8)(hexValue(hexDigits[2*n]) << 4 | hexValue(hexDigits[2*n+1]));
36
+ }
37
+ }
38
+
39
+ int main(int argc, char *argv[]) {
40
+
41
+ if (argc != 4) {
42
+ exit(1);
43
+ }
44
+
45
+ char* identity_name = argv[1];
46
+ char* hash = argv[2];
47
+ char* key_password = argv[3];
48
+
49
+ // First get a list of Identities matching the specified name
50
+ const void* values[] = {
51
+ kSecClassIdentity,
52
+ kCFBooleanTrue,
53
+ CFStringCreateWithCString(NULL, identity_name, kCFStringEncodingUTF8),
54
+ kSecMatchLimitAll
55
+ };
56
+ const void* keys[] = {
57
+ kSecClass,
58
+ kSecReturnRef,
59
+ kSecMatchSubjectContains,
60
+ kSecMatchLimit
61
+ };
62
+ CFIndex numValues = sizeof(keys)/sizeof(void*);
63
+ CFDictionaryRef query = CFDictionaryCreate(NULL, keys, values, numValues, NULL, NULL);
64
+
65
+ CFTypeRef results;
66
+ if (SecItemCopyMatching(query, &results) != noErr) {
67
+ exit(1);
68
+ }
69
+
70
+ // Prepare the Identity hash
71
+ CSSM_DATA hashData = { 0, NULL };
72
+ CSSM_SIZE len = strlen(hash)/2;
73
+ hashData.Length = len;
74
+ hashData.Data = (uint8 *)malloc(hashData.Length);
75
+ fromHex(hash, &hashData);
76
+
77
+ SecIdentityRef item;
78
+ CSSM_DATA certData = { 0, NULL };
79
+ SecCertificateRef cert = NULL;
80
+ Boolean found = FALSE;
81
+
82
+ // Check all found identitied, looking for one whose certificate matches the
83
+ // specified hash
84
+ CFIndex count = CFArrayGetCount(results);
85
+ for (int i = 0; i < count; i++) {
86
+ item = CFArrayGetValueAtIndex(results, i);
87
+
88
+ if (SecIdentityCopyCertificate(item, &cert) != noErr) {
89
+ CFRelease(&item);
90
+ continue;
91
+ }
92
+
93
+ if (SecCertificateGetData(cert, &certData) != noErr) {
94
+ CFRelease(&cert);
95
+ CFRelease(&item);
96
+ continue;
97
+ }
98
+
99
+ uint8 candidate_sha1_hash[20];
100
+ CSSM_DATA digest;
101
+ digest.Length = sizeof(candidate_sha1_hash);
102
+ digest.Data = candidate_sha1_hash;
103
+ if ((SecDigestGetData(CSSM_ALGID_SHA1, &digest, &certData) == CSSM_OK) &&
104
+ (hashData.Length == digest.Length) &&
105
+ (!memcmp(hashData.Data, digest.Data, digest.Length))) {
106
+ found = TRUE;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if (found) {
112
+ #if DEBUG
113
+ CFStringRef nameRef = NULL;
114
+ if (SecCertificateCopyCommonName(cert, &nameRef) != noErr) {
115
+ exit(1);
116
+ }
117
+
118
+ char *cert_name = CFStringGetCStringPtr(nameRef, kCFStringEncodingUTF8);
119
+ printf("%s\n", cert_name);
120
+ #endif
121
+
122
+ // Finally, get the encrypted private key using the specified password
123
+ // and print it to stdout in PEM format
124
+ SecKeyRef key = NULL;
125
+ if (SecIdentityCopyPrivateKey(item, &key) != noErr) {
126
+ exit(1);
127
+ }
128
+
129
+ SecKeyImportExportParameters keyParams;
130
+ keyParams.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
131
+ keyParams.flags = 0;
132
+ keyParams.passphrase = CFDataCreate(NULL, key_password, 5);
133
+ keyParams.alertTitle = 0;
134
+ keyParams.alertPrompt = 0;
135
+
136
+ CFDataRef key_data;
137
+ OSStatus status = SecKeychainItemExport(key, kSecFormatWrappedPKCS8,
138
+ kSecItemPemArmour, &keyParams, &key_data);
139
+
140
+ if(status == noErr) {
141
+ write(fileno(stdout), CFDataGetBytePtr(key_data), CFDataGetLength(key_data));
142
+ }
143
+ }
144
+ }
@@ -1,3 +1,3 @@
1
1
  module MotionProvisioning
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Villacampa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -36,28 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 2.113.0
39
+ version: '2.113'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 2.113.0
47
- - !ruby/object:Gem::Dependency
48
- name: bundler
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1.12'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.12'
46
+ version: '2.113'
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: rake
63
49
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +124,9 @@ extra_rdoc_files: []
138
124
  files:
139
125
  - LICENSE.txt
140
126
  - README.md
141
- - bin/export_private_key
127
+ - bin/console
128
+ - bin/setup
129
+ - export_private_key/export_private_key.c
142
130
  - lib/motion-provisioning.rb
143
131
  - lib/motion-provisioning/application.rb
144
132
  - lib/motion-provisioning/certificate.rb
@@ -169,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
157
  - !ruby/object:Gem::Version
170
158
  version: '0'
171
159
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.7.6
160
+ rubygems_version: 3.0.6
174
161
  signing_key:
175
162
  specification_version: 4
176
163
  summary: Simplified provisioning for RubyMotion iOS, tvOS and macOS apps.
Binary file