Liking cljdoc? Tell your friends :D

hara.security.openpgp


+bc-calc+clj


crc-24clj

(crc-24 input)

returns the crc24 checksum

(crc-24 (byte-array [100 100 100 100 100 100])) => ["=6Fko" [-24 89 40] 15227176]

returns the crc24 checksum 

(crc-24 (byte-array [100 100 100 100 100 100]))
=> ["=6Fko" [-24 89 40] 15227176]
raw docstring

decryptclj

(decrypt encrypted {:keys [private]})

decrypts the encrypted information

(-> (.getBytes "Hello World") (encrypt {:public +public-key+}) (decrypt {:private +private-key+}) (String.)) => "Hello World"

decrypts the encrypted information

(-> (.getBytes "Hello World")
    (encrypt {:public  +public-key+})
    (decrypt {:private +private-key+})
    (String.))
=> "Hello World"
raw docstring

encryptclj

(encrypt clear {:keys [public]})

encrypts bytes given a public key

(->> (encrypt (.getBytes "Hello World") {:public +public-key+})

 (encode/to-base64))
encrypts bytes given a public key

(->> (encrypt (.getBytes "Hello World")
              {:public +public-key+})
    
     (encode/to-base64))
raw docstring

fingerprintclj

(fingerprint pub)

returns the fingerprint of a public key

(fingerprint +public-key+) => "E710D59C5346D3C0A1C578AE6753F8E16D35FC24"

returns the fingerprint of a public key

(fingerprint +public-key+)
=> "E710D59C5346D3C0A1C578AE6753F8E16D35FC24"
raw docstring

generate-signatureclj

(generate-signature bytes {:keys [public private]})

generates a signature given bytes and a keyring

(generate-signature (.getBytes "Hello World") {:public +public-key+ :private +private-key+}) ;; #gpg.signature ["iQEcBAABCAAGBQJbw1U8AAoJEGdT+OFtNf... "] => org.bouncycastle.openpgp.PGPSignature

generates a signature given bytes and a keyring

(generate-signature (.getBytes "Hello World")
                    {:public  +public-key+
                     :private +private-key+})
;; #gpg.signature ["iQEcBAABCAAGBQJbw1U8AAoJEGdT+OFtNf... "]
=> org.bouncycastle.openpgp.PGPSignature
raw docstring

key-pairclj

(key-pair secret-key)

returns a public and private key pair from a secret key

(key-pair +secret-key+) ;;[#public "E710D59C5346D3C0A1C578AE6753F8E16D35FC24" #private "7445568256057146404"] => (contains [org.bouncycastle.openpgp.PGPPublicKey org.bouncycastle.openpgp.PGPPrivateKey])

returns a public and private key pair from a secret key

(key-pair +secret-key+)
;;[#public "E710D59C5346D3C0A1C578AE6753F8E16D35FC24" #private "7445568256057146404"]
=> (contains [org.bouncycastle.openpgp.PGPPublicKey
              org.bouncycastle.openpgp.PGPPrivateKey])
raw docstring

parse-public-keyclj

(parse-public-key input)
(parse-public-key input id)

parses a public key from string

(-> (string/joinl +public-key-string+ "\n") (parse-public-key)) ;; #public "E710D59C5346D3C0A1C578AE6753F8E16D35FC24" => org.bouncycastle.openpgp.PGPPublicKey

parses a public key from string

(-> (string/joinl +public-key-string+ "\n")
    (parse-public-key))
;; #public "E710D59C5346D3C0A1C578AE6753F8E16D35FC24"
=> org.bouncycastle.openpgp.PGPPublicKey
raw docstring

parse-public-key-ringclj

(parse-public-key-ring input)

parses a public key ring from string

(-> (string/joinl +public-key-string+ "\n") (parse-public-key-ring)) => org.bouncycastle.openpgp.PGPPublicKeyRing

parses a public key ring from string

(-> (string/joinl +public-key-string+ "\n")
    (parse-public-key-ring))
=> org.bouncycastle.openpgp.PGPPublicKeyRing
raw docstring

parse-secret-keyclj

(parse-secret-key input)
(parse-secret-key input id)

parses a secret key from string

(-> (string/joinl +secret-key-string+ "\n") (parse-secret-key)) ;; #secret "E710D59C5346D3C0A1C578AE6753F8E16D35FC24" => org.bouncycastle.openpgp.PGPSecretKey

parses a secret key from string

(-> (string/joinl +secret-key-string+ "\n")
    (parse-secret-key))
;; #secret "E710D59C5346D3C0A1C578AE6753F8E16D35FC24"
=> org.bouncycastle.openpgp.PGPSecretKey
raw docstring

parse-secret-key-ringclj

(parse-secret-key-ring input)

parses a secret key ring from string

(-> (string/joinl +secret-key-string+ "\n") (parse-secret-key-ring)) => org.bouncycastle.openpgp.PGPSecretKeyRing

parses a secret key ring from string

(-> (string/joinl +secret-key-string+ "\n")
    (parse-secret-key-ring))
=> org.bouncycastle.openpgp.PGPSecretKeyRing
raw docstring

pgp-signatureclj

(pgp-signature bytes)

returns a gpg signature from encoded bytes

(-> (generate-signature (.getBytes "Hello World") {:public +public-key+ :private +private-key+}) (.getEncoded) (pgp-signature)) => org.bouncycastle.openpgp.PGPSignature

returns a gpg signature from encoded bytes

(-> (generate-signature (.getBytes "Hello World")
                        {:public  +public-key+
                         :private +private-key+})
    (.getEncoded)
    (pgp-signature))
=> org.bouncycastle.openpgp.PGPSignature
raw docstring

read-sig-fileclj

(read-sig-file sig-file)

reads bytes from a GPG compatible file

(read-sig-file "dev/scratch/project.clj.asc") => bytes?

reads bytes from a GPG compatible file

(read-sig-file "dev/scratch/project.clj.asc")
=> bytes?
raw docstring

signclj

(sign input sig-file {:keys [public private] :as opts})

generates a output gpg signature for an input file

(sign "project.clj" "dev/scratch/project.clj.asc" {:public +public-key+ :private +private-key+}) => bytes?

generates a output gpg signature for an input file

(sign "project.clj"
      "dev/scratch/project.clj.asc"
      {:public  +public-key+
       :private +private-key+})
=> bytes?
raw docstring

verifyclj

(verify input sig-file {:keys [public]})

verifies that the signature works

(verify "project.clj" "dev/scratch/project.clj.asc" {:public +public-key+}) => true

verifies that the signature works

(verify "project.clj"
        "dev/scratch/project.clj.asc"
        {:public  +public-key+})
=> true
raw docstring

write-sig-fileclj

(write-sig-file sig-file bytes)

writes bytes to a GPG compatible file

(let [signature (-> (generate-signature (.getBytes "Hello World") {:public +public-key+ :private +private-key+}) (.getEncoded))] (write-sig-file "dev/scratch/project.clj.asc" signature))

writes bytes to a GPG compatible file

(let [signature (-> (generate-signature (.getBytes "Hello World")
                                        {:public  +public-key+
                                         :private +private-key+})
                    (.getEncoded))]
 (write-sig-file "dev/scratch/project.clj.asc"
                  signature))
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close