Problems using NSS library as PKCS#11 provider with JAVA 6

Hi,
I�m trying to configure JAVA 6 on Solaris 10 SPARC to use Mozilla NSS library as PKCS#11 provider (to achieve FIPS-140 certification for my application). I�m following the guidelines from http://java.sun.com/javase/6/docs/technotes/guides/security/p11guide.html#NSS but unfortunately something doesn�t work for me as expected...
Let me describe the exact steps that I followed (because devil may be in the small details :-)
I downloaded NSS 3.11.4 and NSPR 4.6.4 binaries from mozilla.org (32 bit �debug� versions for Solaris 9, because these were the only �binary� versions for SPARC available on Mozilla site and as far as I understand these are the exact versions that passed FIPS-140 certification), unpacked them under the /opt directory and copied both of them into a single /opt/nss tree as follows:
mkdir /opt/nss
cp �r /opt/nss-3.11.4/* /opt/nss
cp �r /opt/nspr-4.6.4/* /opt/nss
I created a PKCS#11 configuration file /opt/nss/pkcs11.cfg as per JAVA 6 security guide:
name = NSScrypto
nssLibraryDirectory = /opt/nss/lib
nssDbMode = noDb
attributes = compatibility
(I know that this configuration is not for FIPS mode � but I thought that I�d better start with a simple NSS configuration)
Then I modified /usr/jdk/jdk1.6.0_03/jre/lib/security/java.security file and replaced 1st provider with:
security.provider.1=sun.security.pkcs11.SunPKCS11 /opt/nss/pkcs11.cfg
Now everything should be in place � so I created a small JAVA program and ran it:
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.SecretKey;
import javax.crypto.Cipher;
import java.security.*;
public class Test
public static void main(String[] args)
try
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
DESedeKeySpec keySpec = null;
keySpec = new DESedeKeySpec(new String("laKuf1Tcc6sOhsdPf49=m4es").getBytes());
System.out.println("keyFactory provider: " + keyFactory.getProvider().getName());
SecretKey key = keyFactory.generateSecret(keySpec);
Cipher decryptCipher = Cipher.getInstance("DESede");
decryptCipher.init(Cipher.DECRYPT_MODE, key);
System.out.println("decryptCipher provider: " + decryptCipher.getProvider().getName());
catch (Exception ex)
ex.printStackTrace();
Unfortunately it produced the following output:
EMS-Server42# java test
keyFactory provider: SunPKCS11-NSScrypto
decryptCipher provider: SunJCE
And when I comment out SunJCE provider in java.security file I get the following exception:
java.security.NoSuchAlgorithmException: Cannot find any provider supporting DESede
at javax.crypto.Cipher.getInstance(DashoA13*..)
at test.main(test.java:38)
So it looks like something is wrong with my NSS configuration. Because AFAIK DESede (3DES) is supported by the NSS library, but for some reason JAVA doesn�t see this algorithm implemented in NSS PKCS#11 provider.
Any suggestions on what am I doing wrong?
Best regards,
Alex

Works for me:
import java.security.Provider;
import java.security.SecureRandom;
import java.security.Security;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
public class Test
  public static void main(String[] args)
    try
      String configFileName = "/nss/nss.cfg";
      Provider nss = new sun.security.pkcs11.SunPKCS11(configFileName);
      Security.addProvider(nss);
      SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede", nss);
      DESedeKeySpec keySpec = new DESedeKeySpec(new String("laKuf1Tcc6sOhsdPf49=m4es").getBytes("UTF-8"));
      System.out.println("keyFactory provider: " + keyFactory.getProvider().getName());
      SecretKey key = keyFactory.generateSecret(keySpec);
      //iv for CBC mode - note, in practice you don't generate a random iv for decryption :)
      byte[] iv = new byte[8];  //64-bit block size for 3DES
      SecureRandom sr = SecureRandom.getInstance("PKCS11", nss);
      sr.nextBytes(iv);
      IvParameterSpec params = new IvParameterSpec(iv);
      Cipher decryptCipher = Cipher.getInstance("DESede/CBC/NoPadding", nss);
      decryptCipher.init(Cipher.DECRYPT_MODE, key, params);
      System.out.println("decryptCipher provider: " + decryptCipher.getProvider().getName());
    catch (Exception ex)
      ex.printStackTrace();
}Oh, I wouldn't expect your key loading to work when you switch over to FIPS mode.
cfg file:
name = NSScrypto
nssLibraryDirectory = /nss
nssSecmodDirectory = /nss
nssModule = fipsYields the following error:
java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: Could not create key
because you can't directly handle keying material in FIPS. You'll have to save the secret key in the NSS certDB or generate a random one each time and send it wrapped to the other side.

Similar Messages

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Problems using Anyconnect 3.x client together with Kaspersky AntiVirus

    We have Notebooks with Windows Vista - most of the notebooks have "Kaspersky Anti-Virus 6.0 für Windows Workstation" installed and some "Kaspersky Endpoint Security 8 für Windows".
    Anyconnect 2.5 works perfect on these notebooks.
    But when I upgrade anyconnect to version 3.0 or 3.1, I have the problem that all HTTP traffic is blocked - all other network traffic is still working.
    When I quit the Kaspersky client (or uninstall it), everything is working again - except that I have no working antivirus protection.
    Of course, I have tried different settings for the Kaspersky client (without success) and asked our Kaspersky support (who said that anyconnect is causing this problem and not Kaspersky).
    My first experience with a Windows 7 notebook is that this problem does not exist using Windows 7.
    So maybe the problem is caused by a strange combination of Windows Vista, Anyconnect 3.x and Kaspersky.
    Does anyone else has problems using Anyconnect 3.x client together with Kaspersky AntiVirus?
    Kind regards,
    Peter

    We've recently run into an issue related to this. We found that it was related somehow to Firefox. If one looks inside of
    /Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app/Contents/MacOS/ there are symlinks to Firefox libraries:
    $ ls -lntotal 1800-rwxrwxr-x  1 0     80  891232 Aug  3  2012 Cisco AnyConnect Secure Mobility Clientlrwxr-xr-x  1 1001  80      60 Jun 13 15:57 libmozsqlite3.dylib -> /Applications/Firefox.app/Contents/MacOS/libmozsqlite3.dyliblrwxr-xr-x  1 1001  80      55 Jun 13 15:57 libnspr4.dylib -> /Applications/Firefox.app/Contents/MacOS/libnspr4.dyliblrwxr-xr-x  1 1001  80      54 Jun 13 15:57 libnss3.dylib -> /Applications/Firefox.app/Contents/MacOS/libnss3.dyliblrwxr-xr-x  1 1001  80      58 Jun 13 15:57 libnssutil3.dylib -> /Applications/Firefox.app/Contents/MacOS/libnssutil3.dyliblrwxr-xr-x  1 1001  80      54 Jun 13 15:57 libplc4.dylib -> /Applications/Firefox.app/Contents/MacOS/libplc4.dyliblrwxr-xr-x  1 1001  80      55 Jun 13 15:57 libplds4.dylib -> /Applications/Firefox.app/Contents/MacOS/libplds4.dyliblrwxr-xr-x  1 1001  80      58 Jun 13 15:57 libsoftokn3.dylib -> /Applications/Firefox.app/Contents/MacOS/libsoftokn3.dylib
    So as a simple confirmation we were able to remove Firefox and have AnyConnect connect fine. As a more permanent workaround we replaced the above symlinks with 0 byte files and we were able to have our cake (AnyConnect connecting) and eat it too (Firefox installed as well).

  • Problem using a library with an EAR file (ServletNotFoundException)

    Hello
    I'm trying to use a library (J2EE library project) an associated it to an Enterprise Application Project.
    The application was built using the Spring MVC framework.
    When I did deploy I got the following warning:
    Apr 25, 2006 9:44:17 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] INFO:
    [004]Finished Deployment
    And when I try to run the application  I got the following error:
    404 Not Found
    The request cannot be processed.
    Details:   com.sap.engine.services.servlets_jsp.server.exceptions.ServletNotFoundException: Cannot load the requested servlet [data-entryLib/servlet/data-entry].  The ID of this error is
    Exception id: [00306E5DA8D2004E00000068000052550004124234F31271].
    The application run properly when I use the jars file in the WEB-INF/lib folder.
    I have been reading some recomendations in this forum, but nobody tell me how to solve this problem
    Thanks
    Adriana.

    Hi Rajesh
    Thanks for your answer.
    Yes, I deployed the .sda file, add the jars file in the archive server/provider.xml and I checked this: (Problem with EAR referencing a library DC)
    The type of reference that I gave in the EAR file was in the archive application-j2EE-engine.xml:
    <reference
        reference-type="hard">
        <reference-target
          provider-name="sap.com"
        target-type="library">LibreriaDataEntry</reference-target>
    </reference>
    <provider-name>sap.com</provider-name>
       <fail-over-enable
       mode="disable"/>
    Thanks
    Adriana

  • How to use SQl server 2005's SQLXMLBulkLoad with JAVA

    Hi All,
    I am in a big problem identifying how to use xml bulk insert functionality of sql server 2005 with java.
    I need to enter millions of data into the sql server 2005 database.
    All the material i saw on net includes vb script or asp.net sripts to do so.
    Somebody please tell how I can do this with JAVA.
    Thanks.

    In this forum we commonly discuss connections from Oracle to foreign databases. When you want to connect with your SQL Server to Oracle it would be better to ask that in a Microsoft forum as they support their LINKED SERVER mechanism.
    The linked server set up is for example described in the Microsoft knowledge base as:
    280106 - HOW TO: Set Up and Troubleshoot a Linked Server to Oracle in SQL Server
    In newer SQl Server releases the name changed see for example:
    How to run a SQL Server 2005 Integration Services package as a SQL Server Agent job step
    View products that this article applies to.
    Article ID : 912911
    As you can see they are commonly using OLEDB driver. So you might have to install Oracle's OLEDB driver as well. Else you might think about using OLEDB to ODBC bridge

  • Problem using Win 8.1 Mail app with corporate email account

    I have a client where most of the PCs are running Windows 8.1 with Office 2013 installed and an on-premise Exchange 2013 server.
    Even though they've been using Office 2013, now that they have Win 8.1 the staff now like to use the included Mail app for all their email as they say they get better notifications with it and some other "goodies" that Office 2013 doesn't provide.
    It's been working okay for them as I haven't heard of any problems. Until now. Their domain passwords are expiring and when they change the domain password they have no problem with the PC itself and domain access and Outlook 2013 still works fine.
    But now they're getting errors trying to continue to connect the Mail app to Exchange 2013. They keep getting a popup asking for credentials, their domain accounts get locked out (imagine that) after too many wrong logins I presume by the Windows 8.1 apps,
    and when they do get the Mail app connected they see an error in the lower right corner of the window about a problem with the certificate. It says something about the name of I think the server not matching the certificate.
    The cert is from GoDaddy and I know the names involved with the cert are correct. But that's the minor issue.
    The main issue is with getting the 8.1 apps, particularly the Mail app, to recognize the updated domain password.
    I have a Windows 8.1 VM setup and on the domain but when I try to configure it to connect to the Exchange server I get the error "Unable to connect. Ensure the information you've entered is correct."
    It's pretty obvious what is supposed to go in each field so I'm sure I'm filling it out correctly. But because of this I can't use this test VM to work on the problem.
    If anyone has an idea of how to deal with the Windows 8.1 Mail app and Exchange and changing the user domain password, I'd be appreciative of the help.
    Jonathan

    Hi,
    Thanks for your feedback.
    With 8.1, you can now use the Mail app without having to have a Microsoft account.
    A Microsoft account is an email address and password that you use to sign in to Windows. It's free and easy to set up, and you can do so with any email address you choose, or get a new email address. (For example, you can use an Outlook.com, Gmail, or Yahoo!
    address for your Microsoft account.)
    However, you must sign with an email address.
    Any way, if you have any other problem, welcome to contact us.
    Karen Hu
    TechNet Community Support
    That is one way you can sign into Windows but not required. As I stated earlier, these PCs are domain joined and that's how they login to them. As for the Mail app, 8.1 means an MS account isn't required anymore.
    Jonathan

  • Problem using nss Tool

    Dear All
    I am using a nss Security Tool to view my cert stored in mozilla firefox cert store on windows XP. when i tried to run certutil command it gives me error "This application has failed to start because libplc4.dll was not found. Re-install the application may fix this problem". i downloaded nspr-4.1.1.zip. after unziping i tried to register the libplc4.dll with regsvr32.exe command. it gave me error "DllRegisterServer entry point was not found". i know this problem occurs if dll is corrupt. i again downloaded and tried but the same result. i also tried it by copied all the dll's in the nspr-4.1.1.zip in bin dir of nss tool, because .net dll can work without manually registering it. the same error comes again. i searched my program files for any other libplc4.dll. i found one in my eToken dirver directory.Though seems illogical but i also tried to uninstall the driver and install it again. same error occured.
    can anyone help me.

    Hi,
    When u r saving the workspace give the file extension and try.If u save without giving extension it give this error.
    Amudha

  • Has anyone had a problem using Mainstage 2 and Logic 9 with PreSonus fire studio Mobile?

    I Still can't get Mainstage and Logic to play well with my setup. I'm using a Mac Pro 2 GHz Intel Core i7 with 4 GB ram and Logic 9.1.6 and Mainstage2. I have a PreSonus Firestudio Mobile and M-Audio Midisport midi interfaces. The only Midisport that works consistently is a MisiSport 2X2 sith a thru/merge switch set to merge. I am playing all of this with a Roland A-90 keyboard. Logic sometimes starts, but the audio interface doesn't work. Mainstage crashes on start-up. Can anyone help?
    Thanks,
    Bob

    Hi
    There have been several reported issues on this forum about problems a) with Roland controllers (Sending MIDI Clock and 'All Notes Off' ???), and b) MIDSport interfaces
    https://discussions.apple.com/message/17138809#17138809
    https://discussions.apple.com/message/17011191#17011191
    I suggest that you try a 'scientific' process of elimination:
    Disconnect all external hardware, and try MS
    Connect the hardware singly, one at a time, to determine which is causing the problem
    CCT

  • Problem use SQL query in coding report with SBO

    Hi everyone!
    I have problem in execute query to delete and create a report with SQL 2000 in SAP.
    Try
            oForm.DataSources.DataTables.Item(0).ExecuteQuery("DELETE FROM rptReport")
    Catch ex As Exception
    End Try
             oForm.DataSources.DataTables.Add("TestReport")
             oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT     Number, RefDate, Memo        into  rptReport   FROM         dbo.OJDT")
             oTable = oForm.DataSources.DataTables.Item("TestReport")
    This code is error. I don't know how to execute 2 this sql command. Hope everyone help me hix hix!  .

    /Invalid query tree  [300-33]. The SQL error is 8180/
    But search in SQL book hasn't got that err. Some person spoke ExecuteQuery property wasn't support Table Delete and Create, it only support simple Select... I tried to use Recordset but don't success. Can I use "Delete" and "Select ... Into..."   query another style??? Help me, please...!!!

  • Problem using External Library DC

    Hello,
    First of all, I'm a java programmer kind of new to NWDI. I'm working on a Java DC that's meant to send e-mails which of course uses the JavaMail API, so I understand I have to add to my SC another DC of type External Library that contains the jar files I need. Here is where it all falls apart. I have followed step by step several possible solutions to this and still gettin' the "import cannot be resolved" error message in my Java Perspective. The procedure I'm using is the one described in this thread:
    Re: External Library DC question
    Can anyone help me out with this? I'm using NWDS 7.0.14
    Thanks in advance...

    HI,
    That post was to big. so without reading it im posting.
    1 create a library DC.
    2.Add the jar files in it.
    3. create a public part of type API and SDA.(use SDA if you want to deploy it with the project(just like an add external jar file) or use API part (if you want to use it as add jar file option))
    4. use that public part in you DC.
    5. use add jar option in your build path.
    if you have done these an having an error please tell me at what step you have a problem

  • Problems using SONY 810UL/T dvd writer with ibook

    Hi All,
    I'm having trouble using the above drive with my dual USB on 10.3.9 and was wondering if anyone else may have a solution to this. The os doesn't seem to recognize memorex16X DVD+R discs (i'm not sure if this is a disc issue or a drive issue but..see later) i.e. it doesn't show up on the desktop (I've tried this with multiple discs). Then when I try to open the tray using the button on the burner, nothing happens. So I do a disktool -e disk2 to eject the disk. I insert the disk again but holding down optioncmdI while inserting the disc ala article 30878 (http://docs.info.apple.com/article.html?artnum=30878). A window pops up: You inserted a blank DVD. Choose what to do from the pop-up menu. I press ok, the disk ejects and I get message: This disc could not be used because the disc drive is not supported. (Error code 0x80020025). Any help would be greatly appreciated. Cheers.
    iBook G3 500   Mac OS X (10.3.9)  

    Hi Tah.
    Two suggestions:
    1) Avoid Memorex discs if possible. I dn't know how they go in the Sony burners, but users of Panasonic (Matshita) and Pioneer drives I know have had problems with them.
    2) See if Patchburn helps - see http://www.patchburn.de/download.html
    Patchburn gets many third party burners running which are otherwise not supported by Apple. In your case you will need the Panther version , of course.
    Cheers
    Rod

  • Problem using SELECT-OPTIONS in an InfoSet with a field of data type UNIT.

    I have created a simple InfoSet that links MARA with MARM. In the 'Selections' section of the InfoSet I have a variable named 'ZMEINH' defined as
    Description: UOM
    Selection Text: UOM
    Format FOR: MARM-MEINH
               EXTRAS: DEFAULT 'PAC' OPTION EQ SIGN I.
    When I ran a query to allow selections on the MEINH field, instead of 'PAC' being the default, there was "***" showing in the UOM selection and if I attempted to execute the query it gave me a message that "Unit *** is not created in languague EN'.  If I overide the "***" and enter 'PAC', I get the list of records that I expect.
    I assume this is because MEINH has a data type of "UNIT".
    How can I do a conversion so I can define a default value 'PAC' for MARM-MEINH in the infoSet that will carry through to any queries I created.
    Thank you very much for any help.
    Richard Salisbury

    Thank you both for you help!
    In our T006 there actually is a PAC and not a PAK. The T006A had as DE-PAK though.
    I had this same type of language problem when trying to match an "order type". German is the "base" language in our system so maybe that means that raw data is stored with the German constant?
    Anyway, I changed it to PAK and it works. When under a time schedule, that is what counts.
    Thank you again for the quick response!
    Richard Salisbury

  • Any known problems using IE6 and Adobe Reader 7 with LC:RM?

    On an properly configured LC:RM server only allowing certificate (X509) authentication,
    Adobe Reader 7 always pops up some Username/Password dialog for authentication.
    Reader 8 and 9 work fine with certificates.
    Is this an known restriction, that
    Reader-7 does not support X509 authentication?
    Dilettanto

    Steve,
    thank you again for your helpful answer.
    In addition we now found out, that Users having an authenticating Proxy
    may even need to upgrade to Adobe Reader 9 to be able to use LC:RM.
    Dilettanto

  • Is there a problem using CFPOP in CF MX 7 with Exchange 2007?

    We have a scheduled task that checks a mailbox and, depending
    on the request, responds to the sender with information from our
    contact database. It has worked fine for several years using CF MX
    7 Standard and MS Exchange 2000. We just changed to MS Exchange
    2007 and we get an error as follows: "Logon failure: unknown user
    name or bad password." We can access the mailbox directly from
    Exchange using the account and password, so we think we are passing
    the correct information (example below).
    <CFPOP ACTION="GetHeaderOnly" SERVER="192.168.1.15"
    USERNAME="testaccount" PASSWORD="testpassword" NAME="getMail">
    Is there something we're missing? We are certain that the IP,
    account and password are still correct. We have assigned this mail
    server to the Mail tab in CF Administrator and it can see it and
    route CFMAILs through it.
    Any help is appreciated.

    We discovered that Exchange 2007 has five specific steps that
    have to occur in a particular order for CFPOP to resume working
    properly. We did this (despite several security issues) because
    this function is strictly internal. Not recommended for an
    application available to the general public.
    Steps for making Exchange 2007 work for CFPOP:
    1) Start the POP service on the Exchange 2007 server.
    2) Allow the necessary email accounts to use POP3.
    3) Lower the security requirements on those accounts to allow
    CF to send clear text instead of encrypted (SSL) requests to POP3.
    4) Set the Exchange server to allow relay.
    5) Lower the security requirements for relay.
    I hope I explained this correctly. This is how my network
    supervisor explained it to me.

  • Problem using JRC 2.0 on Unix with xml data source

    Hello,
    I am experimenting difficulties using the JRC 2.0 (which I hadn't with the previous version) on a RedHat 4 machine. It takes 7 minutes (only 20 seconds on Windows) to create a pdf (1 page) from a simple report using an xml file as data source.
    It takes approximately 2 minutes when opening the report
          > reportClientDoc.open(REPORT_NAME, 0);
    then 4 minutes are required to connect the report to the xml data source
          > reportClientDoc.getDatabaseController().setDataSource(xml_ds, "", "");
    Have you got any clue on possible reasons for this issue ?
    Edited by: florian epiard on Jan 30, 2009 4:33 PM

    Hello,
    I am experimenting difficulties using the JRC 2.0 (which I hadn't with the previous version) on a RedHat 4 machine. It takes 7 minutes (only 20 seconds on Windows) to create a pdf (1 page) from a simple report using an xml file as data source.
    It takes approximately 2 minutes when opening the report
          > reportClientDoc.open(REPORT_NAME, 0);
    then 4 minutes are required to connect the report to the xml data source
          > reportClientDoc.getDatabaseController().setDataSource(xml_ds, "", "");
    Have you got any clue on possible reasons for this issue ?
    Edited by: florian epiard on Jan 30, 2009 4:33 PM

Maybe you are looking for