This file can be downloaded as part of milnlicence.tbz.

//  LCCertificateChainProtocol.h
//  LicenceCore -
//  Copyright © Graham Miln. All rights reserved.
//  This package is subject to the terms of the Artistic License 2.0.
//  If a copy of the Artistic-2.0 was not distributed with this file, you can
//  obtain one at

@import Foundation;

//NSString* LCCertificateChainServiceName = @"eu.miln.licence.xpc.certificate-chain";

@protocol LCCertificateChainProtocol

/** Return a complete certificate chain as an aggregate PEM block. */
- (void)certificateChainFor:(NSData*)pemData withReply:(void (^)(NSData*, NSError*))reply;


 To use the service from an application or other process, use NSXPCConnection to establish a connection to the service by doing something like this:

     _connectionToService = [[NSXPCConnection alloc] initWithServiceName:LCCertificateChainServiceName];
     _connectionToService.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(LCCertificateChainProtocol)];
     [_connectionToService resume];

Once you have a connection to the service, you can use it like this:

     [[_connectionToService remoteObjectProxy] certificateChainFor:mySingleCertAsPEM withReply:^(NSData* inAggregatePEM, NSError* inError) {
         // We have received a response. Import the chain of certicates.
         NSLog(@"Result was: %@", pemChain);

 And, when you are finished with the service, clean up the connection like this:

     [_connectionToService invalidate];