Package com.fathomdb.crypto

Examples of com.fathomdb.crypto.CertificateAndKey


        List<X509Certificate> certificateChain = Certificates.fromPem(certificate);

        String keypairEncoded = getSecret(found, "privatekey");
        KeyPair keypair = KeyPairs.fromPem(keypairEncoded);

        CertificateAndKey certificateAndKey = new SimpleCertificateAndKey(certificateChain, keypair.getPrivate());
        encryptionStore.setCertificateAndKey(alias, certificateAndKey);

        return null;
    }
View Full Code Here


        if (!id.equals("root")) {
            throw new IllegalStateException();
        }

        X500Principal subject = new X500Principal("CN=" + "root");
        CertificateAndKey certificateAndKey = createSelfSigned(subject, 2048);

        WrappedCertificate response = new WrappedCertificate();
        response.certificate = new Certificate();
        response.certificate.data = Hex.toHex(certificateAndKey.getPublicKey().getEncoded());
        return response;
    }
View Full Code Here

            throw new WebApplicationException(Status.UNAUTHORIZED);
        }

        X500Principal subject = new X500Principal("CN=" + "user-" + user.getId());

        CertificateAndKey certificateAndKey = createSelfSigned(subject, 2048);

        response.certificate.privateKey = Hex.toHex(certificateAndKey.getPrivateKey().getEncoded());
        response.certificate.data = Hex.toHex(certificateAndKey.getPublicKey().getEncoded());

        return response;
    }
View Full Code Here

        URI uri = URI.create(serverUri);

        OpenstackIdentityClient identityClient = CertificateAuthTokenProvider.ensureRegistered(keypair, uri, email);

        CertificateAndKey certificateAndKey = CertificateAuthTokenProvider.createSelfSigned(keypair, email);

        String project = identityClient.getUtils().ensureProjectWithPrefix("__federation__");

        CertificateAuthTokenProvider tokenProvider = new CertificateAuthTokenProvider(identityClient, project,
                certificateAndKey);
View Full Code Here

        }
    }

    public static OpenstackIdentityClient ensureRegistered(KeyPair keypair, URI uri, String email)
            throws RestClientException {
        CertificateAndKey certificateAndKey = createSelfSigned(keypair, email);

        OpenstackIdentityClient auth = CertificateAuthTokenProvider.tryAuth(uri, certificateAndKey);
        if (auth == null) {
            registerKey(uri, email, certificateAndKey);
View Full Code Here

        return auth;
    }

    public static CertificateAndKey createSelfSigned(KeyPair keypair, String email) {
        X500Principal subject = new X500Principal("CN=" + email);
        CertificateAndKey certificateAndKey = ChallengeResponses.createSelfSigned(subject, keypair);
        return certificateAndKey;
    }
View Full Code Here

        HttpClient httpClient = JreHttpClient.create();
        OpenstackIdentityClient identityClient = new OpenstackIdentityClient(httpClient, uri, null);

        X500Principal subject = new X500Principal("CN=" + "unknown");
        CertificateAndKey certificateAndKey = ChallengeResponses.createSelfSigned(subject, keypair);

        String project = backendData.getBackendCookie();
        if (project == null) {
            throw new IllegalStateException();
            // log.warn("No backend project configured: {}",
View Full Code Here

TOP

Related Classes of com.fathomdb.crypto.CertificateAndKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.