Generating key pair on PKCS#11token and save it there

Hello,
again i'm completely lost in this PKCS11 jungle.
What i want to do:
Generating key pair on crypto pkcs11 token and store it there.
In the moment i've tried eg:
sun.security.pkcs11.SunPKCS11 p = new sun.security.pkcs11.SunPKCS11(configName);
Security.addProvider(p);
Builder builder = KeyStore.Builder.newInstance("PKCS11", p, new KeyStore.CallbackHandlerProtection(new UserInputDialog(new JDialog(),"test","test")));
KeyStore ks = builder.getKeyStore();
ks.load(null,null);
KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA", p);
gen.initialize(1024);
KeyPair kp = gen.generateKeyPair();
           Here access to token works. The callback PIN dialog comes up and i can login.
But i'm not sure whether the key are generated on this PKCS11. And they are not stored there.
How i can generate keys are stored there.
(like with keytool -genkeys ). In keytool case a certificate is stored.
... every little hint, also to some documentation i've not seen, is very welcome ...
Thank You !
Regards
Thomas
.

First, you need to get a KeyStore representation of the PKCS#11 token with code similar to this, I'm using NSS as the PKCS#11 token in this example:
Provider nss = new sun.security.pkcs11.SunPKCS11(configFile);
Security.insertProviderAt(nss, 1);  //you may not want it at highest priority
KeyStore ks = KeyStore.getInstance("PKCS11", nss);
ks.load(null, password);From the testing I've done in the past with various tokens, when you generate an asymmetric keypair (e.g. RSA like you are) specifying the PKCS11 provider, it creates it right on the token automatically and code like below is not needed.
To store the key in the keystore, use code similar to this, I'm using NSS again and storing a symmetric key:
KeyGenerator kg = KeyGenerator.getInstance("DESede",nss);
SecretKey tripleDesKey = kg.generateKey();
KeyStore.SecretKeyEntry skEntry = new KeyStore.SecretKeyEntry(tripleDesKey);
ks.setEntry(randAlias, skEntry, new KeyStore.PasswordProtection(password));

