How to add Authority Ket Identifier Extension to my certificate? - x509certificate2

I used default X509Extension:
certificateRequest.CertificateExtensions.Add(new X509Extension(new Oid("2.5.29.35"), issuer.GetPublicKey(), false));
But when i decode it, this extension is broken and has a strange order of random symbols.
In .NET 7 i have a class X509AuthorityKeyIdentifierExtension, but i need do the same on .NET Framework 4.8. How i can do it?

There is no built-in way to do this in legacy .NET Framework without using 3rd party libraries.
For instance, I have my own PKI extension library for .NET Framework that contains classes for most common certificate extensions. Here is an example of X509AuthorityKeyIdentifierExtension class: https://github.com/PKISolutions/pkix.net/blob/master/PKI/Cryptography/X509Certificates/X509AuthorityKeyIdentifierExtension.cs
And the usage could be:
var aki = new X509AuthorityKeyIdentifierExtension(issuer, AuthorityKeyIdentifierFlags.KeyIdentifier, false);
certificateRequest.CertificateExtensions.Add(aki);
p.s. I'm the author of pkix.net library.

Related

Can we have “duplicate symbols” error when using frameworks in pure swift?

Years ago, using ObjC and frameworks (and frameworks inside frameworks), it was common from time to time the “duplicate symbols” error. For example, if you created a framework including RestKit and then the app that wanted to use that framework was using RestKit too, you had that error. One way to fix it was to rename the included source code into your framework using a prefix. Or just avoid using 3rd party dependencies on your framework. Note we used to use static libraries, rather than dynamic libraries.
Is it possible to have the same problem with pure swift apps/frameworks and dynamic libraries today? As far as I understand, swift uses the concept of module for namespaces, something we didn’t have with ObjC.
I mean, is it possible to create a framework that uses Alamofire (let’s say version 5), and then create an app that uses Alamofire (let’s say version 5.0.1) AND your framework that uses Alamofire too?
I am using a similar setup and i did not face any such duplicate symbols in my project.
Let me share my experience.
I have a project setup like the one below.
Main Project -> uses PromiseKit via Cocoapods
My Framework -> uses PromiseKit via Cocoapods
Main Project uses My Framework
I did not face any such issue while running this setup. IMO, hope it is taken care by Swift compiler.

importing native iOS framework to nativescript plugin

I'm trying to access an iOS framework class from my NativeScript plugin.
Right now, this plugin only has a SampleClass with a test method that returns a number, but it will change soon. For now, what I'm trying to do is to call the class method from that native framework.
I have seen some examples where the plugin seed extends an iOS base class and creates everything there, but in this case, I want to use a .framework file.
I'm assuming this would be equivalent to use some .aar Android file. In that case, I've seen the call would be made with something like this
var c = java.lang.Class.forName("org.test.plugin.name.MyActivity");
So, I have copied the .framework file to platforms/ios, my question is about how to get this SampleClass method.
Also, I've seen some documentation that recommends the use of CocoaPods. I'm new to iOS development and still don't get this at all, but if my application won't use any native dependency, would this be necessary? Should I need another files? (got a default Info.plist and build.xcconfig)
Thank you for your answers.
Since you are using TypeScript, you have to either declare the classes like,
// iOS
declare var SampleClass;
// Android
declare var org;
then you may access all available packages / classes / methods directly.
// Android
const MyActivity = org.test.plugin.name.MyActivity;
// iOS
SampleClass.new()
If you like intellisense support for these libraries, then you may even generate declaration files for both iOS & Android libraries with the given steps in the docs.

Is it possible to export an iOS Framework binary to a static library?

We are using a 3rd party Framework in our iOS app and now have a need to create a new Framework to abstract this framework. My understanding is that Frameworks cannot contain other Frameworks. Is there a method to convert? I've been googling this for days, any pointers are appreciated.

Whirlyglobe private API complain during app submission

I have a simple app which uses whirlyglobe framework (2.2). Otherwise, it is pretty basic program with Apple frameworks.
When I tried to validate the app (and during the distribution, Xcode complains that my app is using private API; specifically it calls "rootElement", and "attributeForFont:". I suspect these functions are part of WhilyGlobe component distribution.
What is the easiest way to remove those files from the framework? Do I need to have the source and compile the framework myself? Or is there a simpler way?
Solved. Here is what I did:
1) Searched in github repository of WhirlyGlobe and found the file that uses the functions which caused issue.
2) I did not need the functionality provided by the file that had the functions.
3) Removed the references (class instantiation) to the file from my project.
That's actually part of the KissXML framework and the implementation is in there. I suspect Apple's test is in error.
In any case, if you're not using the WMS functionality, you can probably drop it out just fine.

Using a static iOS library with RubyMotion

I am interested in RubyMotion, but would like to understand more about using 3rd party iOS frameworks before paying the license fee.
I see in section 2.2 here, it states:
"To vendor a 3rd-party library in a RubyMotion project, the source
code must be available somewhere on the filesystem."
My understanding of an iOS framework is essentially a static library (.a file) and a bunch of header files, with no source code - this seems to suggest to me that it is not possible to use a 3rd party iOS framework with RubyMotion.
However, reading this documentation further states that it is possible to supply the project type :static to the vendor_project method along with :products (an array of static library names) and :headers_dir (path to the directory that contains public headers files). This seems to contradict the assertion that the source code must be available.
So my question - is it possible to use a closed-source 3rd party iOS framework with RubyMotion where there is no access to the source code?
Yes it's totally possible. I think what the documentation means is just you need to include everything you use in the project.
You can either use a xcode project or as you said, a static library(.a file) with several header files (maybe some objective-c wrapper files too).
something like this in your Rakefile will do the job!
app.vendor_project('vendor/your-lib-name', :static,
:products => ['lib.a'],
:headers_dir => 'lib-header-path')
here is an article that I found really helpful, it explains well how to use 3rd party library in RubyMotion.
Other than including a library in your project manually, you can also use libraries available on Cocoapods. There is a RubyMotion wrapper - motioncocoapods for this, i recently done an article on this subject, you can have a look if you are interestd.

Resources