Skip to content
Crypto extensions for Cactoos library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.pdd.yml
.rultor.yml
.travis.yml
LICENSE
README.md
appveyor.yml
pom.xml

README.md

cactoos-crypto

EO principles respected here Managed by Zerocracy DevOps By Rultor.com

Bintray Build Status PDD status License Test Coverage

Cryptography extensions for Cactoos library.

Cipher as input/output

To encrypt/decrypt an input:

final Scalar<Cipher> cipher = new CipherFrom(
    "AES/CBC/PKCS5Padding",
    new CipherSpec(key, iv)
);
final Input encrypted = new CryptoInput.Enc(
  new InputOf(file),
  cipher
);
final Input decrypted = new CryptoInput.Dec(
  encrypted,
  cipher
);

To encrypt/decrypt an output:

final Scalar<Cipher> cipher = new CipherFrom(
    "AES/CBC/PKCS5Padding",
    new CipherSpec(key, iv)
);
final Output decrypting = new CryptoOutput.Dec(
  new OutputTo(file),
  cipher
);
final Output encrypting = new CryptoOutput.Enc(
  decrypting,
  cipher
);

MAC (Message Authentication Code) as Bytes:

To compute MAC of input:

final Bytes hmac = new MacOf(
  new InputOf(file),
  new MacFrom(
    "HmacSHA256",
    new MacSpec(key)
  )
);

MessageDigest as Bytes:

To compute message-digest of input:

final Bytes digest = new DigestOf(
  new InputOf(file),
  new DigestFrom("SHA-256")
);

Install

mvn:

<dependency>
  <groupId>com.g4s8</groupId>
  <artifactId>cryptocactoos</artifactId>
</dependency>

gradle:

  "com.g4s8:cryptocactoos:<vesion>"
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.