CrossClj

0.1.1 docs

SourceDocs



RECENT

    org.azjure/azjure

    Clojars

    Jan 25, 2014


    OWNER
    Jason Ozias
    Maineville,OH
    jason.g.ozias@gmail.com
    www.ozias.net

    Readme

    Index of all namespaces


    « Project + dependencies

    Encryption Library in Clojure

    org.azjure.cryptsuiteDocsSource

    VARS

    A ->AESCBCISO10126 ->AESCBCISO7816 ->AESCBCPKCS7 ->AESCBCX923 ->AESCBCZERO ->AESCFB ->AESCTR ->AESECBISO10126 ->AESECBISO7816 ->AESECBPKCS7 ->AESECBX923 ->AESECBZERO ->AESOFB ->AESPCBCISO10126 ->AESPCBCISO7816 ->AESPCBCPKCS7 ->AESPCBCX923 ->AESPCBCZERO AES

    B ->BFCBCISO10126 ->BFCBCISO7816 ->BFCBCPKCS7 ->BFCBCX923 ->BFCBCZERO ->BFCFB ->BFCTR ->BFECBISO10126 ->BFECBISO7816 ->BFECBPKCS7 ->BFECBX923 ->BFECBZERO ->BFOFB ->BFPCBCISO10126 ->BFPCBCISO7816 ->BFPCBCPKCS7 ->BFPCBCX923 ->BFPCBCZERO Blowfish

    C ->CAST5CBCISO10126 ->CAST5CBCISO7816 ->CAST5CBCPKCS7 ->CAST5CBCX923 ->CAST5CBCZERO ->CAST5CFB ->CAST5CTR ->CAST5ECBISO10126 ->CAST5ECBISO7816 ->CAST5ECBPKCS7 ->CAST5ECBX923 ->CAST5ECBZERO ->CAST5OFB ->CAST5PCBCISO10126 ->CAST5PCBCISO7816 ->CAST5PCBCPKCS7 ->CAST5PCBCX923 ->CAST5PCBCZERO ->CAST6CBCISO10126 ->CAST6CBCISO7816 ->CAST6CBCPKCS7 ->CAST6CBCX923 ->CAST6CBCZERO ->CAST6CFB ->CAST6CTR ->CAST6ECBISO10126 ->CAST6ECBISO7816 ->CAST6ECBPKCS7 ->CAST6ECBX923 ->CAST6ECBZERO ->CAST6OFB ->CAST6PCBCISO10126 ->CAST6PCBCISO7816 ->CAST6PCBCPKCS7 ->CAST6PCBCX923 ->CAST6PCBCZERO CAST5 CAST6 CBC CFB CryptSuite CTR

    D decryptor

    E ECB encryptor

    I ISO10126 ISO7816

    M map->AESCBCISO10126 map->AESCBCISO7816 map->AESCBCPKCS7 map->AESCBCX923 map->AESCBCZERO map->AESCFB map->AESCTR map->AESECBISO10126 map->AESECBISO7816 map->AESECBPKCS7 map->AESECBX923 map->AESECBZERO map->AESOFB map->AESPCBCISO10126 map->AESPCBCISO7816 map->AESPCBCPKCS7 map->AESPCBCX923 map->AESPCBCZERO map->BFCBCISO10126 map->BFCBCISO7816 map->BFCBCPKCS7 map->BFCBCX923 map->BFCBCZERO map->BFCFB map->BFCTR map->BFECBISO10126 map->BFECBISO7816 map->BFECBPKCS7 map->BFECBX923 map->BFECBZERO map->BFOFB map->BFPCBCISO10126 map->BFPCBCISO7816 map->BFPCBCPKCS7 map->BFPCBCX923 map->BFPCBCZERO map->CAST5CBCISO10126 map->CAST5CBCISO7816 map->CAST5CBCPKCS7 map->CAST5CBCX923 map->CAST5CBCZERO map->CAST5CFB map->CAST5CTR map->CAST5ECBISO10126 map->CAST5ECBISO7816 map->CAST5ECBPKCS7 map->CAST5ECBX923 map->CAST5ECBZERO map->CAST5OFB map->CAST5PCBCISO10126 map->CAST5PCBCISO7816 map->CAST5PCBCPKCS7 map->CAST5PCBCX923 map->CAST5PCBCZERO map->CAST6CBCISO10126 map->CAST6CBCISO7816 map->CAST6CBCPKCS7 map->CAST6CBCX923 map->CAST6CBCZERO map->CAST6CFB map->CAST6CTR map->CAST6ECBISO10126 map->CAST6ECBISO7816 map->CAST6ECBPKCS7 map->CAST6ECBX923 map->CAST6ECBZERO map->CAST6OFB map->CAST6PCBCISO10126 map->CAST6PCBCISO7816 map->CAST6PCBCPKCS7 map->CAST6PCBCX923 map->CAST6PCBCZERO map->TEACBCISO10126 map->TEACBCISO7816 map->TEACBCPKCS7 map->TEACBCX923 map->TEACBCZERO map->TEACFB map->TEACTR map->TEAECBISO10126 map->TEAECBISO7816 map->TEAECBPKCS7 map->TEAECBX923 map->TEAECBZERO map->TEAOFB map->TEAPCBCISO10126 map->TEAPCBCISO7816 map->TEAPCBCPKCS7 map->TEAPCBCX923 map->TEAPCBCZERO map->TFCBCISO10126 map->TFCBCISO7816 map->TFCBCPKCS7 map->TFCBCX923 map->TFCBCZERO map->TFCFB map->TFCTR map->TFECBISO10126 map->TFECBISO7816 map->TFECBPKCS7 map->TFECBX923 map->TFECBZERO map->TFOFB map->TFPCBCISO10126 map->TFPCBCISO7816 map->TFPCBCPKCS7 map->TFPCBCX923 map->TFPCBCZERO map->XTEACBCISO10126 map->XTEACBCISO7816 map->XTEACBCPKCS7 map->XTEACBCX923 map->XTEACBCZERO map->XTEACFB map->XTEACTR map->XTEAECBISO10126 map->XTEAECBISO7816 map->XTEAECBPKCS7 map->XTEAECBX923 map->XTEAECBZERO map->XTEAOFB map->XTEAPCBCISO10126 map->XTEAPCBCISO7816 map->XTEAPCBCPKCS7 map->XTEAPCBCX923 map->XTEAPCBCZERO

    O OFB

    P PCBC PKCS7

    T ->TEACBCISO10126 ->TEACBCISO7816 ->TEACBCPKCS7 ->TEACBCX923 ->TEACBCZERO ->TEACFB ->TEACTR ->TEAECBISO10126 ->TEAECBISO7816 ->TEAECBPKCS7 ->TEAECBX923 ->TEAECBZERO ->TEAOFB ->TEAPCBCISO10126 ->TEAPCBCISO7816 ->TEAPCBCPKCS7 ->TEAPCBCX923 ->TEAPCBCZERO ->TFCBCISO10126 ->TFCBCISO7816 ->TFCBCPKCS7 ->TFCBCX923 ->TFCBCZERO ->TFCFB ->TFCTR ->TFECBISO10126 ->TFECBISO7816 ->TFECBPKCS7 ->TFECBX923 ->TFECBZERO ->TFOFB ->TFPCBCISO10126 ->TFPCBCISO7816 ->TFPCBCPKCS7 ->TFPCBCX923 ->TFPCBCZERO TEA Twofish

    X ->XTEACBCISO10126 ->XTEACBCISO7816 ->XTEACBCPKCS7 ->XTEACBCX923 ->XTEACBCZERO ->XTEACFB ->XTEACTR ->XTEAECBISO10126 ->XTEAECBISO7816 ->XTEAECBPKCS7 ->XTEAECBX923 ->XTEAECBZERO ->XTEAOFB ->XTEAPCBCISO10126 ->XTEAPCBCISO7816 ->XTEAPCBCPKCS7 ->XTEAPCBCX923 ->XTEAPCBCZERO X923 XTEA

    Z Zeropad

    The README below is fetched from the published project artifact. Some relative links may be broken.

    azjure

    Cryptography implementations in Clojure

    Usage

    Add the following in the dependencies section of your project.clj file

    :dependencies [...
                   [org.azjure/azjure "0.1.0"]
                   ...]
    

    Block Ciphers

    (:require [org.azjure.cryptsuite :as cs :refer (->AESCBCPKCS7)]
              (org.azjure.cipher [cipher :as cipher]
                                 [aes :refer (->AES)])
    

    Encrypt

    ;; Initialize the cipher (key should be a vector of unsigned bytes).
    (def initmap (cipher/initialize (->AES) {:key key}))
    ;; Encrypt (plaintext and iv should be vectors of unsigned bytes)
    (cs/encrypt (->AESCBCPKCS7) plaintext iv initmap)
    

    Decrypt

    ;; Initialize the cipher (key should be a vector of unsigned bytes).
    (def initmap (cipher/initialize (->AES) {:key key}))
    ;; Decrypt (ciphertext and iv should be vectors of unsigned bytes)
    (cs/decrypt (->AESCBCPKCS7) ciphertext iv initmap)
    

    Stream Ciphers

    (:require (org.azjure.cipher [cipher :as cipher]
                                 [streamcipher :as sc]
                                 [salsa20 :refer (->Salsa20]))
    

    Encrypt

    ;; Initialize the record to use
    (def s20 (->Salsa20))
    ;; Initialize the cipher.  Note the map argument usually takes a map of the
    ;; format {:key key :iv iv}.  In Salsa20's case it is {:key key :nonce nonce}.
    ;; This will evaluate to a map to use during keystream generation
    (def initmap (cipher/initialize s20 {:key key :nonce nonce}))
    ;; Generate keystream and encrypt
    (mapv bit-xor plaintext (sc/generate-keystream s20 initmap [0 (count plaintext)]))
    

    Decrypt

    ;; Initialize the record to use
    (def s20 (->Salsa20))
    ;; Initialize the cipher.  Note the map argument usually takes a map of the
    ;; format {:key key :iv iv}.  In Salsa20's case it is {:key key :nonce nonce}.
    ;; This will evaluate to a map to use during keystream generation
    (def initmap (cipher/initialize s20 {:key key :nonce nonce}))
    ;; Generate keystream and encrypt
    (mapv bit-xor ciphertext (sc/generate-keystream s20 initmap [0 (count ciphertext)]))
    

    See the test directory for examples

    Supported Ciphers

    Block

    1. Advanced Encryption Standard (AES) - FIPS 197
    2. Blowfish (BF) - Blowfish Spec
    3. CAST-128 (CAST5) - CAST-128 RFC
    4. CAST-256 (CAST6) - CAST-256 RFC
    5. Twofish (TF) - Twofish Spec
    6. TEA (TEA) - TEA Spec
    7. XTEA (XTEA) - XTEA Spec

    Stream

    1. Salsa20 (Salsa20) - Salsa20 Spec
    2. ChaCha (Chacha) - ChaCha Spec
    3. HC-128 (HC128) - HC-128 Spec
    4. HC-256 (HC256) - HC-256 Spec
    5. MICKEY2.0 (MICKEY2.0) - MICKEY2.0 Spec
    6. Rabbit (Rabbit) - Rabbit Spec
    7. Trivium (Trivium) - Trivium Spec

    Supported Modes

    Cipher modes describe the method for encrypting multiple blocks with block ciphers.

    See Mode of Operation for descriptions

    Block Modes

    1. Electronic Codebook (ECB)
    2. Cipher-Block Chaining (CBC)
    3. Propagating Cipher-Block Chaining (PCBC)

    Stream Modes with Block Ciphers

    1. Cipher Feedback (CFB)
    2. Output Feedback (OFB)
    3. Counter (CTR)

    Supported Padding

    Some cipher modes (ECB, CBC, PCBC) require that the input be padded with bytes until a multiple of the cipher’s blocksize. The following padding methods are supported.

    See Padding for descriptions

    1. PKCS7
    2. Zero Byte
    3. ISO 10126
    4. ANSI X.923
    5. ISO/IEC 7816-4