# Logstash logstash-filter-cipher plugin

**URL:** <https://discuss.elastic.co/t/logstash-logstash-filter-cipher-plugin/159336>\
**Category:** Logstash\
**Created:** [December 4, 2018, 10:27am UTC](https://discuss.elastic.co/t/logstash-logstash-filter-cipher-plugin/159336 "2018-12-04T10:27:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmkim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jmkim/32/37997_2.png) [@jmkim](https://discuss.elastic.co/u/jmkim)\
**Post date:** [December 4, 2018, 10:27am UTC](https://discuss.elastic.co/t/logstash-logstash-filter-cipher-plugin/159336/1 "2018-12-04T10:27:48Z")

</div>

Hi.

logstash-filter-cipher plugin is error.

It does not decrypt normally.  
What is the problem?

**case1. I want hex to bin!**

```
ruby {
  code => "
    event.set('binary_ip', Array(event.get('encrypt_ip')).pack('H*'))
  "
}

```

**case2. I want decrypt**

**code:**

```
  ruby {
    code => "
      event.set('binary_ip', Array(event.get('encrypt_ip')).pack('H*'))
    "
  }

  cipher {
    algorithm => "aes-128-cbc"
    cipher_padding => 1

    iv_random_length => 16

    key => " ****************"
    key_size => 16
  
    mode => "decrypt"
    source => "binary_ip"
    target => "ip_decrypted"
  }

```

**debug:**

```
[2018-12-05T10:53:27,451][WARN][logstash.filters.cipher] Exception catch on cipher filter {:event=>#<LogStash::Event:0x53fe73c8>, :error=>#<ArgumentError: data must not be empty>}
{
 "message" => "_d7fcfefb1bef6f315602957c17c6d5df",
 "binary_ip" => "\xD7\xFC\xFE\xFB\e\xEFo1V\x02\x95|\x17\xC6\xD5\xDF",
 "encrypt_ip" => "d7fcfefb1bef6f315602957c17c6d5df"
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 1, 2019, 10:27am UTC](https://discuss.elastic.co/t/logstash-logstash-filter-cipher-plugin/159336/2 "2019-01-01T10:27:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
