APDUTool no such algorithm

Hi everyone,
I try for a while to play with the apdutool and I can't get the following code working. Using debugging, I saw the CryptoException is thrown with NO_SUCH_ALGORITHM, so it seems the apdutool doesn't support this algorithm (notice that using 512-bit keys this works)
try {
     currentCertPublicKey = (RSAPublicKey) KeyBuilder.buildKey(
          KeyBuilder.TYPE_RSA_PUBLIC, KeyBuilder.LENGTH_RSA_1024,
          false); /* 512 -> OK */
} catch (CryptoException e) {
     switch (e.getReason()) {
     case CryptoException.NO_SUCH_ALGORITHM:
          ISOException.throwIt(e.getReason());
          break;
     default:
          ISOException.throwIt(e.getReason());
}Is there a way to make this work, using additional libraries or something? (nowadays, 512-bit RSA keys is pretty useless...)
Thanks in advance
Guillaume

Hi,
JCWDE and CREF have limitations on cryptographic algorithms and key sizes due to export restrictions. You will be stuck with 512 bit RSA keys until you have a real card or a different emulator (such as JCOP tools as mentioned). The limitations are outlined in the developer guide that is included in the JCDK.
Cheers,
Shane

Similar Messages

  • Error Https SOAP Adapter:NoSuchAlgorithmException: No such algorithm: RSA

    Hi,
    I'm using a SOAP Adapter Receiver to integrate a file to an External WS (with HTTPS). But when I tried to execute It I got the following error:
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Unable to encrypt preMasterSecret: java.security.NoSuchAlgorithmException: No such algorithm: RSA: iaik.security.ssl.SSLException: Unable to encrypt preMasterSecret: java.security.NoSuchAlgorithmException: No such algorithm: RSA
    SOAP: call failed: iaik.security.ssl.SSLException: Unable to encrypt preMasterSecret: java.security.NoSuchAlgorithmException: No such algorithm: RSA     
    I think It is a problem with the creation of the secure channel of HTTPS.
    Any tip is very welcome!!
    Thanks
    Martin

    http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html#AppA
    there is not much info to find about who provides for RSA.RSA is already implemented in the Crypto-Provider by Sun. You don't have to laod a special provider.
    The following sample is just enough:
    Cipher cipher = Cipher.getInstance("RSA");Jan

  • No such algorithm: RSA

    when i try to call the Cipher.getInstance("RSA") method, i get a runtime error:
    Exception in thread "main" java.security.NoSuchAlgorithmException: No such algor
    ithm: RSA
    at javax.crypto.SunJCE_b.c(DashoA6275)
    at javax.crypto.SunJCE_b.a(DashoA6275)
    at javax.crypto.Cipher.getInstance(DashoA6275)
    at Crypto.main(Crypto.java:21)
    the jce api says that rsa is implemented, please help.

    That's make sence. Your applet doesn't work because of the security restrictions for the unsigned applets.
    Even sun's provider are in the same restrictions as any 3rd party. So, you have to sign your applet anyway and deploy it together with the JCE provider because there is no warranty that JCE provider will be installed on the user's machine (cos' it is only included into JRE 1.4, but not before).

  • No such algorithm

    hi all,
    i am new to cryptography and i tried to write some codes to generate DH parameters but i encountered an exception ->NoSuchlgorithmException.
    Can anybody tell me why and how to resolved this.
    thanks a million
    AlgorithmParameterGenerator paramGen = AlgorithmParameterGenerator.getInstance("DH");
    paramGen.init(1024);
    // Generate the parameters
    AlgorithmParameters params = paramGen.generateParameters();
    DHParameterSpec dhSpec
    = (DHParameterSpec)params.getParameterSpec(DHParameterSpec.class);

    DHdiffe-hellmanSo this is an algoritm? Then maybe some parameters associated with it weren't found when referred to as "DH". Maybe this explains the exception?

  • Jsse error -- java.security.NoSuchAlgorithmException:Algorithm TLS

    I tried using the sample codes given at the JSSE1.0.2 web site, but I am encountering the folowing problem:
    java.security.NoSuchAlgorithmException: Algorithm TLS not available
    PLEASE ADVICE ME.
    Thanks,
    Shafique Razzaque,
    SCPJ2,
    Singapore.

    My email : [email protected]
    Hi
    I�m a student working on a Sun JSSE Samples for many weeks and I couldn�t run anyone ..!
    I am using the last JSSE 1.02 , the jdk 1.31, working on Jbuilder4
    I am working on both RMI and sockets samples.
    On the RMI sample I got this Exception : no such algorithm �TSL�
    �TSL� not supported
    I searched in the posted messages in the forum and I found someone had the same problem
    I followed all what he did but no way �!
    I don�t know what I forget to do, see what I did and tell me please what is wrong.
    I installed the JSSE as followed in the install file. I am sure that it is well installed
    How to compile???!!!
    1.I configured the rmic parameters to generate only the stub compatible only with java 2
    2.I compiled the project I got the stub
    3.I put theses parameters in
    Project Properties /Run/ field : VM parameters
    -Djava.rmi.server.codebase=file:/c:/windows/jbproject/Sunrmissl/classes/ -Djava.security.policy=file:/c:/windows/jbproject/Sunrmissl/policy.policy -Djavax.net.ssl.trustStore=file:/c:/windows/jbproject/Sunrmissl/testkeys.key
    4.I run the rmiregistry
    5.i run the HelloImp but every time exceptions :
    C:\JBUILDER4\JDK1.3\bin\javaw -classpath "C:\WINDOWS\jbproject\Sunrmissl\classes;C:\jsse-1_0_2-gl\jsse1.0.2\lib\jcert.jar;C:\jsse-1_0_2-gl\jsse1.0.2\lib\jnet.jar;C:\jsse-1_0_2-gl\jsse1.0.2\lib\jsse.jar;C:\JBUILDER4\JDK1.3\demo\jfc\Java2D\Java2Demo.jar;C:\JBUILDER4\JDK1.3\jre\lib\i18n.jar;C:\JBUILDER4\JDK1.3\jre\lib\jaws.jar;C:\JBUILDER4\JDK1.3\jre\lib\rt.jar;C:\JBUILDER4\JDK1.3\jre\lib\sunrsasign.jar;C:\JBUILDER4\JDK1.3\lib\dt.jar;C:\JBUILDER4\JDK1.3\lib\tools.jar" -Djava.rmi.server.codebase=file:/c:/windows/jbproject/Sunrmissl/classes/ -Djava.security.policy=file:/c:/windows/jbproject/Sunrmissl/policy.policy -Djavax.net.ssl.trustStore=file:/c:/windows/jbproject/Sunrmissl/testkeys.key sunrmissl.HelloImpl
    java.security.NoSuchAlgorithmException: Algorithm TLS not available
         at com.sun.net.ssl.b.a([DashoPro-V1.2-120198])
         at com.sun.net.ssl.SSLContext.getInstance([DashoPro-V1.2-120198])
         at sunrmissl.RMISSLServerSocketFactory.createServerSocket(RMISSLServerSocketFactory.java:39)
         at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:559)
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:200)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:172)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:319)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:119)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:125)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:109)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:278)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:209)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObHelloImpl err: null
    ject.java:100)
         at sunrmissl.HelloImpl.<init>(HelloImpl.java:27)
         at sunrmissl.HelloImpl.main(HelloImpl.java:41)
    java.lang.NullPointerException
         at sunrmissl.RMISSLServerSocketFactory.createServerSocket(RMISSLServerSocketFactory.java:51)
         at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:559)
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:200)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:172)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:319)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:119)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:125)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:109)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:278)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:209)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:100)
         at sunrmissl.HelloImpl.<init>(HelloImpl.java:27)
         at sunrmissl.HelloImpl.main(HelloImpl.java:41)

  • Can I implement advanced control algorithm with floating-point computations in Ni 7831R ?

    Hi,
    I plan to use a Ni 7831R to control a MIMO nano-positioning stage with servo rate above 20kHz. The control algorithm is based on robust control design and it is much more complex than PID. it also includes floating-point caculations. Can I implement such algorithm with Ni 7831R?
    By the way, is there any way to expand the FPGA gates number for Ni 7831R? Suppose I run out of the FPGA gates (1M), can I add more FPGA gates by buying some different hardware?
    Thanks
    Jingyan
    Message Edited by Jingyan on 08-22-2006 01:45 PM

    Jingyan,
    as long as there is no GPU core implemented on the FPGA these devices only support integer arithmetic. NI's FPGA targets currently don't contain a GPU core so there is no native floating point arithmetic available.
    Still there are several options to implement floating point arithmetic on your own or to work around this target specific limitation. Here are some links that might help:
    Floating-Point Addition in LabVIEW FPGA
    Multiplying, Dividing and Scaling in LabVIEW FPGA
    The NI 7831R uses an 1M FPGA. If your application requires more gates the NI 7833R (3M) is a good solution.
    I hope that helps,
    Jochen Klier
    National Instruments Germany

  • TLS(Transaport Layer Security) algorithm not available...JSSE sample codes

    I am using the sample codes provided with the JSSE1.0.2, but I get the following exception" when TLS algorithm not available". I do not get the error when using Java Forte( UI), but when I use the dos prompt to execute the sample codes, I get the error.Please advice.
    Thank You,
    Shafique Razzaque,
    Java Certified Programmer,
    Singapore.

    My email : [email protected]
    If you want to send me any running programme
    Hi
    I�m a student working on a Sun JSSE Samples for many weeks and I couldn�t run anyone ..!
    I am using the last JSSE 1.02 , the jdk 1.31, working on Jbuilder4
    I am working on both RMI and sockets samples.
    On the RMI sample I got this Exception : no such algorithm �TSL�
    �TSL� not supported
    I searched in the posted messages in the forum and I found someone had the same problem
    I followed all what he did but no way �!
    I don�t know what I forget to do, see what I did and tell me please what is wrong.
    I installed the JSSE as followed in the install file. I am sure that it is well installed
    How to compile???!!!
    1.I configured the rmic parameters to generate only the stub compatible only with java 2
    2.I compiled the project I got the stub
    3.I put theses parameters in
    Project Properties /Run/ field : VM parameters
    -Djava.rmi.server.codebase=file:/c:/windows/jbproject/Sunrmissl/classes/ -Djava.security.policy=file:/c:/windows/jbproject/Sunrmissl/policy.policy -Djavax.net.ssl.trustStore=file:/c:/windows/jbproject/Sunrmissl/testkeys.key
    4.I run the rmiregistry
    5.i run the HelloImp but every time exceptions :
    C:\JBUILDER4\JDK1.3\bin\javaw -classpath "C:\WINDOWS\jbproject\Sunrmissl\classes;C:\jsse-1_0_2-gl\jsse1.0.2\lib\jcert.jar;C:\jsse-1_0_2-gl\jsse1.0.2\lib\jnet.jar;C:\jsse-1_0_2-gl\jsse1.0.2\lib\jsse.jar;C:\JBUILDER4\JDK1.3\demo\jfc\Java2D\Java2Demo.jar;C:\JBUILDER4\JDK1.3\jre\lib\i18n.jar;C:\JBUILDER4\JDK1.3\jre\lib\jaws.jar;C:\JBUILDER4\JDK1.3\jre\lib\rt.jar;C:\JBUILDER4\JDK1.3\jre\lib\sunrsasign.jar;C:\JBUILDER4\JDK1.3\lib\dt.jar;C:\JBUILDER4\JDK1.3\lib\tools.jar" -Djava.rmi.server.codebase=file:/c:/windows/jbproject/Sunrmissl/classes/ -Djava.security.policy=file:/c:/windows/jbproject/Sunrmissl/policy.policy -Djavax.net.ssl.trustStore=file:/c:/windows/jbproject/Sunrmissl/testkeys.key sunrmissl.HelloImpl
    java.security.NoSuchAlgorithmException: Algorithm TLS not available
         at com.sun.net.ssl.b.a([DashoPro-V1.2-120198])
         at com.sun.net.ssl.SSLContext.getInstance([DashoPro-V1.2-120198])
         at sunrmissl.RMISSLServerSocketFactory.createServerSocket(RMISSLServerSocketFactory.java:39)
         at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:559)
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:200)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:172)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:319)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:119)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:125)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:109)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:278)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:209)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObHelloImpl err: null
    ject.java:100)
         at sunrmissl.HelloImpl.<init>(HelloImpl.java:27)
         at sunrmissl.HelloImpl.main(HelloImpl.java:41)
    java.lang.NullPointerException
         at sunrmissl.RMISSLServerSocketFactory.createServerSocket(RMISSLServerSocketFactory.java:51)
         at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:559)
         at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:200)
         at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:172)
         at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:319)
         at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:119)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:125)
         at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:109)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:278)
         at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:209)
         at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:100)
         at sunrmissl.HelloImpl.<init>(HelloImpl.java:27)
         at sunrmissl.HelloImpl.main(HelloImpl.java:41)

  • MSGAL and library for algorithms

    Hello,
    i would like to visualize different algorithms with MSAGL (for example the Depth First Search algorithm). Is their a library from Micrososft, which implements such algorithms and works together with MSAGL, so i create a graph with MSAGL and apply the algorithm
    to this graph ?
    Best regards

    Sho,
    http://research.microsoft.com/en-us/downloads/04f0c2dc-7e54-4f53-8e2b-3cffebb9cc14/default.aspx , could be a candidate.
    Thanks,
    Lev
    Lev Nachmanson

  • How to get MessageDigest intance with MD5 algorithm

    Hi,
    When i try to get MessageDigest instance of MD5 algorithm the error 3 (no such algorithm) is returned.
    mD = MessageDigest.getInstance(MessageDigest.ALG_MD5, false);
    How can I do?
    Edited by: user9378729 on 4 avr. 2011 06:30

    From the Javadoc for JC2.2.2:
    Throws
    CryptoException with the following reason codes:
    CryptoException.NO_SUCH_ALGORITHM if the requested algorithm or shared access mode is not supported.Set the second parameter to "false" so that you don't request shared access mode to your digest object.
    EDIT: I missed that you already do that.
    Are you using a simulator?
    Adriaan
    Edited by: 797894 on Apr 4, 2011 7:55 AM

  • Advance Graph Algorithm

    Hello guys,
    I am working now on a TSP(traveling salesman problem), I am facing a very challenging problem in fact.
    The Main Problem: I need to find all the possible routes from A to B, I believed that there is no algorithm to provide such thing after a deadly search, so If anyone can help with just a link or a similar algorithm that would be great.
    And if you are interested to know why I need such algorithm;
    1 - I need to have the TSP works on only a part of a big graph, like a big city and I work the TSP only on 4 places.
    2 - So I need to make a small Graph object for the only 4 places, and pass it to TSP.
    3 - I need to make sure that all edges of this graph are set to the shortest paths between every pair of places. But if I found out that this shortest path go through a place which is in the TSP problem, then I have to find another(thats why i need the all routes algorithm).
    4 - (which is the main problem) this short path can't pass through any place which is within the TSP problem(coz TSP go through every place only once).
    (ex if the TSP is interested in places A, B, C, D and the shortest path from A to B passes through D, I can't pass this small graph object to TSP until I find another path connecting A to B and doesn't pass through C nor D -if there is no such path then of course I have to set it with infinity-).
    I hope one of you guys worked on this problem before,
    Thanks & Regrads,
    ES_Coders

    Thanks all,
    I have already solved the problem. I will declare it again here.
    TSP: is to find a cycle that goes through every node only once and goes back to the start point.
    MySystem: consists of nodes from A, B, C, ...., Z.
    Main Idea: user chooses a number of nodes to find their TSP.
    Ex: User wants to find TSP around A, B, C only.
    Problem: if the shortest path (A to B ) go through another node N, and also shortest path(B, C)go through this very same node N. Then the cycle goes through the node N twice which makes the TSP fail.
    Solution:
    1- Use special type of Floyed(or Dijkstra) which finds the shortest paths between every pair of nodes (n1, n2) (n1, n3) ... . But the special part is that this Floyed method takes an array of the nodes considered by TSP lets say{t1, t2, ...}. And it finds the shortest path between (n1, n2) except that this shortest path doesn't go through any of {t1, t2, t3, ...}.
    2- Now when I apply TSP lets say for {A, B, C} I am sure that shortest path from (A to B) doesn't go through node C, but It can go through some other node n which doesn't belong to {A, B, C} -some other node in the system-
    3- After I get my answer from TSP, if i found that this TSP doesn't pass through any place more than once, this is cool, I did it. But if it does pass through the node n more than once. (Here is the trick) I apply TSP for {A, B, C, n} by this way I ll start again whit the special Floyed making sure that every shortest path doesn't pass through n. And when I go for the real TSP the node n won't be passed through twice.
    I hope I was able to declare the problem and the solution,
    Thx a lot guys,
    ES_Coders

  • Error while installing J2EE Add- In to the ABAP system

    Error while installing J2EE Add-In to the ABAP system 
    We are installing J2EE Add-In to the ECC5 System in the new hardware.
    When are getting Error while installing J2EE Add-In to the ABAP system.
    Transaction Begin*****************************
    ERROR 2005-08-10 14:58:28
    CJSlibModule::writeLogEntry()
    CJS-20011 J2EE engine configuration error. DIAGNOSIS: Error when
    configuring J2EE Engine. See output of
    logfile /usr/sap/QSS/install/batchconfig.log: 'My Library Path
    is: /usr/j2se/jre/lib/sparcv9/server:/usr/j2se/jre/lib/sparcv9:/usr/j2se/jre/../lib/sparcv9:/tmp/sapinst_exe.13084.1123702275:/usr/lib::/usr/openwin/lib:/usr/sap/QSS/SYS/exe/run:/oracle/QSS/920_64/lib:/oracle/QSS/920_64/lib32:/usr/lib
    ElementInfoTask has finished successfully on dispatcher
    ConsoleLogsTask has finished successfully on dispatcher
    ChangeManagerPropsTask has finished successfully. Manager:
    LockingManager on dispatcher
    ChangeManagerPropsTask has finished successfully. Manager:
    ClusterManager on dispatcher
    ElementInfoTask has finished successfully on server
    ConsoleLogsTask has finished successfully on server
    ChangeManagerPropsTask has finished successfully. Manager:
    LockingManager on server
    ChangeManagerPropsTask has finished successfully. Manager:
    ClusterManager on server
    ChangeServicePropsTask has finished successfully. Service: dbpool on
    server
    ChangePasswordsTask finished successfully.
    Error occured while connecting to database (UploadFile). Msg: No such
    algorithm: DESede
    Transaction end***********************************
    We tried twice clean installation, after removing j2ee dir, SCS and
    resp profiles and droping PSAPQSSDB tablespace and SAPQSSDB user.
    I have also confirmed the passwords in ABAP system/000 for SAPJSF, DDIC, J2EE_ADMIN, J2EE_GUEST.
    We are getting the same error in both tries.
    Kindly advice us to resolve the problem.
    Thanks and Regards,
    Srinivas

    Ananda,
    you saved my day!  I've been banging my head against the wall with this same problem during a J2EE add-in installation for SRM 4.0 on Windows, in preparation of an LAC 2.0 installation.  I had tried deleting the schema first, but that didn't work.  After I removed the sys\global\security folder as well, it worked perfectly.
    Thank you.

  • How to use the same keypair for both encrypt/decryprt-SunPKCS#11

    Dear All,
    Subject: To access iKey 2032 token, to retrieve public/private key from iKey 2032 token using pkcs#11 in sdk1.5, to encrypt/decrypt files.
    When I separate the encrypt and decrypt part of java program, encryption program works well, whereas decryption program does not decrypt anything in the decrypt file (But there is no error). I printed out the public and private key in both encrypt and decrypt part of java program, its displayed differently::
    Encrypt program:
    SunPKCS11-rainbow_token RSA public key, 1024 bits (id 10, session object)
    modulus: 114338469922835728259534620463489934081917342509275191892563243582065
    74380495029336519036972702864998634664269499641616889325482699399559620370181624
    72068116957594402738459932902481604823224406859575930392708524033619120886256353
    58738237376491107769961041015109436347533548940674900728805627968145581222172729
    public exponent: 65537
    SunPKCS11-rainbow_token RSA private key, 1024 bits (id 11, session object, sensi
    tive, unextractable)
    Decrypt Program::
    SunPKCS11-rainbow_token RSA public key, 1024 bits (id 12, session object)
    modulus: 138556361758970660122782926386849783732271581948935425587968692317930
    09262429353977097956605140384961825974398004270547046620971835394362397699233738
    54481804748731546655197744692886754946373745924825650876065903334173666990347814
    83727290962956934521650035029131176614982652900659797194703065074407857754883163
    public exponent: 65537
    SunPKCS11-rainbow_token RSA private key, 1024 bits (id 13, session object, sensi
    tive, unextractable)
    I suspect that every time program generates different set of key, therefore we need to store the generated key during encryption part (i believe it is to be in the keystore) and to use the same for decryption part. Could you please give me a tips how to do this?
    Encrypt Program ::
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Encrypt.
    public class Encrypt
    public Encrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              KeyPair kp = kpg.genKeyPair();
              kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
              FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
              Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
              cp.init(cp.ENCRYPT_MODE,kp.getPublic());
              CipherOutputStream cout=new CipherOutputStream(out,cp);
              byte[] input=new byte[8];
              int byteread=in.read(input);
              while(byteread!=-1){
                   cout.write(input,0,byteread);
                   byteread=in.read(input);
              cout.flush();
              in.close();
              cout.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Encrypt tl = new Encrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Decrypt Program ::
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Decrypt.
    public class Decrypt
    public Decrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              KeyPair kp = kpg.genKeyPair();
              kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in1 = new FileInputStream("C:\\ReportDBAE.properties");
              FileOutputStream out1 = new FileOutputStream("C:\\ReportDBAD.properties");
              Cipher cipher=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
              AlgorithmParameters algParams = cipher.getParameters();
              cipher.init(Cipher.DECRYPT_MODE,kp.getPrivate(),algParams);
              CipherInputStream cin1=new CipherInputStream(in1,cipher);
              byte[] input1=new byte[8];
              int byteread1=cin1.read(input1);
              while(byteread1!=-1){
                   out1.write(input1,0,byteread1);
                   byteread1=cin1.read(input1);
              out1.flush();
              in1.close();
              out1.close();
              cin1.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(InvalidAlgorithmParameterException iape)
         System.out.println("Invalid Algorithm ParameterException " + iape.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Decrypt tl = new Decrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Configuration file::
    name = rainbow_token
    library = c:\winnt\system32\dkck201.dll
    attributes(*,CKO_PRIVATE_KEY,*) = {
    CKA_SIGN = true
    attributes(*,CKO_PRIVATE_KEY,CKK_DH) = {
    CKA_SIGN = null
    attributes(*,CKO_PRIVATE_KEY,CKK_RSA) = {
    CKA_DECRYPT = true
    }

    Hi all,
    Now i manage to use the same keypair for both encrypt/decryprt-SunPKCS#11. Below is my code woks well. In my code i hard coded alias name of certificate, did anyone knows how to read alias name of certificate from iKey token 2032??
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Encrypt.
    public class Encrypt
    public Encrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         String myAlias = "349eefd1-845b-4ba4-9f88-06e9f5cb82f6";
         /** to view alias name
         keytool -list -v -keystore NONE -storetype PKCS11 -storepass PASSWORD
         Security.addProvider(p);
         KeyStore ks = null;
         PrivateKey privKey = null;
         PublicKey pubKey = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
              java.security.cert.Certificate cert = ks.getCertificate(myAlias);
              Key key = ks.getKey(myAlias, pin);
              if(key != null) {
                   System.out.println("key class: " + key.getClass().getName()); // -> sun.security.pkcs11.P11Key$P11PrivateKey
                   System.out.println("key bytes: " + key.getEncoded()); // -> null!!!!!!!
         if(PrivateKey.class.isInstance(key)) {
         privKey = (PrivateKey)key;
         System.out.println("algo: " + privKey.getAlgorithm()); // -> RSA
         //Signature rsasig = Signature.getInstance("SHA1withRSA");
         //rsasig.initSign(privKey);
         //rsasig.update(data.getBytes());
         //byte[] sigBytes = rsasig.sign();
         pubKey = cert.getPublicKey();
         //System.out.println("signed bytes: " +sigBytes);
         //return sigBytes;
         //KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              //KeyPair kp = kpg.genKeyPair();
              //KeyPair kp = kpg.generateKeyPair();
              //kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
              FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
              Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
    //cp.init(cp.ENCRYPT_MODE,kp.getPublic());
              cp.init(cp.ENCRYPT_MODE,pubKey);
              CipherOutputStream cout=new CipherOutputStream(out,cp);
              byte[] input=new byte[8];
              int byteread=in.read(input);
              while(byteread!=-1){
                   cout.write(input,0,byteread);
                   byteread=in.read(input);
              cout.flush();
              in.close();
              cout.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         ike.printStackTrace();
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
         catch(UnrecoverableKeyException unrke)
         System.out.println("Unrecoverable Key Exception " + unrke.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Encrypt tl = new Encrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Your help is very much appreciated!!!!

  • SDM Connectivity - Urgent

    Hi,
    Caused by: java.security.NoSuchAlgorithmException: No such algorithm: PbeWithSHAAnd3_KeyTripleDES_CBC
            at javax.crypto.SunJCE_b.c(DashoA12275)
            at javax.crypto.SunJCE_b.a(DashoA12275)
            at javax.crypto.Cipher.a(DashoA12275)
            at javax.crypto.Cipher.getInstance(DashoA12275)
            at com.sap.security.core.server.secstorefs.Crypt.<init>(Crypt.java:220)
            at com.sap.security.core.server.secstorefs.SecStoreFS.<init>(SecStoreFS.java:1346)
            at com.sap.sql.connect.OpenSQLConnectInfo.getStore(OpenSQLConnectInfo.java:798)
            ... 27 more
    Jan 16, 2008 5:31:48 PM  Warning: Caught CVersProxyAccessException while saving repository: CVersAccessException: Cannot acces
    s CVers due to missing or incorrect configuration.
    Additional error message is:
    com.sap.sdm.apiint.serverext.servertype.TargetServiceException: Cannot provide connect data for database target system "CONFIG
    _DB".
    Additional error message is:
    com.sap.sdm.serverext.servertype.dbsc.DatabaseConnectException: Creation of DataSource for database "EPG" failed. (com.sap.sql
    .log.OpenSQLException: Error while accessing secure store: Encryption or decryption is not possible because the full version o
    f the SAP Java Crypto Toolkit was not found (iaik_jce.jar is required, iaik_jce_export.jar is not sufficient) or the JCE Juris
    diction Policy Files don't allow the use of the "PbeWithSHAAnd3_KeyTripleDES_CBC" algorithm..)
    Jan 16, 2008 5:32:03 PM  Info: Actions per selected component:
    Jan 16, 2008 5:32:03 PM  Info: Initial deployment: Selected software component 'BP_ERP5ESS'/'sap.com'/'MAIN_ERP05VAL_C'/'1000.
    1.0.10.0.20070704092730''/'2' will be deployed.
    Jan 16, 2008 5:32:03 PM  Info: Initial deployment: Selected development component 'ess/bp_ess'/'sap.com'/'MAIN_ERP05VAL_C'/'11
    99208'/'2' will be deployed.
    Jan 16, 2008 5:32:03 PM  Info: Initial deployment: Selected development component 'ess/bp_essrowo'/'sap.com'/'MAIN_ERP05VAL_C'
    /'1199211'/'2' will be deployed.
    Regards,
    Basis

    Hi,
    Refer SAP Note 1071472 - FileSystem SecureStore connection issues.
    Go to folder /sapmnt/<SID>/global/security/lib/tools, you will find iaik_jce.jar & iaik_jce_export.jar check whether thease are latest one's if not download & replace with new one.
    Try removing the file iaik_jce_export.jar, it worked for me once.
    Hope this will help you.
    Best Regards,
    Sachin.

  • How to create sales order with configuration?

    Hi, all!
    I'm trying to create sales order with multi-level BOM's explosion using BAPI_SALESORDER_CREATEFROMDAT2, but with no success.
    Scanning and following ton's of OSS notes and already posted answers in this forum regarding configuration in sales order doesn't lead to success to.
    So can anybody throw light on rules for populating data structures for items and items configuration in case of multi-level BOM's explosion in sales order? Providing working code snippet would be great.
    Regards,
    Maxim.

    Hi, all!
    Just want to properly close the thread and share experience gained.
    The main reason of error was in incorrect TABLES parameters populating for sales order items and their configuration.
    Not the secret that there is a lack of documentation for even BAPIs FM, especially for comprehensive things to do. And it seems that the right way to resolve proper structure of import/tables parameters for "creation/change" function modules is to call "corresponding read-FM" for object created on-line  and see how return parameters are populated.
    For example, for BAPI_SALESORDER_CREATEFROMDAT2 such corresponding FM is BAPISDORDER_GETDETAILEDLIST, which returns near the same structures.
    Actually in my case such algorithm was used in the first place. But BAPISDORDER_GETDETAILEDLIST returned wrong parameters as was discovered later This error was fixed by implementing OSS note 821191 and sales order was succesfully created.
    And I want to thank SAP Support experts in effective assistance. 10 points are yours!
    Regards,
    Maxim.

  • Error when using DES/CBC/PKCS5Padding

    When I using the captioned algorithm, the system repor no such algorithm.
    import javax.crypto.*;
    import javax.crypto.spec.*;
    Cipher c = Cipher.getInstance("DES/CBC/PKCS5Padding");Can anybody give me some tips?

    Don't worry, I found my mistake and solve the problem now.
    Thanks everybody.

Maybe you are looking for