Package org.keyczar

Examples of org.keyczar.KeyczarKey


        RsaPrivateKey privateKey = null;

        if (request.keypair.publicKey != null) {
            sshPublicKey = OpenSshUtils.readSshPublicKey(request.keypair.publicKey);
        } else {
            KeyczarKey keypair = keypairs.generateKeypair();

            KeyczarPublicKey keyczarPublicKey = KeyczarUtils.getPublicKey(keypair);
            sshPublicKey = KeyczarUtils.getJce(keyczarPublicKey);

            privateKey = KeyczarUtils.getPrivateKey(keypair);
View Full Code Here


        return true;
    }

    public KeyczarKey generateKeypair() {
        try {
            KeyczarKey keypair = KeyczarUtils.createKey(new KeyMetadata("RSA Key", KeyPurpose.DECRYPT_AND_ENCRYPT,
                    DefaultKeyType.RSA_PRIV));
            return keypair;
        } catch (Exception e) {
            throw new IllegalStateException("Error generating keypair", e);
        }
View Full Code Here

            Migrations.report(userData);

            UserData.Builder userDataBuilder = UserData.newBuilder(userData);
            UserSecretData.Builder userSecretDataBuilder = UserSecretData.newBuilder(userSecretData);

            KeyczarKey keypair = KeyczarUtils.createKey(new KeyMetadata("RSA Key", KeyPurpose.DECRYPT_AND_ENCRYPT,
                    DefaultKeyType.RSA_PRIV));

            if (userSecretDataBuilder.getPrivateKeyBuilder().hasKeyczar()) {
                throw new IllegalStateException();
            }

            userSecretDataBuilder.getPrivateKeyBuilder().setKeyczar(keypair.toString());

            if (userDataBuilder.getPublicKeyBuilder().hasKeyczar()) {
                throw new IllegalStateException();
            }
View Full Code Here

        if (challengeKey != null) {
            secretService.addPublicKeyAuth(user, challengeKey, request.publicKeyChallengeResponse);
        }

        KeyczarKey keypair = KeyczarUtils.createKey(new KeyMetadata("RSA Key", KeyPurpose.DECRYPT_AND_ENCRYPT,
                DefaultKeyType.RSA_PRIV));

        user.getPublicKeyBuilder().setKeyczar(KeyczarUtils.getPublicKey(keypair).toString());

        // Create the secret data
        {
            if (user.hasSecretData()) {
                throw new IllegalStateException();
            }

            UserSecretData.Builder s = UserSecretData.newBuilder();
            if (Strings.isNullOrEmpty(user.getName())) {
                throw new IllegalArgumentException();
            }
            // s.setVerifyPublicKey(Hashing.md5().hashBytes(publicKey).asLong());
            s.getPrivateKeyBuilder().setKeyczar(keypair.toString());

            user.setSecretData(Secrets.buildUserSecret(userSecret, s.build()));
        }

        UserData created = authRepository.getUsers().create(user);
View Full Code Here

TOP

Related Classes of org.keyczar.KeyczarKey

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.