0

I need to pass a CakePHP code to Java. One part of that is find a way to encrypt and decrypt some cards number.

In cakePHP use Cast-256 (http://es.wikipedia.org/wiki/CAST-256) . Im finding a Cast-256's implementation on Java but im not geeting goods news.

I find in a post (https://forums.oracle.com/thread/1532311?tstart=4680) i should use that library org.bouncycastle. But i cant find a example of howto.

The question is: You know a way of encrypt and decrypt information with Cast-256 in Java? Show me one example.

Thanks

4

1 回答 1

2

根据 wiki 文章,CAST-256 也称为 CAST6,由充气城堡提供商提供支持。

行家;

<dependency>
  <groupId>bouncycastle</groupId>
  <artifactId>bcprov-jdk15</artifactId>
  <version>140</version>
</dependency>

代码;

Security.addProvider(new BouncyCastleProvider());
Cipher cipher = Cipher.getInstance("CAST6");

如果您不知道如何在 java 中使用分组密码,那么请使用 google 一下。有很多教程。

于 2013-07-30T10:03:09.507 回答