This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Could not start up the CDSA libraries

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I am using HmacSHA1 for Calculating RFC2104 compliant - base 64 encoded certificate for a given string and shared secret.
While starting the application sometimes I receive the error pasted below:

Caused by: java.lang.InternalError: Could not start up the CDSA libraries.
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1723)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at com.apple.crypto.provider.HmacCore.<clinit>(HmacCore.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at java.security.Provider$Service.newInstance(Provider.java:1130)
at javax.crypto.Mac.a(DashoA12275)
at javax.crypto.Mac.init(DashoA12275)

OS: Mac OS X Server 10.5.6

Java Details : Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Server VM (build 1.5.0_13-119, mixed mode)

Any clues would be helpful.

Thanks,
Arvinder
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
If you care to post some code, I could give it a try - just the part that is supposed to start up the library in question.
Best wishes!
 
arvinder khosla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Imports:
=======
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

Code snippet
========
try {
SecretKeySpec signingKey = new SecretKeySpec(iSharedSecret.getBytes(), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(signingKey);
byte[] rawHmac = mac.doFinal(iValue.getBytes());
byte[] aReturnBytes = org.apache.commons.codec.binary.Base64.encodeBase64(rawHmac);
iReturnValue = new String(aReturnBytes, "utf-8") ;
} catch (Exception anException) {
_logger.error("Exception Occured while generating HMAC" , anException);
throw new Exception("Failed to generate HMAC : " + anException.getMessage());
}
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Things work fine here with the following JVM:
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-206)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-82, mixed mode)
Os: OS X 10.5.8

Have you tried to use a more recent JVM?
Best wishes!
 
arvinder khosla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. For me too it works 2 out of 3 the times. Could it be jar clash. (because both com.sun.crypto.provider.*; & com.apple.crypto.provider.* provide implementations of HmacSHA1)
I was not adding the any of the imports earlier (i.e. neither of com.apple.crypto.provider.*; or com.apple.crypto.provider.*) .
Haven't seen the issue since this change.
Will check for a day or 2 and update this forum on whethr it's fixed or not.

 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic