public void test() throws IOException, CertificateException, NoSuchAlgorithmException {
Client user = Client.builder().certificate(certificate).orgname("jclouds").clientname("adriancole-jcloudstest")
.name("adriancole-jcloudstest").isValidator(false).privateKey(privateKey).build();
byte[] encrypted = ByteStreams2.toByteArrayAndClose(new RSAEncryptingPayload(new JCECrypto(), Payloads.newPayload("fooya"), user
.getCertificate().getPublicKey()).openStream());
assertEquals(
ByteStreams2.toByteArrayAndClose(new RSADecryptingPayload(new JCECrypto(), Payloads.newPayload(encrypted), user.getPrivateKey()).openStream()),
"fooya".getBytes());