Skip to content

Instantly share code, notes, and snippets.

@TheGeekPharaoh
TheGeekPharaoh / gist:213b4a840753defab79e203f3eac8a18
Created April 18, 2018 13:06
CMS Signature Creation/Validation with Swift and OpenSSL
let testBundle = Bundle(for: type(of: self))
guard let textUrl = testBundle.url(forResource: "test_message", withExtension: "txt"),
let signingKeyUrl = testBundle.url(forResource: "key", withExtension: "pem"),
let signingCertUrl = testBundle.url(forResource: "cert", withExtension: "pem") else {
exit(1)
}
let certFileObject = signingCertUrl.path.withCString { filePtr in
return fopen(filePtr, "rb")
package de.tdlabs.training.keycloak;
import static java.util.Arrays.asList;
import javax.ws.rs.core.Response;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.representations.idm.CredentialRepresentation;