Examples of Encryptor


Examples of com.avaje.ebean.config.Encryptor

    this.namingConvention = serverConfig.getNamingConvention();
        this.dbPlatform = serverConfig.getDatabasePlatform();
        this.encryptDeployManager = serverConfig.getEncryptDeployManager();
        this.encryptKeyManager = serverConfig.getEncryptKeyManager();
       
        Encryptor be = serverConfig.getEncryptor();
        this.bytesEncryptor = be != null ? be : new SimpleAesEncryptor();
   
    // this alias is used for ManyToMany lazy loading queries
    this.manyToManyAlias = "zzzzzz";
  }
View Full Code Here

Examples of de.iritgo.aktera.crypto.Encryptor

      String service = oneSeq.substring(0, oneSeq.indexOf("."));
      String method = oneSeq.substring(oneSeq.indexOf(".") + 1);

      try
      {
        Encryptor oneEncryptor = (Encryptor) req.getService(Encryptor.ROLE, service);

        if (method.equals("encrypt"))
        {
          current = new String(oneEncryptor.decrypt(current.getBytes("UTF-8")), "UTF-8");
        }
        else if (method.equals("hash"))
        {
          current = new String(oneEncryptor.hash(current.getBytes("UTF-8")), "UTF-8");
        }
        else
        {
          throw new ModelException("Method '" + method + "' invalid.");
        }
View Full Code Here

Examples of de.iritgo.aktera.crypto.Encryptor

      String service = oneSeq.substring(0, oneSeq.indexOf("."));
      String method = oneSeq.substring(oneSeq.indexOf(".") + 1);

      try
      {
        Encryptor oneEncryptor = (Encryptor) req.getService(Encryptor.ROLE, service);

        if (method.equals("encrypt"))
        {
          current = new String(oneEncryptor.encrypt(current.getBytes("UTF-8")), "UTF-8");
        }
        else if (method.equals("hash"))
        {
          current = new String(oneEncryptor.hash(current.getBytes("UTF-8")), "UTF-8");
        }
        else
        {
          throw new ModelException("Method '" + method + "' invalid.");
        }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

      if (plaintextLength > 0) {

        // Set up the cipher
        Cipher cipher = cryptoContext.getCipher();
        Encryptor encryptor = cipher.getEncryptor();
        encryptor.setKey(cryptoContext.getKey());

        // Set up the IV
        int ivLength = iv.length;
        Preconditions.checkState(ivLength <= Byte.MAX_VALUE, "IV length out of range");
        cryptoByteStream.write(ivLength);
        if (ivLength > 0) {
          encryptor.setIv(iv);
          cryptoByteStream.write(iv);
        }

        // Encrypt the data
        Encryption.encrypt(cryptoByteStream, in, encryptor);

        onDiskBytesWithHeader = cryptoByteStream.toByteArray();

        // Increment the IV given the final block size
        Encryption.incrementIv(iv, 1 + (onDiskBytesWithHeader.length / encryptor.getBlockSize()));

      } else {

        cryptoByteStream.write(0);
        onDiskBytesWithHeader = cryptoByteStream.toByteArray();
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

      if (plaintextLength > 0) {

        // Set up the cipher
        Cipher cipher = cryptoContext.getCipher();
        Encryptor encryptor = cipher.getEncryptor();
        encryptor.setKey(cryptoContext.getKey());

        // Set up the IV
        int ivLength = iv.length;
        Preconditions.checkState(ivLength <= Byte.MAX_VALUE, "IV length out of range");
        cryptoByteStream.write(ivLength);
        if (ivLength > 0) {
          encryptor.setIv(iv);
          cryptoByteStream.write(iv);
        }

        // Encrypt the data
        Encryption.encrypt(cryptoByteStream, in, encryptor);

        onDiskBytesWithHeader = cryptoByteStream.toByteArray();

        // Increment the IV given the final block size
        Encryption.incrementIv(iv, 1 + (onDiskBytesWithHeader.length / encryptor.getBlockSize()));

      } else {

        cryptoByteStream.write(0);
        onDiskBytesWithHeader = cryptoByteStream.toByteArray();
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

  public OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv)
      throws IOException {
    Preconditions.checkNotNull(context);
    Preconditions.checkState(context.getKey() != null, "Context does not have a key");
    Preconditions.checkNotNull(iv);
    Encryptor e = getEncryptor();
    e.setKey(context.getKey());
    e.setIv(iv);
    return e.createEncryptionStream(out);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

  public void testAESAlgorithm() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    Cipher aes = Encryption.getCipher(conf, "AES");
    assertEquals(aes.getKeyLength(), AES.KEY_LENGTH);
    assertEquals(aes.getIvLength(), AES.IV_LENGTH);
    Encryptor e = aes.getEncryptor();
    e.setKey(new SecretKeySpec(Bytes.fromHex("2b7e151628aed2a6abf7158809cf4f3c"), "AES"));
    e.setIv(Bytes.fromHex("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"));

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputStream cout = e.createEncryptionStream(out);
    cout.write(Bytes.fromHex("6bc1bee22e409f96e93d7e117393172a"));
    cout.write(Bytes.fromHex("ae2d8a571e03ac9c9eb76fac45af8e51"));
    cout.write(Bytes.fromHex("30c81c46a35ce411e5fbc1191a0a52ef"));
    cout.write(Bytes.fromHex("f69f2445df4f9b17ad2b417be66c3710"));
    cout.close();
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

  public OutputStream createEncryptionStream(OutputStream out, Context context, byte[] iv)
      throws IOException {
    Preconditions.checkNotNull(context);
    Preconditions.checkState(context.getKey() != null, "Context does not have a key");
    Preconditions.checkNotNull(iv);
    Encryptor e = getEncryptor();
    e.setKey(context.getKey());
    e.setIv(iv);
    return e.createEncryptionStream(out);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

  public void testAESAlgorithm() throws Exception {
    Configuration conf = HBaseConfiguration.create();
    Cipher aes = Encryption.getCipher(conf, "AES");
    assertEquals(aes.getKeyLength(), AES.KEY_LENGTH);
    assertEquals(aes.getIvLength(), AES.IV_LENGTH);
    Encryptor e = aes.getEncryptor();
    e.setKey(new SecretKeySpec(Bytes.fromHex("2b7e151628aed2a6abf7158809cf4f3c"), "AES"));
    e.setIv(Bytes.fromHex("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"));

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputStream cout = e.createEncryptionStream(out);
    cout.write(Bytes.fromHex("6bc1bee22e409f96e93d7e117393172a"));
    cout.write(Bytes.fromHex("ae2d8a571e03ac9c9eb76fac45af8e51"));
    cout.write(Bytes.fromHex("30c81c46a35ce411e5fbc1191a0a52ef"));
    cout.write(Bytes.fromHex("f69f2445df4f9b17ad2b417be66c3710"));
    cout.close();
View Full Code Here

Examples of org.apache.hadoop.hbase.io.crypto.Encryptor

      if (plaintextLength > 0) {

        // Set up the cipher
        Cipher cipher = cryptoContext.getCipher();
        Encryptor encryptor = cipher.getEncryptor();
        encryptor.setKey(cryptoContext.getKey());

        // Set up the IV
        int ivLength = iv.length;
        Preconditions.checkState(ivLength <= Byte.MAX_VALUE, "IV length out of range");
        cryptoByteStream.write(ivLength);
        if (ivLength > 0) {
          Encryption.incrementIv(iv);
          encryptor.setIv(iv);
          cryptoByteStream.write(iv);
        }

        // Encrypt the data
        Encryption.encrypt(cryptoByteStream, in, encryptor);
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.