/// <summary> /// Creates a factory using service credentials. Allows interacting with just services, as service credentials have no child services or directories. /// </summary> /// <param name="serviceId">The unique service ID of the service</param> /// <param name="privateKeyPem">The private key to use. Should be the key itself -- not a path.</param> /// <returns>A configured ServiceFactory, ready to create ServiceClients</returns> public ServiceFactory MakeServiceFactory(string serviceId, string privateKeyPem) { var key = _crypto.LoadRsaPrivateKey(privateKeyPem); var keys = new Dictionary <string, RSA>(); var id = new EntityIdentifier(EntityType.Service, Guid.Parse(serviceId)); var fingerprint = _crypto.GeneratePublicKeyFingerprintFromPrivateKey(key); keys.Add(fingerprint, key); return(new ServiceFactory(MakeTransport(id, keys, fingerprint), Guid.Parse(serviceId))); }