Commit 43fe3ac5 authored by Yury Popov's avatar Yury Popov

Partially worked server (tested with SSCEP)

parent f7228dac
......@@ -7,10 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
D0A221551A8CE1B3008F10EF /* libcrypto.1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A221531A8CE1B3008F10EF /* libcrypto.1.0.0.dylib */; };
D0A221561A8CE1B3008F10EF /* libssl.1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A221541A8CE1B3008F10EF /* libssl.1.0.0.dylib */; };
D0A221551A8CE1B3008F10EF /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A221531A8CE1B3008F10EF /* libcrypto.a */; };
D0A221561A8CE1B3008F10EF /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A221541A8CE1B3008F10EF /* libssl.a */; };
D0BF4AE11A8C81F500F9B8C3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0BF4AE01A8C81F500F9B8C3 /* main.cpp */; };
D0BF4AEE1A8C820900F9B8C3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0BF4AED1A8C820900F9B8C3 /* main.cpp */; };
D0BF4AF91A8D4E2E00F9B8C3 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BF4AF81A8D4E2E00F9B8C3 /* CoreFoundation.framework */; };
D0BF4AFA1A8D7EBD00F9B8C3 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A221531A8CE1B3008F10EF /* libcrypto.a */; };
D0BF4AFB1A8D7EBF00F9B8C3 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A221541A8CE1B3008F10EF /* libssl.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -45,12 +48,13 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
D0A221531A8CE1B3008F10EF /* libcrypto.1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.1.0.0.dylib; path = /usr/local/Cellar/openssl/1.0.1k/lib/libcrypto.1.0.0.dylib; sourceTree = "<absolute>"; };
D0A221541A8CE1B3008F10EF /* libssl.1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssl.1.0.0.dylib; path = /usr/local/Cellar/openssl/1.0.1k/lib/libssl.1.0.0.dylib; sourceTree = "<absolute>"; };
D0A221531A8CE1B3008F10EF /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = /usr/local/Cellar/openssl/1.0.2/lib/libcrypto.a; sourceTree = "<absolute>"; };
D0A221541A8CE1B3008F10EF /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = /usr/local/Cellar/openssl/1.0.2/lib/libssl.a; sourceTree = "<absolute>"; };
D0BF4ADD1A8C81F500F9B8C3 /* SCEPServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCEPServer; sourceTree = BUILT_PRODUCTS_DIR; };
D0BF4AE01A8C81F500F9B8C3 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
D0BF4AEB1A8C820900F9B8C3 /* SCEPTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SCEPTest; sourceTree = BUILT_PRODUCTS_DIR; };
D0BF4AED1A8C820900F9B8C3 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
D0BF4AF81A8D4E2E00F9B8C3 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -58,8 +62,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D0A221551A8CE1B3008F10EF /* libcrypto.1.0.0.dylib in Frameworks */,
D0A221561A8CE1B3008F10EF /* libssl.1.0.0.dylib in Frameworks */,
D0BF4AF91A8D4E2E00F9B8C3 /* CoreFoundation.framework in Frameworks */,
D0A221551A8CE1B3008F10EF /* libcrypto.a in Frameworks */,
D0A221561A8CE1B3008F10EF /* libssl.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -67,6 +72,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D0BF4AFB1A8D7EBF00F9B8C3 /* libssl.a in Frameworks */,
D0BF4AFA1A8D7EBD00F9B8C3 /* libcrypto.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -76,8 +83,9 @@
D0BF4AD41A8C81F500F9B8C3 = {
isa = PBXGroup;
children = (
D0A221531A8CE1B3008F10EF /* libcrypto.1.0.0.dylib */,
D0A221541A8CE1B3008F10EF /* libssl.1.0.0.dylib */,
D0BF4AF81A8D4E2E00F9B8C3 /* CoreFoundation.framework */,
D0A221531A8CE1B3008F10EF /* libcrypto.a */,
D0A221541A8CE1B3008F10EF /* libssl.a */,
D0BF4ADF1A8C81F500F9B8C3 /* SCEPServer */,
D0BF4AEC1A8C820900F9B8C3 /* SCEPTest */,
D0BF4ADE1A8C81F500F9B8C3 /* Products */,
......@@ -245,7 +253,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
/usr/local/Cellar/openssl/1.0.1j/include,
/usr/local/Cellar/openssl/1.0.2/include,
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
......@@ -286,7 +294,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
/usr/local/Cellar/openssl/1.0.1j/include,
/usr/local/Cellar/openssl/1.0.2/include,
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
......@@ -301,7 +309,7 @@
buildSettings = {
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/usr/local/Cellar/openssl/1.0.1k/lib,
/usr/local/Cellar/openssl/1.0.2/lib,
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
......@@ -312,7 +320,7 @@
buildSettings = {
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/usr/local/Cellar/openssl/1.0.1k/lib,
/usr/local/Cellar/openssl/1.0.2/lib,
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
......@@ -325,6 +333,10 @@
"DEBUG=1",
"$(inherited)",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/usr/local/Cellar/openssl/1.0.2/lib,
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
......@@ -332,6 +344,10 @@
D0BF4AF11A8C820900F9B8C3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/usr/local/Cellar/openssl/1.0.2/lib,
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
......
This diff is collapsed.
......@@ -7,9 +7,37 @@
//
#include <iostream>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/pem.h>
#include <openssl/asn1.h>
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
EVP_PKEY *key = EVP_PKEY_new();
RSA* rsa = RSA_generate_key(1024, 65537, 0, 0);
EVP_PKEY_assign_RSA(key, rsa);
X509_REQ *req = X509_REQ_new();
X509_REQ_set_version(req, 0);
X509_REQ_set_pubkey(req, key);
X509_NAME *name = X509_NAME_new();
X509_NAME_add_entry_by_NID(name, NID_organizationName, V_ASN1_PRINTABLESTRING, (unsigned char*)"TestFlightApp.com", 17, 0, 0);
X509_NAME_add_entry_by_NID(name, NID_commonName, V_ASN1_PRINTABLESTRING, (unsigned char*)"Tester Cert", 11, 1, 0);
X509_REQ_set_subject_name(req, name);
X509_REQ_add1_attr_by_NID(req, NID_pkcs9_challengePassword, V_ASN1_PRINTABLESTRING, (unsigned char*)"Tester Enrollment Challenge", 27);
STACK_OF(X509_EXTENSION) *stk = new STACK_OF(X509_EXTENSION);
ASN1_OCTET_STRING *s = ASN1_OCTET_STRING_new();
ASN1_OCTET_STRING_set(s, (unsigned char*)"Digital Signature, Key Encipherment", 17+2+16);
X509_EXTENSION *x =
X509_EXTENSION_create_by_NID(NULL, NID_key_usage, 1, s);
stk->stack.num = 1;
stk->stack.num_alloc = 1;
stk->stack.data = (char**)malloc(sizeof(x));
((X509_EXTENSION**)stk->stack.data)[0] = x;
X509_REQ_add_extensions(req, stk);
X509_REQ_sign(req, key, EVP_sha1());
PEM_write_RSAPrivateKey(stdout, rsa, 0, 0, 0, 0, 0);
PEM_write_X509_REQ(stdout, req);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment