Problems using different tables for base class and derived class

I have a class named SuperProject and another class Project derived from
it. If I let SchemaTool generate the tables without specifying a "table"
extension, I get a single TABLE with all the columns from both classes and
everything works fine. But if I specify a "table" for the derived class,
SchemaTool generates the derived class with just one column (corresponds
to the attribute in derived class). Also it causes problems in using the
Project class in collection attributes.
JDO file:
<jdo>
<package name="jdo">
<class name="Project" identity-type="application"
persistence-capable-superclass="SuperProject">
<extension vendor-name="kodo" key="table" value="PROJECT"/>
</class>
<class name="SuperProject" identity-type="application"
objectid-class="ProjectId">
<field name="id" primary-key="true"/>
</class>
</package>
</jdo>
java classes:
public class Project extends SuperProject
String projectSpecific
public class SuperProject
BigDecimal id;
String name;
tables generated by SchemaTool:
TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
TABLE PROJECT(PROJECTSPECIFICX)
Thanks,
Justine Thomas

Justine,
This will be resolved in 2.3.4, to be released later this evening.
-Patrick
In article <aofo2q$mih$[email protected]>, Justine Thomas wrote:
I have a class named SuperProject and another class Project derived from
it. If I let SchemaTool generate the tables without specifying a "table"
extension, I get a single TABLE with all the columns from both classes and
everything works fine. But if I specify a "table" for the derived class,
SchemaTool generates the derived class with just one column (corresponds
to the attribute in derived class). Also it causes problems in using the
Project class in collection attributes.
JDO file:
<jdo>
<package name="jdo">
<class name="Project" identity-type="application"
persistence-capable-superclass="SuperProject">
<extension vendor-name="kodo" key="table" value="PROJECT"/>
</class>
<class name="SuperProject" identity-type="application"
objectid-class="ProjectId">
<field name="id" primary-key="true"/>
</class>
</package>
</jdo>
java classes:
public class Project extends SuperProject
String projectSpecific
public class SuperProject
BigDecimal id;
String name;
tables generated by SchemaTool:
TABLE SUPERPROJECTSX (IDX, JDOCLASSX, JDOLOCKX, NAMEX);
TABLE PROJECT(PROJECTSPECIFICX)
Thanks,
Justine Thomas
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • Using different templates for the desktop and phone versions of the same blog

    I have a site which was created in Adobe Muse and is hosted on Business Catalyst.
    I have created both a desktop and a phone versions of the site.
    I  want to know how I can integrate the blogs that I  currently have on the desktop site with the phone version that I just did, using different templates for the desktop and phone versions of the same blog. This is in order to ensure that visitors to the blogs on the website are directed to the templates that render correctly for the devices they are using.
    My current approach has been to create both a desktop and phone versions of the blogs. The problem with this however, is that the dates are different and the comments are separated between the two blog versions!
    I  have also tried enabling mobile templates in BC, but still couldn't find a way to specify the mobile versions of the templates for the same blog?
    To recap my problem, I basically  need a solution where the same blog uses different templates for desktop and mobile (both templates use different navigation headings and menu styles)
    Thanks.

    There can be few reason for this, including page contents links or contents used in phone/tablet version.
    Please provide the site url , also try to publish the site as a trial site in Business Catalyst with all layouts which would help to isolate the issue.
    Thanks,
    Sanjit

  • CSS problem using different folders for different files

    So I am trying to organize my files into different sections
    so that updating will be easier in the future. However right now,
    when I create a file in a new folder, my drop downs quit working on
    the files inside the folder and some of my css (mainly the css in
    my IE conditional statements). My drop downs do work if I put a
    copy of the css that controls the drop downs into that folder. The
    thing is, if I ever want to update the css, I want to update it in
    only one spot rather than in ever folder that I had to copy it
    into. How do I get my folder files to work from the css files that
    I created inside my local root folder?

    I managed to slove this by creating symbolic link to the new location on filesystem.
    I was hoping there was some more elegant solution for moving backup sets.
    Thanks,
    -- dragisa
    Ok I understood you. You have to restore your backup
    sets in the same location where RMAN backuped them
    because that information is stored in the catalog.
    In fact, if you remove the backup sets from the disk
    , they get "Expired Status" and if you restore them
    to disk the status is going to be "Available". Test
    it!!!
    To carry out this you have to use crosscheck
    command.
    Joel Pérez

  • How can i use different suffix for read-only and read-write?

    I have a directory server with 11.1.1.5,I have created the root dn:o=test.com.cn. This dn is replication enabled and it is the consumer.
    I want to create another suffix:ou=test1,o=test.com.cn and I wish to write some data from own.
    However,when I use dscc to create the suffix,I can not find any entry under the suffix.
    When I use the command:
    ldapsearch -b "ou=test1,o=test.com.cn" -s sub "objectclass=*"
    I get this:ldap_search:no such object
    I can not import any ldif to this suffix.
    I get the error:
    import test1: WARNING: Skipping entry "uid=jwalker, ou=People, ou=test1,o=test.com.cn" which has no parent, ending at line 280 of file "/opt/dsinst/test1.ldif"
    When I use dscc to change the suffix to rootdn,I get the same error too.
    How can i do now?
    Thank u very much.

    There are a few issues here, ie
    "uid=jwalker, ou=People, ou=test1,o=test.com.cn" has no parent.
    Did you create ou=People, ou=test1,o=test.com.cn before you tried to create above dn?
    Also, your suffix naming is very poor and will result in more problems later on especially since you want to create sub suffices.
    you should use the DC notation, ie dc=test,dc=com,dc=cn that way you can easily attach o=test1,dc=test,dc=com,dc=cn
    This way you would be able to keep your separate suffices inside separate database files and you will have less headaches when you try to replicate and do bulk re-initialisations.

  • My wife and I share an iCloud account for photo library and iCloud drive mainly for our family photo management, but we use different accounts for iMessage/facetime/calendar/etc. With Yosemite, I can't use continuity/handoff without dumping the photo

    my wife and I share an iCloud account for photo library and iCloud drive mainly for our family photo management, but we use different accounts for iMessage/facetime/calendar/etc. With Yosemite, I can't use continuity/handoff without dumping the primary photo iCloud account and thus our shared photo system. We are running yosemite OS X 10.10 and iOS 8.0.2... Is there any way to do this?

    my wife and I share an iCloud account for photo library and iCloud drive mainly for our family photo management, but we use different accounts for iMessage/facetime/calendar/etc. With Yosemite, I can't use continuity/handoff without dumping the primary photo iCloud account and thus our shared photo system. We are running yosemite OS X 10.10 and iOS 8.0.2... Is there any way to do this?

  • Can I use a domain for one site and mobile me for a different site?

    Can I use a domain for one site and mobile me for a different site?
    I have two sites, I would like to have up and I would like to do one through a domain and one through mobileme is this possible?

    Yes you can. You can use the CNAME method of forwarding for the first site (the top site in iWeb) and use the MMe URL for your account for the other site: http://web.me.com/YourAccount_Name/SiteName/
    OT

  • How to use different iViews for variables and queries?

    Hi all!
    I need to use separtate iViews for storing variables and extracting queries.
    For example, I have one variable "Currency" for two different queries,  and I need that all of these queries (in separate iViews) would use the value of currency was put by user in the first iView with only one input.
    How can I do this task? Is it possible at all?
    Thanks for replies.

    Hello Alex,
    You have to use EP client framework (EPCF) in your development.
    I hope this idea will help you.
    Kind regards, Pino.

  • Reg:Table for Custom Messages and custom Messaege Classes

    Hi ,
    My requirement is to find out all custom messages . so can any one tell in which tables all custom messages and custom message classes are stored .
    Thanks & Regards,
    Lakshmi.

    hi,
    You can checkthese tables listed below,
      T100                             Messages
      T100A                            Message IDs for T100
      T100C                            Message Control by User
      T100O                            Assignment of message to object
      T100S                            Configurable system messages
      T100SA                           Application Areas for Configurable Messages
      T100T                            Table T100A text
      T100U                            Last person to change messages
      T100V                            Assignment of messages to tables/views
      T100W                            Assign Messages to Workflow
      T100X                            Error Messages: Supplements
      T100ARBGB                    Application Area
    But The main table for storing all the message classes and their numbers are stored in table
    T100

  • Tables for development class and Message Class

    Hi All,
    In which table is Message Class and Development class stored.
    Thanks,
    Santosh

    Hi All,
    I am closing this thread..I was looking for a single table which does this and it is TADIR with object = MSAG
    Thanks,
    Santosh
    Edited by: Santosh Kumar KezkhepatMelathil on Aug 29, 2008 1:32 PM

  • Can i use create function for MSSql scalar and table valude function.

    Hi,
    1) Can i use create function for MSSql scalar and table valued function?
    2) How many type of user defined function are there in oracle 11g express?
    3) And can i reture any "type" form user defined function?
    yourse sincerely

    944768 wrote:
    Q1)That means even if i return predefined types like integer, varchar2 then also PGA is used ?The data type does not determine where the variable is stored. A string (called a varchar2 in Oracle) can be stored in stack space, heap space, on disk, in a memory mapped file, in a shared memory, in an atom table, etc.
    It is the who and what is defining and using that string, that determines where and how it is stored.
    The Oracle sever supports 2 languages in PL/SQL. The PL (Programming Logic) language is a procedural/declarative language. It is NOT SQL. SQL is integrated with it. The PL/SQL engine uses private process memory (PGA). So PL/SQL variables exist in the PGA (but there are exceptions such as LOBs).
    Q2) So please suggest me solution in oracle.Sounds to me you are looking at how to implement a T-SQL style function as an Oracle function, and once implemented, do joins on the function.
    Do not use PL/SQL in SQL in place of a SQL select. It is not T-SQL.
    One cannot use PL/SQL to create functions along the style of T-SQL, where the function executes a SQL using some conditional logic, and then return as if the function was a native SQL select.
    T-SQL is an extension to the SQL language - making it a hybrid and very impure language implementation. PL is based on ADA - part of the Pascal family of languages. The E-SQL (embedded SQL) approach used in languages like C/C++, Cobol and Ada, has been transparently done in PL/SQL. You can write and mix PL code and variables with SQL code. And the PL/SQL engine figures out how to make the call from the PL/SQL engine to the SQL engine.
    But PL/SQL is not "part" of the SQL language and does not "extend" the SQL language in a T-SQL fashion.
    So you need to check your SQL-Server preconcepts in at the door, as they are not only irrelevant in Oracle, they are WRONG in Oracle.
    The correct way in Oracle, in a nutshell - Use the SQL language to do data processing. Use PL/SQL to manage conditional process flow and the handling of errors.

  • HT201371 In the next ios update, could we get the fingerprint function to unlock the phone and open up different apps in one swipe, using different fingers for different apps?

    In the next ios update, could we get the fingerprint function to unlock the phone and open up different apps in one swipe, using different fingers for different apps?

    This is primarily a user-to-user support forum. Following is a link for feedback/suggestions to Apple: http://www.apple.com/feedback/

  • APO DP - use of tables for selections and notes

    I am using APO DP V5.
    I note that tables for holding selections and notes are planning area specific and have tables names such as /1APO/S1nnnnnnnn and /1APO/F1nnnnnnnn respectively.
    My questions:
    1. What is the logic for the naming of these tables
    2. For a given planning area, are the tables names the same as one moves from Development to QA to Production environments
    Thanks,
    Bob Austin

    Bob
    I think the answer for the notes part of this question is here. The logic for the selections should be the same
    Re: Updating of Notes for cells in APO DP
    The table names might not be the same in QA since they are created independently and dynamically. But one way to check is to try it out

  • HT1414 my ipod wont charge and i have used different chargers for it is it possible to reset it while its dead?

    my ipod wont charge and i have used different chargers for it is it possible to reset it while its dead?

    I do not know what you mean by charger. Cable?
    Not Charge
    - See:      
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable. Some 5G iPods were shipped with Lightning cable that were either initially defective or failed after short use.
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar                          

  • My iPhone 4 getting off automatically while battery 60% or more and turn on when i plug in please advice it is battery problem or hardware i use this mobile for 2 years and 3 month.

    My iPhone 4 getting off automatically while battery 60% or more and turn on when i plug in please advice it is battery problem or hardware i use this mobile for 2 years and 3 month.
    Thanking you.

    1.  you may have to take it in to Apple and get an out of warranty iphone for $199.
    2.  you can get your information from a backup of your phone.  you do have a backup of your phone right either in iTunes or icloud.  If you don't then your answer will be no.

  • Problem using SmartCard with 2 Certificates stored and SunPKCS11

    Hi,
    I'm trying to access one SmartCard token in Java 1.5 using SunPKCS11 provider for crypt, decrypt and digital signature operations.
    I have 2 certificates stored on Token:
    - CertA;
    - CertB.
    There are also 2 PIN:
    - PIN1;
    - PIN2.
    I use:
    - PIN1 for logging into the token;
    - PIN1 for operation involving CertA;
    - PIN2 for operation involving CertB;
    There is no problem to logging into the token using Java and, without any troubles, I can read certificates and key from the
    cryptographic card.
    There is no problem using CertA for all my operation, but every attempt of using Private Key of CertB (for the same operations) returns with an Exception:
    java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DEVICE_ERROR
    Here there's an extract of my source code.
    public void loginToken() {
    Provider UserProvider = new sun.security.pkcs11.SunPKCS11(C:\\pkcs11.cfg);
    Security.addProvider(UserProvider);
    try {
    KeyStore ks = null;
    X509Certificate UserCert = null;
    PrivateKey UserCertPrivKey = null;
    PublicKey UserCertPubKey = null;
    //PIN
    char PIN1[] = "11111".toCharArray();
    char PIN2[] = "22222".toCharArray();
    //logging into token
    ks = KeyStore.getInstance("PKCS11", UserProvider);
    ks.load(null, PIN1);
    //enumeration alias
    String alias = "";
    Enumeration e = ks.aliases();
    while (e.hasMoreElements()) {
    alias = (String) e.nextElement();
    //Certificate
    UserCert = (X509Certificate) ks.getCertificate(alias);
    //PublicKey
    UserCertPubKey = (PublicKey) ks.getCertificate(alias).getPublicKey();
    if (alias.compareToIgnoreCase("Cert1") == 0) {
         //PrivateKey reference     
    UserCertPrivKey = (PrivateKey) ks.getKey(alias, PIN1);
    } else if (alias.compareToIgnoreCase("Cert2") == 0) {
    //PrivateKey reference
    UserCertPrivKey = (PrivateKey) ks.getKey(alias, PIN2);
    } else {
    System.out.println("ALIAS UNKNOW");
    System.exit(1);
    //Signature Test
    if (!MakeSignature(UserCertPrivKey, UserProvider))
    System.out.println(" *** SIGNATURE OK *** ");
    else
    System.out.println(" *** SIGNATURE KO *** ");
    catch (Exception ex) {
    System.out.println("ERROR: " + ex);
    public boolean MakeSign(PrivateKey PrivKey, Provider p) {
    try {
    //File I/O
    FileInputStream txtfis = new FileInputStream("C:\\Test.txt");
    FileOutputStream sigfos = new FileOutputStream("C:\\Test_Signature.txt");
    //Signature Obj init
    Signature dsa = Signature.getInstance("SHA1withRSA", p.getName());
    dsa.initSign(PrivKey);
    //Update data
    BufferedInputStream bufin = new BufferedInputStream(txtfis);
    byte[] buffer = new byte[1024];
    int len;
    while (bufin.available() != 0) {
    len = bufin.read(buffer);
    dsa.update(buffer, 0, len);
    bufin.close();
    //Make signature
    byte[] realSig = dsa.sign();
    //save signature on file
    sigfos.write(realSig);
    sigfos.close();
    return true;
    catch (Exception ex) {
    System.out.println("ERROR: " + ex);
    return false;
    Any help would be grateful...
    Thanks in advance.
    P.S. Sorry for my English

    This is the same my initial problem.
    I resolved it using IAIK-PKCS#11Wrapper (it is FREE) insted of sun.security.pkcs11.SunPKCS11.
    You can find it here:
    http://jce.iaik.tugraz.at/sic/products/core_crypto_toolkits/pkcs_11_wrapper
    Here an exemple of code.
    The main class:
    import iaik.pkcs.pkcs11.Module;
    import iaik.pkcs.pkcs11.DefaultInitializeArgs;
    import java.util.Hashtable;
    import iaik.pkcs.pkcs11.Token;
    import iaik.pkcs.pkcs11.Slot;
    import iaik.pkcs.pkcs11.Session;
    import iaik.pkcs.pkcs11.objects.RSAPrivateKey;
    import java.util.Vector;
    import iaik.pkcs.pkcs11.objects.PrivateKey;
    import iaik.pkcs.pkcs11.objects.X509PublicKeyCertificate;
    import java.util.Enumeration;
    import iaik.pkcs.pkcs11.objects.Key;
    import java.security.cert.CertificateFactory;
    import java.io.ByteArrayInputStream;
    import iaik.pkcs.pkcs11.Mechanism;
    import java.security.Security;
    import org.bouncycastle.jce.provider.BouncyCastleProvider;
    import java.io.File;
    import java.io.FileInputStream;
    import org.bouncycastle.cms.CMSSignedDataGenerator;
    import org.bouncycastle.cms.CMSProcessableByteArray;
    import java.util.ArrayList;
    import java.security.cert.CertStore;
    import java.security.cert.CollectionCertStoreParameters;
    import org.bouncycastle.cms.CMSSignedData;
    import java.io.FileOutputStream;
    import java.security.cert.X509Certificate;
    import iaik.pkcs.pkcs11.TokenInfo;
    import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
    public class MakeSignature {
      public static void main(String[] args) {
         String USER_PIN = "12345678";
         String DLL_NAME = "C:\\windows\\system32\\dll_P11_name.dll";
         String OBJ_LABEL1 = "CNS0"; //this is the label of my 1th cert
         String OBJ_LABEL2 = "CNS1"; //this is the label of my 2th cert
         String INPUT_FILE = "C:\\Temp\\test.txt";
         String OUTPUT_FILE = "C:\\Temp\\test.p7m";
        try {
           // ********** INITIALIZE PKCS#11 MODULE WITH DEFAULT PARAMETERS **********
          Module pkcs11Module = Module.getInstance(DLL_NAME);
          pkcs11Module.initialize(new DefaultInitializeArgs());
           // ********** SELECT TOKEN **********
          Slot[] slotsWithToken = pkcs11Module.getSlotList(Module.SlotRequirement.TOKEN_PRESENT);
          Token[] tokens = new Token[slotsWithToken.length];
          Hashtable tokenIDtoToken = new Hashtable(tokens.length);
          long tokenID = -1;
          Token tokenUsed = null;
          //enum readers
          for (int i = 0; i < slotsWithToken.length; i++) {
            tokens[i] = slotsWithToken.getToken();
    tokenID = tokens[i].getTokenID();
    tokenIDtoToken.put(new Long(tokenID), tokens[i]);
    System.out.println("Active tokens:");
    System.out.println("Token ID: " + tokenID);
    if (tokens.length == 0) { //No SC found
    System.out.println("No SC presents");
    else {
    System.out.println("Using token: " + tokens[0].getTokenID());
    tokenUsed = tokens[0];
         //Note: if you have more reader and more SC inserted, you have to write
         //here the code for select the right token
         // ********** OPEN SESSION VS THE TOKEN AND IF REQUIRED SUBMIT PIN **********
    TokenInfo tokenInfo = tokenUsed.getTokenInfo();
    Session session = tokenUsed.openSession(Token.SessionType.SERIAL_SESSION, false, null, null);
    if (tokenInfo.isLoginRequired()) {
    session.login(Session.UserType.USER, USER_PIN.toCharArray());
         // ********** SET SEARCH TEMPLATE FOR THE P11 OBJECT **********
    RSAPrivateKey privateSignatureKeyTemplate = new RSAPrivateKey();
    privateSignatureKeyTemplate.getSign().setBooleanValue(Boolean.TRUE);
    privateSignatureKeyTemplate.getLabel().setCharArrayValue(OBJ_LABEL2.toCharArray());
         // ********** SEARCH P11 OBJECT USING TEMPLATE **********
    Vector keyList = new Vector(4);
    session.findObjectsInit(privateSignatureKeyTemplate);
    Object[] matchingKeys;
    while ( (matchingKeys = session.findObjects(1)).length > 0) {
    keyList.addElement(matchingKeys[0]);
    session.findObjectsFinal();
         //Try to find the corresponding certificates for the signature keys
    Hashtable keyToCertificateTable = new Hashtable(4);
    Enumeration keyListEnumeration = keyList.elements();
    while (keyListEnumeration.hasMoreElements()) {
    PrivateKey signatureKey = (PrivateKey) keyListEnumeration.nextElement();
    byte[] keyID = signatureKey.getId().getByteArrayValue();
    X509PublicKeyCertificate certificateTemplate = new X509PublicKeyCertificate();
    certificateTemplate.getId().setByteArrayValue(keyID);
    session.findObjectsInit(certificateTemplate);
    Object[] correspondingCertificates = session.findObjects(1);
    if (correspondingCertificates.length > 0) {
    keyToCertificateTable.put(signatureKey, correspondingCertificates[0]);
    session.findObjectsFinal();
         //There are three cases now: 1 no obj found; 2 found only one obj, 3 found more obj
    Key selectedKey = null;
    X509PublicKeyCertificate correspondingCertificate = null;
    //no object found for template
    if (keyList.size() == 0) {
    System.out.println("No object found for template");
    throw new Exception("No object found for template");
    //Founf only one object
    else if (keyList.size() == 1) {
    selectedKey = (Key) keyList.elementAt(0);
    // create a IAIK JCE certificate from the PKCS11 certificate
              correspondingCertificate = (X509PublicKeyCertificate)keyToCertificateTable.get(selectedKey);
    System.out.println("One object Found");
    //Found more object ... user can select one
    else {
         System.out.println("Many obj found!!!");
    //write here the code for select the right object
         // ********** GET THE OBJECT **********
    RSAPrivateKey signerPriKey = (RSAPrivateKey) selectedKey;
    java.security.cert.CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
    byte[] derEncodedCertificate = correspondingCertificate.getValue().getByteArrayValue();
    //Cast to java.security.cert.X509Certificate
    java.security.cert.X509Certificate signerCert = (java.security.cert.X509Certificate) certificateFactory.
    generateCertificate(new ByteArrayInputStream(derEncodedCertificate));
         // ********** SIGNATURE OPERATION **********
    //Add BouncyCastle as provider
    Security.addProvider(new BouncyCastleProvider());
    //initialize signature operation
    session.signInit(Mechanism.RSA_PKCS, (PrivateKey) signerPriKey);
    //get input data
    File src = new File(INPUT_FILE);
    int sizecontent = ( (int) src.length());
    byte[] contentData = new byte[sizecontent];
    FileInputStream freader = new FileInputStream(src);
    freader.read(contentData, 0, sizecontent);
    freader.close();
         //calculate digest of the input data
    byte[] toEncrypt = buildBits(contentData); //I've already posted the code for this function
    //make signature
    byte[] signature = session.sign(toEncrypt);
         // ********** MAKE P7 WELL FORMAT DOCUMENT **********
    //CMSSignedDataGenerator fact = new CMSSignedDataGenerator();
    Signature2CMSSignedData fact = new Signature2CMSSignedData();
    CMSProcessableByteArray content = new CMSProcessableByteArray(contentData);
    //Creation of BC CertStore
    ArrayList certList = new ArrayList();
    certList.add(signerCert);
    CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), "BC");
    //Signature Alg
    String algorithm = CMSSignedDataGenerator.DIGEST_SHA1;
    //add element to P7
    fact.addSignature(signature, signerCert, algorithm);
    fact.addCertificatesAndCRLs(certs);
    //generate enveloped using Bouncycastle provider
         CMSSignedData envdata = fact.generate(PKCSObjectIdentifiers.data.getId(), content, true);
    byte[] enveloped = envdata.getEncoded();
    //Write P7 file
    FileOutputStream efos = new FileOutputStream(OUTPUT_FILE);
    efos.write(enveloped);
    efos.close();
    // ********** END **********
    session.closeSession();
    pkcs11Module.finalize(null);
    catch (Exception ex) {
    ex.printStackTrace();
    }Main class uses buildBits function (already posted in this topic) and Signature2CMSSignedData class.import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import java.security.cert.CertStore;
    import java.security.cert.X509CRL;
    import java.security.cert.X509Certificate;
    import org.bouncycastle.asn1.ASN1EncodableVector;
    import org.bouncycastle.asn1.ASN1InputStream;
    import org.bouncycastle.asn1.ASN1OctetString;
    import org.bouncycastle.asn1.ASN1Sequence;
    import org.bouncycastle.asn1.ASN1Set;
    import org.bouncycastle.asn1.BERConstructedOctetString;
    import org.bouncycastle.asn1.DEREncodable;
    import org.bouncycastle.asn1.DERNull;
    import org.bouncycastle.asn1.DERObject;
    import org.bouncycastle.asn1.DERObjectIdentifier;
    import org.bouncycastle.asn1.DEROctetString;
    import org.bouncycastle.asn1.DERSet;
    import org.bouncycastle.asn1.cms.ContentInfo;
    import org.bouncycastle.asn1.cms.IssuerAndSerialNumber;
    import org.bouncycastle.asn1.cms.SignedData;
    import org.bouncycastle.asn1.cms.SignerIdentifier;
    import org.bouncycastle.asn1.cms.SignerInfo;
    import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
    import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
    import org.bouncycastle.asn1.x509.CertificateList;
    import org.bouncycastle.asn1.x509.TBSCertificateStructure;
    import org.bouncycastle.asn1.x509.X509CertificateStructure;
    import org.bouncycastle.cms.CMSProcessable;
    import org.bouncycastle.cms.CMSSignedData;
    * class for generating a RSA pkcs7-signature message.
    public class Signature2CMSSignedData2 {
    CertStore certStore;
    List certs = new ArrayList();
    List crls = new ArrayList();
    List signerInfs = new ArrayList();
    List signers = new ArrayList();
    public static final String DATA = PKCSObjectIdentifiers.data.getId();
    public static final String ENCRYPTION_RSA = "1.2.840.113549.1.1.1";
    private byte[] signatureData = null;
    private X509Certificate cert = null;
    private String digestOID = null;
    private String encOID = null;
    public Signature2CMSSignedData2() {
    public void addSignature(byte[] signatureData, X509Certificate cert, String digestOID) {
    this.signatureData = signatureData;
    this.cert = cert;
    this.digestOID = digestOID;
    this.encOID = ENCRYPTION_RSA;
    public void addCertificatesAndCRLs(CertStore certStore) throws Exception{
    try {
    Iterator it = certStore.getCertificates(null).iterator();
    while (it.hasNext()) {
    X509Certificate c = (X509Certificate) it.next();
    certs.add(new X509CertificateStructure((ASN1Sequence) makeObj(c.getEncoded())));
    Iterator it2 = certStore.getCRLs(null).iterator();
    while (it2.hasNext()) {
    X509CRL c = (X509CRL) it2.next();
    crls.add(new CertificateList((ASN1Sequence) makeObj(c.getEncoded())));
    catch (Exception e) {
    throw new Exception(e.getMessage());
    private DERObject makeObj(byte[] encoding) throws Exception {
    if (encoding == null) {
    return null;
    ByteArrayInputStream bIn = new ByteArrayInputStream(encoding);
    ASN1InputStream aIn = new ASN1InputStream(bIn);
    return aIn.readObject();
    public CMSSignedData generate(String signedContentType, CMSProcessable content, boolean encapsulate) throws Exception {
    try {
    ASN1EncodableVector digestAlgs = new ASN1EncodableVector();
    ASN1EncodableVector signerInfos = new ASN1EncodableVector();
    DERObjectIdentifier contentTypeOID = new DERObjectIdentifier(signedContentType);
    // add the SignerInfo objects
    Iterator it = signerInfs.iterator();
    AlgorithmIdentifier digAlgId = new AlgorithmIdentifier(new DERObjectIdentifier(digestOID), new DERNull());
    AlgorithmIdentifier encAlgId;
    encAlgId = new AlgorithmIdentifier(new DERObjectIdentifier(encOID), new DERNull());
    digestAlgs.add(digAlgId);
    ASN1Set signedAttr = null;
    ASN1Set unsignedAttr = null;
    ASN1OctetString encDigest = new DEROctetString(signatureData);
    ByteArrayInputStream bIn = new ByteArrayInputStream(cert.getTBSCertificate());
    ASN1InputStream aIn = new ASN1InputStream(bIn);
    TBSCertificateStructure tbs = TBSCertificateStructure.getInstance(aIn.readObject());
    IssuerAndSerialNumber encSid = new IssuerAndSerialNumber(tbs.getIssuer(), tbs.getSerialNumber().getValue());
    signerInfos.add(new SignerInfo(new SignerIdentifier(encSid), digAlgId, signedAttr, encAlgId, encDigest, unsignedAttr));
    ASN1Set certificates = null;
    if (certs.size() != 0) {
    ASN1EncodableVector v = new ASN1EncodableVector();
    it = certs.iterator();
    while (it.hasNext()) {
    v.add( (DEREncodable) it.next());
    certificates = new DERSet(v);
    ASN1Set certrevlist = null;
    if (crls.size() != 0) {
    ASN1EncodableVector v = new ASN1EncodableVector();
    it = crls.iterator();
    while (it.hasNext()) {
    v.add( (DEREncodable) it.next());
    certrevlist = new DERSet(v);
    ContentInfo encInfo;
    if (encapsulate) {
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    content.write(bOut);
    ASN1OctetString octs = new BERConstructedOctetString(bOut.toByteArray());
    encInfo = new ContentInfo(contentTypeOID, octs);
    else {
    encInfo = new ContentInfo(contentTypeOID, null);
    SignedData sd = new SignedData(new DERSet(digestAlgs), encInfo, certificates, certrevlist, new DERSet(signerInfos));
    ContentInfo contentInfo = new ContentInfo(PKCSObjectIdentifiers.signedData, sd);
    return new CMSSignedData(content, contentInfo);
    catch (Exception e) {
    throw new Exception(e.getMessage());
    }Bye.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

Maybe you are looking for

  • Data Federator on Unix - Need to connect to Informix

    Hi, We are planning to Deploy Data Federator in Linux - SuSE 64 bit environment. We also have a need to connect to Informix and Teradata databases. According to the supported platforms document, only ODBC drivers are available to connect to Informix

  • Problem with Stub-Check-Stub in PLD

    I'm trying to format the Stub-Check-Stub Print Layout in checks for payment to fit the existing A/P checks a client has.  The top stub is fine but the check and second stub print too low.  I want to adjust the Height of the repetitiveFooterzer.  I ch

  • I need a Photoshop CS5 Extended Disk.

    I purchased Photoshop CS5 Extended in 2010, and I have my key.  I lost my disk, and it is stopping me from upgrading my computer or replacing it because I can't reload Photoshop.  The person I talked to at Adobe told me that they only thing they coul

  • Class and characterstics validation

    Posted: Mon Apr 17, 2006 12:22 pm    Post subject: Class and characterstics varification   Hi All, I want to validate the following for a material 1.class type 2.class number 3.characterstic name 4.characterstic values Could any one of you guide me w

  • Migration on windows server 2003 to 2012 r2 by using IIS 6.0 what are parameters are changed means supported and non suported parameters and configurations?

    In my project am going to migrate windows server 2003 to 2012 r2 by using IIS 6.0? what are the parameters are changed and what are the parameters are not supported and what are the modules need to change? Please give the related answer as soon as po