I read some info regarding getting .h files for undocumented API. Most of sources recommend class-dump (or class-dump-x and class-dump-z).
However it doesn't work with iPhone Security.framework. It doesn't contain Objective-C runtime information.
The only other way which I found is to use nm or otool. This will give the names of functions and disassembly for them.
Does anybody know some faster way to get undocumented functions signature than reading disassembly and trying to figure out what parameters go where and what could it be?
You mean this undocumented api, documented here..
Security.framework is not private or undocumented.
As far as headers go, installed on my harddrive in the 3.2 sdk i find:
/Security.framework/Headers/Security.h
/Security.framework/Headers/Secbase.h
/Security.framework/Headers/SecCertificate.h
/Security.framework/Headers/SecIdentitiy.h
/Security.framework/Headers/SecImportExport.h
/Security.framework/Headers/SecItem.h
/Security.framework/Headers/SecKey.h
/Security.framework/Headers/SecPolicy.h
/Security.framework/Headers/SecRandom.h
/Security.framework/Headers/SecTrust.h
As for a little reverse engineering 101, you should realise that a framework doesn't contain or in anyway have a use for header files, or function signatures. When provided they are solely for the benefit of the developer. There is no C or C++ or objective-c code in the compiled framework, only the raw machine code.
As you have seen, if objective-c was used Class-Dump can do a pretty good job of arranging objective-c symbols into something that looks like a header file, only missing type information that isn't used at runtime, so still not that useful.
If the source language was C then you are screwed. There may be a function name symbol but there is no info about arguments or return type.
There are bunch of additional undocumented API's which are not mentioned in official documentation. As example, part of them could be seen here:
http://www.opensource.apple.com/source/Security/Security-55163.44/sec/Security/
Related
I am building a rather large library and I think it would be a lot cleaner if I could have the implementation for my methods and such hidden. For example, when you view the in-code documentation for standard Swift types, such as UInt64, you see things like:
With the actual implementation of the methods hidden, and only the declarations and headers shown. How can I do this with my own library?
You need to distribute your library as a precompiled binary, in which case only the public headers + documentation will be visible for consumers of your library.
For more information, you can watch the WWDC2019 video of about Binary frameworks in Swift.
There is a shortcut in Xcode to show only the interface: Control+Command+Up Arrow, but it is a little slow and doesn't hide the internal methods that not useful for the usage of the code (since only public and open interface in Swift Package can be used by outside module).
I am learning Swift by myself on MacOS. When following the tutorial and practicing the array function: <array_name>.sort(), I can get it executed but I always wonder how it works and what is the actual algorithm inside it.
So is there any way to check the certain function definitions?
If you want to check the declaration of the function/class, you can command-click on it. If you want the documentation, you can either option-click it or check it on the API reference page. If you want to see the implementation details of the Swift standard library, check the source code here at GitHub. If the implementation you are checking is in a non open-source APIs though, you can't quite check it.
Swift has portions of Darwin implemented, for instance, this works:
import Darwin
rand()
Where does XCode6 store the underlying include files for this? I wanted to add in scanf functionality the same way they added in rand().
If you type "rand()" in a Swift notebook, do Jump to Definition in Xcode (CMD-CTRL-J), it will take you to the Swift header for the C standard library.
I believe you can see there all the C standard library functions where Apple has provided a Swift API. But you can't see the Swift implementation, since I don't think that's supplied. I would guess it's compiled into the Swift framework.
But what you asked is where that header file is located. Here's how to find it:
Create a Swift command-line application, and use the rand() function.
Build it.
In the Report Navigator, expand all the underlying command-line build commands, to look for the paths that were passed to the compiler.
If you look at the paths in the link phase, you may find something at /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx
.
But I don't think Swift is using a plaintext file format for the headers, and I think the headers only give you access to C's standard lib because there's also a compiled Swift wrapper layer in between, or some kind of bridging header, so it may not be easy to just add missing functions at this point.
Are there any ready-to-use encryption libraries for the iPhone? 3DES, AES/Rijndael, whatever. I need to encrypt and decrypt strings. My understanding of Objective-C is that you can use C code inside of Objective-C methods/functions/whatever they're called.
iPhone comes out of the box with the CommonCrypto library. It has various support for encryption. See the Security Coding How-to from Apple.
That is correct, you can use any C code you want in Objective - C, since it is a proper superset of C.
don't forget you could always use c++ source code in your obj-c project and there are many c++ encryption libraries like : LibTomCrypt
add c++ code to your project and simply call functions;
Take a look at http://www.example-code.com/objc/crypt2_3des.asp
I'm considering using YAML as part of my next iPhone application, but I haven't been able to find an Objective-C library to use.
The Wikipedia page for YAML mentions one, but the link is dead.
Is there an Objective-C library that can parse YAML into native collection objects (NSArray, NSDictionary, etc...)?
The Cocoa extensions for Syck are probably what you're looking for -- it's where the library that Shaggy Frog mentioned seems to be living these days.
You can try YAML.framework it's LibYAML based, it's fast and easy to use. Follows the same pattern as standard NSPropertyListSerialization.
You can use it for iOS (iPhone/iPad) development.
The YAMLKit framework is a thin wrapper around LibYAML. It does exactly what you want. For example:
[[YKParser alloc] init];
[p readString:#"- foo\n- bar\n- baz"];
id result = [p parse];
/* result is now an NSArray containing an NSArray with elements:
#"foo", #"bar", #"baz" */
[p release];
I recently wrote modern ObjC-YAML bindings, based on the standard NSCoder/NSKeyedArchiver interface: http://github.com/th-in-gs/YACYAML. I'm using them in my own projects, and intend to maintain them for at least as long as I continue to do so.
More here: http://www.blog.montgomerie.net/yacyaml
IF you are doing alot of c++ in your iPhone projects, then please have a look at yaml-cpp:
http://code.google.com/p/yaml-cpp/
has native iPhone support (via it's cmake build system)
has no dependencies beyond a good compiler and cmake
is very c++ friendly (thus, the name) with solid documentation (see the wiki/HowToParseADocument page)
I found this right from YAML's front page. But it looks like it might be out of date (c. 2004?), and the CVS link doesn't work for me.
I would bet that it's just a thin wrapper around an underlying C library like this or this... C code being "native" code that the Objective-C compiler will grok.
I found this question looking for YAML + objective C options. I ended up using this solution: https://github.com/icanzilb/JSONModel. Very cool, up to date and easy to use. Parses yaml directly into objective C models that you create inheriting the JSONModel class.