Similar Messages

  • I can't get Droid Turbo bluetooth to work in my 2005 Prius.  Droid Razr worked fine.  It seems to pair OK, and everything works great immediatly after pairing.  After stopping and restarting car there is a message saying it found bluetooth device, I can s

    I can't get Droid Turbo bluetooth to work in my 2005 Prius.  Droid Razr worked fine.  It seems to pair OK, and everything works great immediatly after pairing.  After stopping and restarting car there is a message saying it found bluetooth device, I can still place a call with the car system, but no sound or microphone connection to the car system.  Android tech support just said, "yea, that happens."  I have version 4.4.4.  Any ideas?

    Automata,
    Oh no. Is never fun having issues with bluetooth. Did you have this issue with any of your previous devices? When this happens what steps do you take to get it working again?
    LindseyT_VZW
    Follow us on Twitter @VZWSupport

  • HT4910 I tried to update my address book on OS X6 with an abbu from my other computer which has Lion OS X 7.  It wiped my address book clean and I cannot retreive by Address book on my OS X 6 computer and saves out there?

    I tried to update my address book on OS X6 with an abbu from my other computer which has Lion OS X 7.  It wiped my address book clean and I cannot retreive by Address book on my OS X 6 computer and saves out there?

    blacksheepfibers wrote:
    I updated my mac with  os x Lion so that I could accomplish moving my address book from the mac to my new IPad 3G. I also set up an icloud account for this purpose, but I *still* cannot figure out how to move my address book from one computer to the other. When I'm on my mac and try to use bluetooth to export the address book, I'm able to find my ipad but I soon get a message that it does not support the necessary services. I have no idea what's going on and would appreciate any advice. tks in advance, Sarah
    The address book syncs via iCloud, not Bluetooth or iTunes.
    You upgraded to Lion so you could use iCoud.
    On the computer. go to Apple menu > System prefs > iCloud.
    Sign into your iCloud account.
    Tick everything.
    This enalbes the se items syncing to iCloud.
    On the iPad, Settings > Mail, Contacts, Calendars.
    Create a new iCloud account.
    Sign in with the same AppleID as your computer.
    Settings > iCloud and turn everything on.
    BAM!
    That is all you need to do.
    Your contacts (and all other checked items checked) will sync between computer and iPad.
    No need to use iTunes

  • How to generate key pair using java ?(its urgent)

    We r working on java card. For security purpose I want a Key pair.
    If anyone is able to uide me by giving me a small code or algorithm i am very thankful.
    Its an urgent !!!!
    Plz inform me if any relative information u r having.

    import java.security.KeyPairGenerator;
    import java.security.KeyPair;
    import java.security.PrivateKey;
    import java.security.PublicKey;
    import java.security.SecureRandom;
    import java.security.KeyFactory;
    import java.security.spec.PKCS8EncodedKeySpec;
    import java.security.spec.X509EncodedKeySpec;
    import java.io.FileOutputStream;
    import java.io.FileInputStream;
    public class ParClaves {
         public KeyPairGenerator keyPairGenerator;
         public KeyPair keyPair;
         public PrivateKey privateKey;
         public PublicKey publicKey;
         public String algoritmo = "DSA"; // DSA o RSA
         public String proveedor = null;
         public int keysize = 1024;
         public SecureRandom random = null;
         public void guardarClaves(String fichClavePublica, String fichClavePrivada) throws Exception {
              byte[] key = this.publicKey.getEncoded();
              FileOutputStream keyfos = new FileOutputStream(fichClavePublica);
              keyfos.write(key);
              keyfos.close();               
              key = this.privateKey.getEncoded();
              keyfos = new FileOutputStream(fichClavePrivada);
              keyfos.write(key);
              keyfos.close();               
         } // fin de guardarClaves
         public void guardarClaves(String fichClavePublica, String fichClavePrivada, KeyPair keyPair) throws Exception {
              byte[] key = keyPair.getPublic().getEncoded();
              FileOutputStream keyfos = new FileOutputStream(fichClavePublica);
              keyfos.write(key);
              keyfos.close();               
              key = keyPair.getPrivate().getEncoded();
              keyfos = new FileOutputStream(fichClavePrivada);
              keyfos.write(key);
              keyfos.close();               
         } // fin de guardarClaves     
         public KeyPair recuperarClaves(String fichClavePublica, String fichClavePrivada) throws Exception {
              return new KeyPair(recuperarClavePublica(fichClavePublica), recuperarClavePrivada(fichClavePrivada));
         } // fin de recuperarClaves
         public PublicKey recuperarClavePublica(String fichClavePublica) throws Exception {
    // PENDIENTE: seguramente, para que esto fuera v�lido, habr�a que proporcionar el Proveedor ?�
    // probar generando clavePublica con otro proveedor distinto de SUN
              FileInputStream fis = new FileInputStream(fichClavePublica);
              byte[] encKey = new byte[fis.available()];
              fis.read(encKey);
              fis.close();
              KeyFactory keyFactory = null;
              try {
                   keyFactory = KeyFactory.getInstance("DSA");
              } catch (Exception e) {
                   keyFactory = KeyFactory.getInstance("RSA");
              } // fin del try
              X509EncodedKeySpec pubKeySpecX509 = new X509EncodedKeySpec(encKey);
              PublicKey publicKey = keyFactory.generatePublic(pubKeySpecX509);
              return publicKey;
         } // fin de recuperarClavePublica
         public PrivateKey recuperarClavePrivada(String fichClavePrivada) throws Exception {
    // PENDIENTE: seguramente, para que esto fuera v�lido, habr�a que proporcionar el Proveedor ?�
    // probar generando clavePrivada con otro proveedor distinto de SUN
              FileInputStream fis = new FileInputStream(fichClavePrivada);
              byte[] encKey = new byte[fis.available()];
              fis.read(encKey);
              fis.close();
              KeyFactory keyFactory = null;
              try {
                   keyFactory = KeyFactory.getInstance("DSA");
              } catch (Exception e) {
                   keyFactory = KeyFactory.getInstance("RSA");
              } // fin del try
              PKCS8EncodedKeySpec privKeySpecPKCS8 = new PKCS8EncodedKeySpec(encKey);
              PrivateKey privateKey = keyFactory.generatePrivate(privKeySpecPKCS8);
              return privateKey;
         } // fin de recuperarClavePrivada
         public KeyPair generarClaves() throws Exception {
              if (this.proveedor == null) {
                   this.keyPairGenerator = KeyPairGenerator.getInstance(this.algoritmo);
                   this.proveedor = this.keyPairGenerator.getProvider().getName();
              } else {
                   this.keyPairGenerator = KeyPairGenerator.getInstance(this.algoritmo, this.proveedor);
              } // fin del if
              if (this.random == null) {
                   this.keyPairGenerator.initialize(this.keysize);
              } else {
                   this.keyPairGenerator.initialize(this.keysize, this.random);
              } // fin del if
              this.keyPair = this.keyPairGenerator.generateKeyPair();
              this.privateKey = this.keyPair.getPrivate();
              this.publicKey = this.keyPair.getPublic();
              return this.keyPair;
         } // fin de generarClaves
         public KeyPair generarClaves(SecureRandom random) throws Exception {
              this.random = random;
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(int keysize) throws Exception {
              this.keysize = keysize;
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(int keysize, SecureRandom random) throws Exception {
              this.keysize = keysize;
              this.random = random;          
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmoOproveedor) throws Exception {
              decidir(algoritmoOproveedor);
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmoOproveedor, SecureRandom random) throws Exception {
              decidir(algoritmoOproveedor);
              this.random = random;          
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmoOproveedor, int keysize) throws Exception {
              decidir(algoritmoOproveedor);
              this.keysize = keysize;          
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmoOproveedor, int keysize, SecureRandom random) throws Exception {
              decidir(algoritmoOproveedor);
              this.keysize = keysize;          
              this.random = random;                    
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmo, String proveedor) throws Exception {
              this.algoritmo = algoritmo;          
              this.proveedor = proveedor;                    
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmo, String proveedor, SecureRandom random) throws Exception {
              this.algoritmo = algoritmo;          
              this.proveedor = proveedor;
              this.random = random;                              
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmo, String proveedor, int keysize) throws Exception {
              this.algoritmo = algoritmo;          
              this.proveedor = proveedor;
              this.keysize = keysize;                              
              return generarClaves();
         } // fin de generarClaves
         public KeyPair generarClaves(String algoritmo, String proveedor, int keysize, SecureRandom random) throws Exception {
              this.algoritmo = algoritmo;          
              this.proveedor = proveedor;
              this.keysize = keysize;
              this.random = random;          
              return generarClaves();
         } // fin de generarClaves
         public String getInformacion() {
              StringBuffer sb = new StringBuffer();
              sb.append("Algoritmo: " + this.algoritmo + "\n");
              sb.append("Proveedor: " + this.proveedor + "\n");
              sb.append("Keysize: " + this.keysize + "\n");
              return sb.toString();
         } // fin de getInformacion
         public boolean esAlgoritmoValido(String algoritmo) {
              try {
                   KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(algoritmo);
                   return true;
              } catch (Exception e) {
                   return false;
              } // fin del try
         } // fin de esAlgoritmoValido
         private void decidir(String algoritmoOproveedor) {
              if (esAlgoritmoValido(algoritmoOproveedor)) {
                   this.algoritmo = algoritmoOproveedor;
              } else {
                   this.proveedor = algoritmoOproveedor;
              } // fin del if
         } // fin de decidir
    } // fin de ParClaves

  • Generate pdf file from 9i reports and save it in C:\oracle_reports\

    i want to generate a file from oracle reports in PDF format and want to save it on already defined path.
    c:\oracle_reports\
    right now pdf generation of report is working fine but before generation of pdf report system prompt me or open a dialogue box to save my pdf file on drive. i dont want to see these dialogue box or prompt me to explicitly save it.
    i want all the work done automatically.
    regards
    ------------ source code--------------
    PROCEDURE PRINT_PROC IS
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status VARCHAR2(20);
    pl_id ParamList;
    report_path varchar2(100);
    aud_sno varchar2(1000);
    aud_type varchar2(500);
    BEGIN
         pl_id := Get_Parameter_List('report_data');
         IF NOT Id_Null(pl_id) THEN
              Destroy_Parameter_List( pl_id );
         END IF;
         pl_id := Create_Parameter_List('report_data');
         User parameters : Customize these to fit your report
         report_path := :GLOBAL.Web_BASE_PATH||:GLOBAL.PATH_SCM||'REPORT\scm_rfq.rep';
    -- Initialize your report parameters here
         Add_Parameter(pl_id, 'p_cmp_code'                     , TEXT_PARAMETER, :global.company_code);
         Add_Parameter(pl_id, 'p_rfq_sno'                     , TEXT_PARAMETER, :document_sno);
         Add_Parameter(pl_id, 'P_PATH'                               , TEXT_PARAMETER, REPORT_PATH);
    Standard parameters: Don't change
         Add_Parameter(pl_id, 'PARAMFORM' , TEXT_PARAMETER, 'NO');
         Add_Parameter(pl_id, 'PAGESTREAM' , TEXT_PARAMETER, 'NO');
         Add_Parameter(pl_id, 'MAXIMIZE' , TEXT_PARAMETER, 'YES');
         -- end standard parameters
         repid := find_report_object('REPORT_OBJ');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_oas');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,report_path);
    -- SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'htmlcss');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESNAME,'\\ORCLSRV\UTL_MAIL\'||:doc_type||:receiver_sno||'.pdf');
         v_rep := RUN_REPORT_OBJECT(repid,pl_id);
         rep_status := REPORT_OBJECT_STATUS(v_rep);
         WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
         LOOP
         rep_status := report_object_status(v_rep);
         END LOOP;
    END;

    If you use rwclient you could that easily, from a Form, it requires additional steps.
    Look at this thread Re: save report

  • Generate Script from table with Clob and save other Database

    Hi
    How can I to read data from Clob column and insert into other table in other Database,
    The fist Table is in Test Quality and second in Production
    Are there way without to use Export/ Import ?
    Can I to use Loader ?
    Using 9i

    3360 wrote:
    muttleychess wrote:
    mschnatt wrote:
    than you only can try the db-link
    CREATE DATABASE LINK <dblink-name> CONNECT TO <user> IDENTIFIED BY <pwd> USING '<tnsnames-entry>';
    and make table
    create table ....
    as select ....Thank , but too no work :-( :-(
    SQL> select id,clob_data from myclob@teste;
    select id,clob_data from myclob@teste
    ERRO na linha 1:
    ORA-22992: cannot use LOB locators selected from remote tables
    Well you didn't do what the reply said to do
    and make table
    create table ....
    as select ....Also in the manual, you could save yourself a lot of time if you would open it.
    http://docs.oracle.com/cd/B14117_01/appdev.101/b10796/adlob_wo.htm#1006314
    >
    The following syntax is supported on remote LOB columns:
    CREATE TABLE t AS SELECT * FROM table1@remote_site;
    INSERT INTO t SELECT * FROM table1@remote_site;
    UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
    INSERT INTO table1@remote_site select * from local_table;
    UPDATE table1@remote_siteset lobcol = (SELECT lobcol FROM local_table);
    DELETE FROM table1@remote_site <WHERE clause involving non_lob_columns>
    This is the only supported syntax involving LOBs in remote tables. No other usage is supported.
    >[h1]Thank you very much, very very good [h1]

  • I have an email attachment that I would like to be able to access when NOTconnected.  I found one suggestion that I should open the attachemtn iniBooks and save it there.  Unfortunately, I have no idea how to do that.

    I am trying to store an email attachment (an Excel spreadsheet) somewhere on my iPhone 5 to be able to access it easily in the future.  I do not need the ability to work on it, just to access it, although it would be convenient if i could load updated versions over it on a regular basis.  The spreadsheet was created in Excel on a laptop with Win 7.  I read one posting that said I should save the document to iBooks and then could open it whenever I wanted.  The same posting refered to something in the upper right corner of the attachment that enabled me to save it to iBooks.  Unfortunately, there is no such option showing when I looked at the file, which I did email to myself.  I was able to open the attachment, but can't get beyond this point.  My tech ability doesn't go much beyond being able to power up my phone, so I need a really simple solution, if one exists.

    First of all, Excel file can't save to iBook.  (iBook only can view PDF files). That's why you don't see it in "open in" options.  In order for you to save excel, you will need a third party app like Numbers, Office2.  There are a few free apps that can use to view.  I used Office2 from Byte2, because I can not only store and view later, I can do some edit too.  Especially when you want to edit a few numbers and re send them to my office or clients will be very useful for me. 

  • How to save secret key in the NSS certDB and then retrieve it through Java?

    Hi,
    I 'm pretty new trying to handle keying material for NSS fips mode.
    After following the guidelines from http://java.sun.com/javase/6/docs/technotes/guides/security/p11guide.html#NSS I need my code to use SecretKeyFactory method generateSecret with DESedeKeySpec parameter in the following way:
    Provider nss = new sun.security.pkcs11.SunPKCS11(configFileName);
    Security.addProvider(nss);
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede", nss);
    DESedeKeySpec keySpec = new DESedeKeySpec(new String("abcdefghijklmnopqrstuvw").getBytes("UTF-8"));
    SecretKey key = keyFactory.generateSecret(keySpec);
    The question is: what are the steps needed to save secret key "abcdefghijklmnopqrstuvw" in NSS certDB in the fips mode (nssModule = fips in pkcs#11 conf. file) and how should it be retrieved in the Java code?
    Any help will be appreciated...

    OK...I didn't test this in FIPS mode, but it works in keystore mode (which says persistent storage of keys)
    KeyGenerator kg = KeyGenerator.getInstance("DESede",nss);
    kg.init(192);  //yields 168-bit key
    SecretKey tripleDesKey = kg.generateKey();
    KeyStore.SecretKeyEntry skEntry = new KeyStore.SecretKeyEntry(tripleDesKey);
    ks.setEntry(randAlias, skEntry, new KeyStore.PasswordProtection(password));I was generating some random bytes and base64'ing them to get a random alias on each execution of the program. I'd also loop through and print out the aliases before I generated another key to ensure it was storing the key in between runs which it was.
    Command-line proof the keys are in db:
    symkeyutil -L -d .
    Enter Password or Pin for "NSS Certificate DB":
         Name            Len Strength     Type    Data
    NSS Certificate DB:
    7i/XoKcaLhU=          24    168         des3  <restricted>
    Yzjt7W+AIgc=          24    168         des3  <restricted>
    RkOTZssCEQM=          24    168         des3  <restricted>
    S2BHRcFUyAA=          24    168         des3  <restricted>
    secretKeyAlias        24    168         des3  <restricted>
    R/DaVy1z1MM=          24    168         des3  <restricted>
    IdpdnIDzOYs=          24    168         des3  <restricted>
    SeVASW8PrOc=          24    168         des3  <restricted>
    c6Ml/9I7thQ=          24    168         des3  <restricted>Edited by: dstutz on May 15, 2008 12:28 PM
    Edit again:
    I changed the mode in the cfg file to fips and used modutil to change module to fips mode and it still works...all the keys I created in keystore mode are still there and I can add new ones.
    C:\nss>symkeyutil -L -d .
    Enter Password or Pin for "NSS FIPS 140-2 Certificate DB":
         Name            Len Strength     Type    Data
    NSS FIPS 140-2 Certificate DB:
    LmsZDBaaCw8=          24    168         des3  <restricted>
    EQaX3wdJ1cY=          24    168         des3  <restricted>
    7i/XoKcaLhU=          24    168         des3  <restricted>
    Yzjt7W+AIgc=          24    168         des3  <restricted>
    RkOTZssCEQM=          24    168         des3  <restricted>
    S2BHRcFUyAA=          24    168         des3  <restricted>
    secretKeyAlias        24    168         des3  <restricted>
    UsY23mwSzEM=          24    168         des3  <restricted>
    B/auMw2OTvE=          24    168         des3  <restricted>
    coqyCAAJpsk=          24    168         des3  <restricted>
    vVBHLg1r3cY=          24    168         des3  <restricted>
    R/DaVy1z1MM=          24    168         des3  <restricted>
    IdpdnIDzOYs=          24    168         des3  <restricted>
    SeVASW8PrOc=          24    168         des3  <restricted>
    c6Ml/9I7thQ=          24    168         des3  <restricted>Edited by: dstutz on May 15, 2008 12:56 PM

  • PKCS#11 provider - ECDSA key pair generation on token

    Hello,
    I want to generate ECDSA key pair on HSM (nCipher's netHSM) using SunPKCS11 provider and Java 6.
    After generation for all supported curve names (e.g. secp256r1) I try to call getEncoding method from PublicKey object (keyPair.getPublic().getEncoded()) and
    I get RuntimeException
    caused by java.io.IOException: "Point does not match field size"
    at sun.security.ec.ECParameters.decodePoint(ECParameters.java:75)
    at sun.security.pkcs11.P11ECKeyFactory.decodePoint(P11ECKeyFactory.java:61)
    at sun.security.pkcs11.P11Key$P11ECPublicKey.fetchValues(P11Key.java:1002)
    Keys are accessible on HSM.
    Everything is well configured and works fine with RSA keys.
    Using IAIK PKCS#11 provider I got proper values. Is it any bug in SunPKCS11 provider?
    Regards,
    MarcinP

    I recently had a problem with ECDSA and the PKCS#11 library of nCipher. Here's info from one of their engineers about the PKCS11 library:
    "There are two separate issues - one is that our current pkcs11
    release doesn't support ECDSA signature with SHA-2 hashes
    (the v11.00 firmware adds support for it, but the main release version of
    the pkcs11 library hasn't been updated to take advantage of it yet).
    There is a hotfix version that does support SHA-2 hashes with some
    restrictions, talk to [email protected] for details, and V11.10
    should be out soon and have that merged in.
    But the issue with setting CKA_SIGN is that our underlying HSM API
    allows elliptic curve keys to be either key exchange (ECDH) or
    signature (ECDSA) keys, but not both at one.
    At the PKCS #11 level, if you specify CKA_DERIVE=true and let
    CKA_SIGN default, it will default to false, and vice versa.
    If you specify both CKA_DERIVE=true and CKA_SIGN=true, then we
    return CKR_TEMPLATE_INCONSISTENT because we can't do both with
    the same key. (However, the tests using C_GetMechanismInfo will
    show that we can do both mechanisms, because we can - so long
    as you use different keys, even though they have the same PKCS#11
    type.)
    I can't comment on when or how that will be changed."
    I was using the PKCS#11 library through NSS when I ran into the problem, but I imagine Java would run into similar problems also using the PKCS#11 library. I was able to generate keypairs but not create a CSR (which required making a signature, which required SHA-2).
    Can you just use the java classes to speak to the netHSM? I've never directly written code to do so myself, but I have used Corestreet's OCSP product that uses the java classes to speak to the nCipher HSMs (though not using EC). It might work better than going through the PKCS#11 layer. There should be a java directory under NFAST_HOME that contains some jars.
    Please post back if you figure anything out as I'll probably be playing with this stuff myself soon.
    Dave

  • Generating RSA keys based on p, q, and public exponent

    Hi,
    The problem is the following. I need to generate an RSA key pair on the card based on pre-defined P, Q and public exponent. The KeyPair specs syas that if the public exponent is pre-initialized it will be retained. All other values are overwritten though (I checked with a test applet on jcop41). So two questions:
    1. Do you know of any card that can also retain p and q and generate (calculate) dp, dq, pq, and public modulus. This is contrary to the specification so I doubt there would be any, but it is always good to ask.
    2. Do any of you have a Java code that would do this (ie. calculate the missing key components) that can be run on Java Card, ie. does not use BigInteger or similar classes.
    Cheers,
    Woj

    That is exactly the point I was trying to make, I actually forgot about this thread, because the problem at hand went on the shelf for the moment. To reformulate:
    1. I have only certain parts of the RSA key, but enough parts to determine a valid private/public key pair.
    2. Now I want to generate the missing parts on the card. The JC API requires all the parts to be supplied, it is not possible to provide only partial (but determining the whole key) key information. The KeyPair class can only retain the public exponent during key generation, but not the other parts (according to the specs and my own tests).
    3. My wild guess is that it would probably be doable without too much hassle with host JCE, but it's not an option for me, it has to be done on the card.
    4. I could try to write my own Java Card code that would do this based on, say, openssl implementation, but now I am too lazy, so that's why I asked if somebody possibly has the code that does this.
    Cheers,
    Woj

  • Generate SSRS Report and save as PDF in SharePoint

    Hi,
    I am working on a SharePoint 2010 Visual WebPart that lets a user click a button to generata a SSRS report and save the report in a SharePoint Library as a PDF file.  Code is mentioned below:
    try
    string siteContext = SPContext.Current.Web.Url;
    string strReport = siteContext + "/Reports/Quote/Quote.rdl";
    WR_SSRS.ReportExecutionService rs = new WR_SSRS.ReportExecutionService();
    rs.Url = siteContext + "/_vti_bin/ReportServer/ReportExecution2005.asmx";
    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
    byte[] result;
    string format = "PDF";
    string historyID = null;
    string devInfo = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
    WR_SSRS.ParameterValue[] parameters = new WR_SSRS.ParameterValue[3];
    parameters[0] = new WR_SSRS.ParameterValue();
    parameters[0].Name = "EnqID";
    parameters[0].Value = enqID.ToString();
    parameters[1] = new WR_SSRS.ParameterValue();
    parameters[1].Name = "QuotationID";
    parameters[1].Value = quoteID;
    WR_SSRS.DataSourceCredentials[] credentials = null;
    string showHideToggle;
    string encoding;
    string mimeType;
    WR_SSRS.Warning[] warnings;
    WR_SSRS.ParameterValue[] reportHistoryParameters;
    string[] streamIDs;
    WR_SSRS.ExecutionInfo execInfo = new WR_SSRS.ExecutionInfo();
    WR_SSRS.ExecutionHeader execHeader = new WR_SSRS.ExecutionHeader();
    string SessionId = null;
    string extension;
    rs.ExecutionHeaderValue = execHeader;
    execInfo = rs.LoadReport(strReport, historyID);
    rs.SetExecutionParameters(parameters, "en-gb");
    SessionId = rs.ExecutionHeaderValue.ExecutionID;
    result = rs.Render(format, devInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);
    execInfo = rs.GetExecutionInfo();
    using (SPSite site = new SPSite(SPContext.Current.Site.ID))
    using (SPWeb web = site.OpenWeb())
    web.AllowUnsafeUpdates = true;
    SPFolder folder = web.Folders[siteContext + "/Quotes"];
    string filename = string.Concat(quoteID, ".pdf");
    //remove old copies
    SPList lib = web.Lists["Quotes"];
    foreach (SPListItem i in lib.GetItems())
    if (i.Name == filename)
    i.Delete();
    break;
    SPFile file = folder.Files.Add(filename, result);
    SPListItem item = file.Item;
    item["EnquiryID"] = enqID.ToString();
    item["FinalQuote"] = "No";
    item.Update();
    web.AllowUnsafeUpdates = false;
    catch (Exception ex)
    LogError(ex.Message);
    The WebPart works fine in my local server and even on another development testing server.  However, once deployed to the live server that has claims authentication it stops working and throws an error that says:
    "Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. 
    The request failed with the error message: 
    <RSError xmlns="http://www.microsoft.com/sql/reportingservices"><MoreInformation><Message>An unknown error occurred with the Reporting Services endpoint on this SharePoint site. Contact the SharePoint site administrator for help.</Message></MoreInformation></RSError> 
    If I open the report manually in SharePoint Site, it works fines it even works fine when try to view in a WebPart. 
    Can someone help me with this ?
    Regards, Vikram

    Hi Vicky,
    Based on the error message, it is related to the service account for reporting service.
    If the Report Server service runs under a built-in account such as NetworkService, the Grant database access option in SharePoint Central Administration will not work correctly.
    Configure the service account to run under a domain user account as follows:
    1. Start the Reporting Services Configuration tool and connect to the report server.
    2. On the Service Account page, click Use another account, enter a domain user account, and click Apply.
    3. Click Web Service Identity, for Report Server, click New, type an application Restart the Report Server service.
    Here is a detailed MSDN article for your reference:
    http://msdn.microsoft.com/en-us/library/ms159704.aspx
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Trying to generate secure rpc key pairs with java

    I see a couple of different classes that will generate public private key pairs in various algorithms for me but it doesn't appear that I can supply a pass phrase to use with these.
    I want to write java code that will create a NIS+ secureRPC key pair for me.
    thanks.

    See now this is a really good question. I don't have an answer, but I really like seeing these types of questions here

  • CF 9.0.2 and Oracle - On update returns error "Auto-generated keys were not requested..."

    We have a simple update statement to Oracle 11g Database. When running the statement the data is not getting updated and we are getting an error "Auto-generated keys were not requested, or the SQL was not a simple INSERT statement. ErrorCode=0 SQLState=HY000". We found this error by dumping the SQL to a file.
    But most other Update statements are working fine.
    Also, the same statment works for Oracle 10g and Coldfusion 9.0.0.
    Any idea if this is a problem with Coldfusion or Oracle? Is there any resolution.
    I found the CF 8 had a similar issue and was fixed in a hotfix (http://helpx.adobe.com/coldfusion/kb/error-auto-generated-keys-requested.html).

    Hi,
    Thanks. I compiled my code using JDeveloper 10.1.2, didn't dare to use the latest. It works in 10g apps server. When I deployed to 9ias apps server, those weird errors showed up. Unfornately, our dev environment is at a newer version than the production one.
    So, you think the error is generated because I referenced some newer technologies that was not provided by 9ias?
    Jia

  • Generate check thorugh other payment method and multiple bank keys

    I have around 20000 vendor (3 rd party company) for one company code, each using different vendor bank branch and sub-branch. Do I need to create 20000 bank keys or should I use account holder name to indicate different bank and branch. or there are other solution?
    for one vendor, it is a company, I maintain payment method G (giro, local wire)in LFB1, I run F110, select that vendor and payment method G, but system generate paylink check, but according to my understanding, system will only generate check if we use payment method C, how can system generate check with payment method G?
    Edited by: sivkumr on Jun 19, 2011 4:25 AM

    Hi
    Check the payment method details in Country in FBZP. According to my understanding there is a radio button to define a method as cheque payment.
    Thanks
    Nikhil

  • Generate and Save PDF / Append Filename with Username

    When you select a row to download as PDF in FormsCentral response table, and Save As dialog box appears, it would be nice if it appended the filename so we don't have to do this ourselves everytime.  If you forget to append the filename it will use the generic name and overwrite the previously saved file with generic name.  Seems like something Adobe could have easily programmed in, but failed to do so.

    btw:
    Timestamp would mean nothing to me when I receive 200 job applications and can't identify the applicant by filename.  It would look like gibberish at that point.  Also, you can add the option upfront to concatenate fields so later the filenames are appended with 2 fields (for example) that are selected by the form creator as part of designing the form.  In that case, whether it's a survey with 5 generic questions or a 50 question job application, each set of filenames would be unique in its own scenario.

Maybe you are looking for