Examples of AesKey


Examples of org.keyczar.AesKey

            if (entry.hasVersion()) {
                version = entry.getVersion();
            }

            CryptoKey v0;
            AesKey v1;

            if (version == 0) {
                AesCbcCryptoKey passwordKey = AesCbcCryptoKey.deriveKey(entry.getIterations(), entry.getSeed()
                        .toByteArray(), password);
                byte[] plaintext = FathomdbCrypto.decrypt(passwordKey, entry.getCiphertext().toByteArray());
                v0 = FathomdbCrypto.deserializeKey(plaintext);

                HmacKey hmacKey = KeyczarUtils.deriveHmac(plaintext, entry.getSeed().toByteArray(), password);
                v1 = new AesKey(((AesCbcCryptoKey) v0).getJce().getEncoded(), hmacKey);
            } else if (version == 1) {
                AesKey passwordKey = KeyczarUtils.deriveKey(entry.getIterations(), entry.getSeed().toByteArray(),
                        password);

                byte[] plaintext = KeyczarUtils.decrypt(passwordKey, entry.getCiphertext().toByteArray());

                v1 = KeyczarUtils.unpack(plaintext);
View Full Code Here

Examples of org.keyczar.AesKey

        return KeyczarUtils.encrypt(passwordKey, serialized);
    }

    public UserWithSecret checkPublicKey(UserData user, CredentialData credential, ClientCertificate clientCertificate,
            ByteString challenge, ByteString responseData) {
        AesKey secretKey;

        if (!ChallengeResponses.hasPrefix(responseData.toByteArray())) {
            log.warn("Challenge response was not valid");
            return null;
        }
View Full Code Here

Examples of org.keyczar.AesKey

            if (!ChallengeResponses.hasPrefix(plaintext)) {
                throw new IllegalArgumentException();
            }
            byte[] payload = ChallengeResponses.getPayload(plaintext);
            payload = ChallengeResponses.getPayload(payload);
            AesKey cryptoKey;
            try {
                cryptoKey = KeyczarUtils.unpack(payload);
            } catch (KeyczarException e) {
                throw new IllegalArgumentException("Invalid key", e);
            }
View Full Code Here

Examples of org.keyczar.AesKey

                // TODO: Remove once we've migrated all the projects
                log.warn("Creating project key for project: {}", projectId);

                Migrations.report(project);

                AesKey cryptoKey = KeyczarUtils.generateSymmetricKey();

                long userId = user.getUserId();

                SecretToken secretToken = new SecretToken(SecretTokenType.PROJECT_SECRET, cryptoKey, null);
                AuthenticatedProject authenticatedProject = new AuthenticatedProject(project, secretToken);
View Full Code Here

Examples of org.keyczar.AesKey

        this.cryptoKey = cryptoKey;
        this.deprecatedKey = deprecatedKey;
    }

    public static SecretToken create(SecretTokenType type) {
        AesKey key = KeyczarUtils.generateSymmetricKey();
        return new SecretToken(type, key, null);
    }
View Full Code Here

Examples of org.smslib.crypto.AESKey

      System.out.println();
      // In case you work with encrypted messages, its a good time to declare your keys.
      // Create a new AES Key with a known key value.
      // Register it in KeyManager in order to keep it active. SMSLib will then automatically
      // encrypt / decrypt all messages send to / received from this number.
      Service.getInstance().getKeyManager().registerKey("+306948494037", new AESKey(new SecretKeySpec("0011223344556677".getBytes(), "AES")));
      // Read Messages. The reading is done via the Service object and
      // affects all Gateway objects defined. This can also be more directed to a specific
      // Gateway - look the JavaDocs for information on the Service method calls.
      msgList = new ArrayList<InboundMessage>();
      Service.getInstance().readMessages(msgList, MessageClasses.ALL);
View Full Code Here

Examples of org.smslib.crypto.AESKey

    System.out.println();
   
    // Create a new AES Key with a known key value.
    // Register it in KeyManager in order to keep it active. SMSLib will then automatically
    // encrypt / decrypt all messages send to / received from this number.
    Service.getInstance().getKeyManager().registerKey("+306948494037", new AESKey(new SecretKeySpec("0011223344556677".getBytes(), "AES")));

    OutboundEncryptedMessage msg = new OutboundEncryptedMessage("+306948494037", "Hello (encrypted) from SMSLib!".getBytes());
    Service.getInstance().sendMessage(msg);
    System.out.println(msg);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.