Frank pointed out this mistake in my code a little farther in the thread.
Sorry for the confusion.

digest (.digest
               (doto (java.security.MessageDigest/getInstance "sha1")
                     .reset
                     (.update nonce-as-bytes)
                     (.update created-as-bytes)
                     (.update secret-as-bytes)))


On Mon, Mar 4, 2013 at 3:07 PM, larry google groups <
lawrencecloj...@gmail.com> wrote:

>
>
> I have a feeling you may be correct, so I copy and pasted your code
> into mine:
>
>               (let [username (get-in @um/interactions [:omniture-api-
> credentials :username])
>                     secret (get-in @um/interactions [:omniture-api-
> credentials :shared-secret])
>                     random-number (math/round (* (rand 1 ) 1000000))
>                     nonce (DigestUtils/md5Hex (str random-number))
>                     nonce-encoded-base64 (base64-encode (.getBytes
> nonce))
>                     date-formatter (new SimpleDateFormat "yyyy-MM-
> dd'T'HH:mm:ss")
>                     created (.format date-formatter (new Date))
>                     nonce-as-bytes (.getBytes nonce)
>                     created-as-bytes (.getBytes created)
>                     secret-as-bytes (.getBytes secret)
>                     digest (-> (java.security.MessageDigest/
> getInstance "sha1")
>                                .reset
>                                (.update nonce-as-bytes)
>                                (.update created-as-bytes)
>                                (.update secret-as-bytes)
>                                .digest)
>                     header (apply str " UsernameToken Username=\""
> username  "\" PasswordDigest=\"" digest "\" Nonce=\"" nonce-encoded-
> base64 "\" Created=\"" created "\"")]
>                 header)
>
>
>
> but now I get a null pointer exception here:
>
>                     digest (-> (java.security.MessageDigest/
> getInstance "sha1")
>                                .reset
>                                (.update nonce-as-bytes)
>                                (.update created-as-bytes)
>                                (.update secret-as-bytes)
>                                .digest)
>
>
>
>
>
> On Mar 4, 2:02 pm, Aaron Cohen <aa...@assonance.org> wrote:
> > I think you should try to avoid the string concatenation games. I'm not
> > sure what your current code is, but I suspect you're still ending up with
> > array toString's slipping in.
> >
> > How about the following?
> >
> > On Mon, Mar 4, 2013 at 1:31 PM, larry google groups <
> >
> > lawrencecloj...@gmail.com> wrote:
> > > So, right now I am using this code:
> >
> > >  (let [username (get-in @um/interactions [:omniture-api-
> > > credentials :username])
> > >   secret (get-in @um/interactions [:omniture-api-credentials :shared-
> > > secret])
> > >   nonce (DigestUtils/md5Hex (str (math/round (* (rand 1 ) 1000000))))
> > >   nonce-encoded-base64 (Base64/encodeBase64 (.getBytes nonce))
> > >   date-formatter (new SimpleDateFormat "yyyy-MM-dd'T'HH:mm:ss")
> > >   formatter gmt-timezone)
> > >   created (.format date-formatter (new Date))
> >
> >    nonce-bytes (.getBytes nonce)
> >    created-bytes (.getBytes created)
> >    secret-bytes (.getBytes secret)
> >    digest (-> (java.security.MessageDigest/getInstance "sha1")
> >                     .reset
> >                     (.update nonce-bytes)
> >                     (.update create-bytes)
> >                     (.update secret-bytes)
> >                     .digest)
> >     digest-base64 (Base64/encodeBase64 digest)
> >
> > ;; Should "UsernameToken Username" really be unquoted in the following
> line?
> > ;; All the other variable names are quoted
> >     header (apply str " UsernameToken Username=\""  username
> >
> > ;; You may want digest-base64 here?
> >                               "\"PasswordDigest=\"" digest
> >
> >                               "\" Nonce=\"" nonce-encoded-base64
> >                               "\"Created=\"" created "\"")]
> >              header)
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to