You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Palol Carlos <ca...@gmail.com> on 2009/02/09 20:02:19 UTC

Digestion problems, can't MD5 (Cocoon 2.1)

Hi list,

i'm having problems to generate a simple MD5.
if I serve an XSP with just this line in <xsp:logic>

java.security.MessageDigest md =  
java.security.MessageDigest.getInstance("MD5");

I get a "NoSuchAlgorithmException".

The first option in my java.security (1.5) is  
sun.security.provider.Sun and this I can instantiate without any  
problem. If I try:

java.security.Provider p = new sun.security.provider.Sun();
java.util.Set servicios = p.getServices();
Object[] serviciosarray = servicios.toArray();
java.security.Provider.Service md5service =  
(java.security.Provider.Service) serviciosarray[6];
...
<xsp:expr>md5service.toString()</xsp:expr>

Shows:
SUN: MessageDigest.MD5 -> sun.security.provider.MD5 attributes:  
{ImplementedIn=Software}

Is it related to Cocoon? (sorry if it isn't)

Thanks in advance for any help,

--
Carlos Palol







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Digestion problems, can't MD5 (Cocoon 2.1)

Posted by Thomas Markus <t....@proventis.net>.
hi,

first try to iterate over all available provider. fi:
for (java.security.Provider p : java.security.Security.getProviders()) {
    ArrayList<String> a = new ArrayList<String>();
    for (java.security.Provider.Service s : p.getServices())
        if ("MessageDigest".equals(s.getType()))
            a.add(s.getAlgorithm());
    System.out.println(p.getName() + "  " + a);
}

it gives for sun jdk1.6:
SUN  [MD2, MD5, SHA, SHA-256, SHA-384, SHA-512]
SunRsaSign  []
SunJSSE  []
SunJCE  []
SunJGSS  []
SunSASL  []
XMLDSig  []
SunPCSC  []

check your java.security setup

regards
thomas



Palol Carlos schrieb:
> Hi list,
>
> i'm having problems to generate a simple MD5.
> if I serve an XSP with just this line in <xsp:logic>
>
> java.security.MessageDigest md = 
> java.security.MessageDigest.getInstance("MD5");
i do it that way and it works fine (sun java5+6)
>
> I get a "NoSuchAlgorithmException".
>
> The first option in my java.security (1.5) is 
> sun.security.provider.Sun and this I can instantiate without any 
> problem. If I try:
>
> java.security.Provider p = new sun.security.provider.Sun();
> java.util.Set servicios = p.getServices();
> Object[] serviciosarray = servicios.toArray();
> java.security.Provider.Service md5service = 
> (java.security.Provider.Service) serviciosarray[6];
> ...
> <xsp:expr>md5service.toString()</xsp:expr>
>
> Shows:
> SUN: MessageDigest.MD5 -> sun.security.provider.MD5 attributes: 
> {ImplementedIn=Software}
>
> Is it related to Cocoon? (sorry if it isn't)
i think it itsn't
>
> Thanks in advance for any help,
>
> -- 
> Carlos Palol


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org