Case notes - enhancement inability to save notes properly

Hello experts,
we try to save three notes each time a save occurs on a case (UI component: crmcmp_cmg, method eh_onsave after enhanced on view OverviewPage). we use the cmgNoteRel relation of BOL cmgCase to create the notes one by one and insert values to them, and then call super->eh_onsave to save them.
Problem is, it only saves two of these notes, and inconsistently, not the same two every time.
We are not using the Note view of the component because besides the text we enter static data to the "type" and "langu" fields.
Is it possible to save the whole three on save? what is happening behind the scene that prevents it?
Thanks in Advance,
Dekel.

Dekel,
Are you saving the changes after you set the Case notes?
You can use the following to save:
   lv_core = cl_crm_bol_core=>get_instance( ).
   lv_core->modify( ).
Thanks,
Chandra

Similar Messages

  • Outer case not properly closed causing cds not to eject.

    Hi
    I have noticed that the top right hand side of the case is not completely secure. Also the 2 audio ports grey plastic surrounds are cracked so it looks like the back case wasn't put on correctly in the manufacturing stage.
    This causes some cds not to eject on their own, in order to get them out I have to hold the case together.
    The mac is still under warranty but I dont really want to send it off for x amount of weeks, its there anything that I can do?

    I have noticed that the top right hand side of the
    case is not completely secure. Also the 2 audio ports
    grey plastic surrounds are cracked so it looks like
    the back case wasn't put on correctly in the
    manufacturing stage.
    This causes some cds not to eject on their own, in
    order to get them out I have to hold the case
    together.
    The mac is still under warranty but I dont really
    want to send it off for x amount of weeks, its there
    anything that I can do?
    There is nothing that you can do without risking further damage or loss of warranty. Nevertheless, this doesn't sound like any big deal - getting the back re-secured so that you can use your optical drive (the only problem you've noted) is not something that would take "x amount of weeks" but is something that your local AASP could do on the spot in a few minutes. Make an appointment, and take it in. I can't imagine why you'd need to "send it off" anywhere.

  • Hi,  I would like to ask you a question. a month ago I bought a battery case for iPhone 5 and it worked properly until I installed iOS 7. From that day iphone is operating normally, but when the battery is empty, unfortunately I can not charge additionall

    Hi,
    I would like to ask you a question.
    a month ago I bought a battery case for iPhone 5 and it worked properly until I installed iOS 7. From that day my iphone is operating normally, BUT when the battery is empty, unfortunately I can not charge additionally my iphone with the "extra battery case".
    Does that mean that you did not even create a new software that supports additional battery case or it is something else?
    I need your help!!,
    Thank you in advance.
    Sincerely,
    VK

    The Mophie Air is a good battery case, but doesn't offer the protection she's looking for. I suggest sticking to the Lifeproof, the iPhone has a very good battery (2-3 days moderate usage for me).
    To your 2nd to last paragraph, that is false. Verizon is allowing exisiting customers to keep Unlimited Data - but will lose it once they use a subsidized upgrade. So if you buy a 4S (or LTE device for example) outright, you will keep unlimited data. Mobile hotspot may use up a bit of data, but it is a separate add-on/feature. The new Family Share plans may change that, so it's one giant center of data all devices use.

  • Lost my movie? did I not save it properly?

    I've been working on a movie for a couple weeks. Over the weekend, I finished it up, added titles etc. I kept saving the movie under "save project". I just went to open the movie and it doesnt show any of my save work. Could it be saved somewhere else? Did I save it properly? Please help.

    Did you search for the project via Finder/File/Find...?
    Did you backup the project? I always do unless I'm prepared to re-do the whole project from scratch if/when the HD breaks etc.

  • Can not properly view cover flow in full screen in external display

    My mac is the new Mac book pro 15.4 inch screen and I connect my mac pro to external display e.g. Samsung LCD monitor 24 inches.
    The bug is that I can not PROPERLY view full screen (in external display) for some application e.g. iTunes, and Front Row.
    - When I use iTunes, I can not properly view Cover Flow view in full screen (in the external display screen) except the case of mirror display.
    - For Front Row, I can not view full screen in external display but only my mac display.
    However, for other DVD or VDO players, I can view movie on external display in full screen and I still be able to do other works on my mac screen.
    Please let me know how to solve it.

    found the likely issue!  are you participating in youtube's html5 trial?  go here and it will tell you if you are:
    http://www.youtube.com/html5
    exit the trial and it should fix the issue.  it worked for me!

  • String literal is not properly closed by a double-quote

    Hi,
    In my Java Class, this message appears:
    String literal is not properly closed by a double-quote
    LINE: The red part of the statement.
    Please help! Thanks!
    package demo;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    public class Flights {
         private EntityManagerFactory emf;
        private EntityManager getEntityManager() {
            if (emf == null) {
                emf = Persistence.createEntityManagerFactory("Flights");
            return emf.createEntityManager();
        public Flights[] getFlights() {
            EntityManager em = getEntityManager();
            try {
                javax.persistence.Query q = em.createQuery("SELECT /*+ INDEX(lh_master_q lh_master_pk)*/ DISTINCT to_char(FD.FLIGHT_DATE, 'DY')||'.'|| FD.FLIGHT_DATE AS DATE_HEADER,
      FD.FLIGHT_DATE AS TRAVEL_DATE,
      B.CITY                       AS LEAVING,
      LM.STD                       AS DEPART,
      C.CITY                       AS ARRIVING,
      LM.STA                       AS ARR,
      LM.FNR                       AS FLIGHT,
      E.CARRIER                    AS AIRLINE,
      LM.ACTYPE                    AS AIRCRAFT,
      LM.ACTYPEFULLNAME            AS EQUIP,
      LM.STD ||' '|| LM.DEP ||' - '|| LM.STA ||' '|| LM.ARR AS SCHEDULE,
      B.CITY ||' - '|| C.CITY AS ROUTE
      MAX(CASE WHEN FA.BOOKING_CLASS = 'S' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS ECONOMY_SAVER,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'H' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS ECONOMY,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'B' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS ECONOMY_FLEXIBLE,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'Z' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS BUSINESS,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'D' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS BUSINESS_FLEXIBLE,
      MAX(CASE WHEN FA.BOOKING_CLASS = 'F' AND p_num_adt > 1 THEN (ROUND(FA.LH_FARE_EUR, 2)* p_num_adt) END) AS FIRST_CLASS
    FROM LH_MASTER_Q LM, LH_FLIGHT_DATE FD, AIRPORTS_LOOKUP B, AIRPORTS_LOOKUP C, CARRIERS E, LH_FARES FA, LH_SERVICE_CLASS SC, LH_CABIN_CLASS CC
    WHERE LM.ROWNR = FD.FLIGHT_LEG_ID
       AND LM.DEP = FA.FROM_AP
       AND LM.ARR = FA.TO_AP
       AND LM.DEP = B.IATA_CODE
       AND LM.ARR = C.IATA_CODE
       AND LM.AL = E.CARRIER_CODE
       AND FA.BOOKING_CLASS = SC.BKG_CLASS_ID
       AND SC.CABIN_CLASS_ID = CC.CABIN_CLASS_ID
       AND LM.ACTYPE = FD.AIRCRAFT_TYPE
       AND B.CITY_CODE = :p_leaving
       AND C.CITY_CODE = :p_arriving
       AND CC.CABIN_CLASS_NAME = :p_class
       AND E.CARRIER = :p_airline
       AND FD.FLIGHT_DATE = :p_outbound
    GROUP BY FD.FLIGHT_DATE,
             to_char(FD.FLIGHT_DATE, 'DY')||'.'|| FD.FLIGHT_DATE,
             B.CITY,
             LM.STD,
             C.CITY,
             LM.STA,
             LM.FNR,
             E.CARRIER,
             LM.ACTYPE,
             LM.ACTYPEFULLNAME,
             LM.STD ||' '|| LM.DEP ||' - '|| LM.STA ||' '|| LM.ARR,
             B.CITY ||' - '|| C.CITY,
             to_char(FD.FLIGHT_DATE, 'DY')
    ORDER BY Depart;");
                return (Flights[]) q.getResultList().toArray(new Flights[0]);
            } finally {
                em.close();
    }

    From the Java specification (http://docs.oracle.com/javase/specs/jls/se5.0/html/lexical.html#3.10.5):
    It is a compile-time error for a line terminator to appear after the opening " and before the closing matching ".
    In other words, string literals cannot span lines.
    You can use the concatenation operator ( + ) to fix this:
    String myLiteral = "A long line " +
    "Another long line " +
    "Another long line, etc.";
    If you're going to ever print out that string literal (like for debugging purposes), it would probably be better to have a return at the end of each line (\n):
    String myLiteral = "A long line\n" +
    "Another long line\n" +
    "Another long line, etc.";
    Edited by: user739461 on Mar 5, 2012 8:10 AM

  • The last version (v 12) of Firefox is not properly localized (eg in sync with the OS/Android locale). The previous versions haven't this issue.

    Hello,
    The last firefox (v12 or 10.0.4) update done through Play Store is not properly localized (in my case french). This is the first time it happens.
    I suppose it is a bug: can you confirm please ?
    Best Regards.

    Tyler is correct that only 10.0.4 is in the Play store currently. Am I correct in assuming that you downloaded 10.0.4 and instead of getting the French version by default, you got English? Could you also tell me if you are able to change your language to French in Firefox mobile by going into Preferences (swipe left and tap the gear button)?
    Thanks,
    Michelle

  • Frequent message that time machine disk not properly ejected

    I am using a 750 GB USB HDD for Time Machine backups.  I am getting frequent pop up message stating that the external drive was not properly ejected when in fact it wasn't ejected at all - on 24/7.  Backups are halted until I click the OK button on the pop up.  This seems to happen when I get back on after the machine wakes up.  I had the same problem with my 2007 iMac (which this machine replaced) and I googled the problem and found that many had the same issue, but couldn't find a solution.

    Thanks for the suggestion, Kappy. Indeed my Energy Saver preferences were set to sleep the Hard Drive whenever possible. I just disabled that. My TM drive has not been kicked out since, but I'll know better in a few days if the problem has been completely solved.
    Fingers crossed.

  • FPGA Compilation Error (Some signals were not properly constrained in the design)

    Attempting to compile even simple FPGA VIs is returning in failure for me, and I'm not sure why. This is on windows 7, 32 bit, Xilinx 14.4, LabView 2013, for sbRIO-9632.
    "Some signals were not properly constrained in the design." in the summary.
    and
    "Failed to load library libPort_ExecLoader.dll because of The specified procedure could not be found." in the Xilinx log.
    Can anyone help? Many thanks!
    Attachments:
    summary.txt ‏1 KB
    XilinxLog.txt ‏17 KB

    Hello everyone !
    I use a cRIO-9103 for my project and I attempted to compile a new VI for the FPGA. The former code compiled without problem, but the new one failed with the error "Some signals were not properly constrained in the design". I read the issue that was given in this topic, but the strange thing is that I just added a while loop in my old program to make my new one. 
    I joined to this message the new programm of the FPGA and the Xilinx log (I use Xilinx 10.1). The While Loop which causes problems is called "Traitement des informations envoyées par la centrale inertielle (IMU)". Can someone save me please ?  ^^
    Thanks !
    Attachments:
    Init_9401.vi ‏279 KB
    XilinxLog 10_05_2014 16_00.txt ‏993 KB

  • SQL Error [ORA-00933: SQL command not properly ended

    I have following installed:
    7.9.6 BI Apps
    10.1.3.4 DAC
    8.6.0 Informatica
    Container JDE Enterprise 9.0
    Out of 211 tasks 69 tasks executed successfully.
    Error in workflow [SDE_JDE_PartyOrganisationDimension_Full].
    I have checked the session log file and understand that there is error with the SQL statement.
    Since it is Pre-built, the workflow should have run properly with correct SQl statement. But in this case it is not working.
    Is it because the SQL statement is too long?
    Any help will be greatly appreciated.
    Part of the log file
    RR_4035 : SQL Error [
    ORA-00933: SQL command not properly ended
    Database driver error...
    Function Name : Execute
    SQL Stmt : SELECT
    F0101.ABAN8,F0101.ABALKY,F0101.ABTAX,F0101.ABALPH,F0101.ABMCU,F0101.ABSIC,F0101.ABAT1, F0101.ABTAXC, F0101.ABATP, F0101.ABATR,F0101.ABEFTB,F0101.ABAC01,
    F0101.ABAC02, F0101.ABAC03, F0101.ABAC04, F0101.ABAC05, F0101.ABAC06, F0101.ABAC07, F0101.ABAC08, F0101.ABAC09, F0101.ABAC10, F0101.ABAC11,
    F0101.ABAC12, F0101.ABAC13, F0101.ABAC14, F0101.ABAC15, F0101.ABAC16, F0101.ABAC17, F0101.ABAC18, F0101.ABAC19, F0101.ABAC20, F0101.ABAC21, F0101.ABAC22, F0101.ABAC23,
    F0101.ABAC24, F0101.ABAC25, F0101.ABAC26, F0101.ABAC27, F0101.ABAC28, F0101.ABAC29, F0101.ABAC30,F0101.ABUSER, F0101.ABUPMJ,F0101.ABUPMT,F0101.ABTICKER, F0101.ABEXCHG, F0101.ABDUNS,
    F0101.ABNOE,F0101.ABGROWTHR,F0101.ABYEARSTAR,F0101.ABREVRNG, D.FaxPhoneArea, d.Phonearea, D.Fax AS Fax ,D.Phone As Phone,D.WPUPMJ AS WPUPMJ,R.Email AS Email,R.Internet As Internet,R.EAupmj As EAUPMJ,F0111.WWAN8,F0111.WWIDLN,
    F0111.WWSLNM,F0111.WWGNNM,F0111.WWMDNM,F0111.WWSRNM,F0111.WWUSER,F0111.WWUPMJ,F0111.WWUPMT,F0111.WWNTYP,F0111.WWNICK,F0111.WWPCM,F0116.ALAN8,
    F0116.ALEFTB,F0116.ALADD1,F0116.ALADD2,F0116.ALADD3,F0116.ALADD4, F0116.ALADDZ, F0116.ALCTY1,F0116.ALADDS,F0116.ALCTR, F0116.ALUPMJ,F0116.ALUPMT,F03012.AIAN8, F03012.AICO,F03012.AIMCUR,F03012.AICRCD,F03012.AIACL,
    F03012.AIARPY,F03012.AIDB,F03012.AICRCA,F03012.AIASTY,F03012.AISPYE,F03012.AIOPY,F03012.AIPOPN,F03012.AIDAOJ,F03012.AIAN8R,F03012.AICPGP,F03012.AIFRTH,
    F03012.AIMAN8,F03012.AIUPMJ,F03012.AIUPMT, F03012.AICUSTS,F03012.AITERRID, F03012.AIDTEE, F0401.A6AN8, F0401.A6MCUP, F0401.A6CRRP,F0401.A6CRCA, F0401.A6AN8R,F0401.A6CPGP, F0401.A6FRTH, F0401.A6UPMJ,F0401.A6UPMT, CAST(F0101.ABAC03 AS CHAR(10)) AS FLEX_ATTRIB_1_CHAR,
    CAST(F0101.ABAC23 AS CHAR(10)) AS FLEX_ATTRIB_2_CHAR,
    CAST(F0101.ABAC05 AS CHAR(10)) AS FLEX_ATTRIB_3_CHAR,
    CAST(F0101.ABAC15 AS CHAR(10)) AS FLEX_ATTRIB_4_CHAR,
    CAST(F0101.ABAC09 AS CHAR(10)) AS FLEX_ATTRIB_5_CHAR,
    CAST(F0101.ABAC11 AS CHAR(10)) AS FLEX_ATTRIB_6_CHAR,
    CAST(F0101.ABAC19 AS CHAR(10)) AS FLEX_ATTRIB_7_CHAR,
    CAST(F0101.ABAC21 AS CHAR(10)) AS FLEX_ATTRIB_8_CHAR,
    CAST(F0101.ABAC27 AS CHAR(10)) AS FLEX_ATTRIB_9_CHAR,
    CAST(NULL AS CHAR(10)) AS FLEX_ATTRIB_10_CHAR,
    CAST(F0101.ABAC17 AS CHAR(10)) AS FLEX_ATTRIB_11_CHAR,
    CAST(F0101.ABAC06 AS CHAR(10)) AS FLEX_ATTRIB_12_CHAR,
    CAST(F0101.ABAC08 AS CHAR(10)) AS FLEX_ATTRIB_13_CHAR,
    CAST(F0101.ABAC14 AS CHAR(10)) AS FLEX_ATTRIB_14_CHAR,
    CAST(F0101.ABAC22 AS CHAR(10)) AS FLEX_ATTRIB_15_CHAR,
    CAST(F0101.ABAC28 AS CHAR(10)) AS FLEX_ATTRIB_16_CHAR,
    CAST(F0101.ABAC18 AS CHAR(10)) AS FLEX_ATTRIB_17_CHAR,
    CAST(F0101.ABAC10 AS CHAR(10)) AS FLEX_ATTRIB_18_CHAR,
    CAST(F0101.ABAC20 AS CHAR(10)) AS FLEX_ATTRIB_19_CHAR,
    CAST(NULL AS CHAR(10)) AS FLEX_ATTRIB_20_CHAR,
    CAST(F0101.ABAC30 AS CHAR(10)) AS LINE_OF_BUSINESS,
    CAST(F0101.ABAC14 AS CHAR(10)) AS REGION,
    CAST(NULL AS CHAR(10)) AS ACCNT_AHA_NUM,
    CAST(F0101.ABAC07 AS CHAR(10)) AS ACCNT_CLASS,
    CAST(F0101.ABAC11 AS CHAR(10)) AS ACCNT_HIN_NUM,
    CAST(F0101.ABAC02 AS CHAR(10)) AS ACCNT_REGION,
    CASt(F0101.ABAC08 AS CHAR(10)) AS ACCNT_VALUE,
    CAST(F0101.ABAC16 AS CHAR(10)) AS CUST_CAT_CODE, '0' AS X_CUSTOM
    from F0101
    INNER JOIN F03012 ON F0101.ABAN8 = F03012.AIAN8
    LEFT OUTER JOIN F0401 ON F0101.ABAN8 = F0401.A6AN8
    LEFT OUTER JOIN F0116 ON F0101.ABAN8 = F0116.ALAN8 AND F0101.ABEFTB = F0116.ALEFTB
    LEFT OUTER JOIN F0111 ON F0101.ABAN8 = F0111.WWAN8 AND F0111.WWIDLN =
    LEFT OUTER JOIN (select a.WPAN8 as an8,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPAR1 end) FaxPhoneArea,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPPH1 end) Fax,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPPH1 end) Phone,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPAR1 end) Phonearea,
    max(wpupmj) as WPUPMJ
    from F0115 a,
    (select WPAN8,WPPHTP ,min(WPRCK7) MinWPRCK7 from F0115
    group by WPAN8,WPPHTP
    ) b
    where a.WPAN8=b.WPAN8 and a.wpidln =0
    group by a.WPAN8)D on f0101.aban8 = D.an8
    LEFT OUTER JOIN (SELECT P.EAAN8 as an8,
    min(case when P.EAETP= and P.EARCK7=Q.MinRCK7E then EAEMAL end) Email,
    min(case when P.EAETP= and P.EARCK7=Q.MinRCK7E then EAEMAL end) Internet,Max(eaupmj) as EAupmj
    FROM F01151 P,
    (SELECT EAAN8,EAETP,MIN(EARCK7) MinRck7E from f01151
    group by eaan8,eaemal,eaetp)Q
    where
    P.EAAN8 = Q.EAAN8 and P.EAIDLN =
    GROUP BY P.EAAN8)R on f0101.aban8 = R.an8
    union
    SELECT
    F0101.ABAN8,F0101.ABALKY,F0101.ABTAX,F0101.ABALPH,F0101.ABMCU,F0101.ABSIC,F0101.ABAT1, F0101.ABTAXC, F0101.ABATP, F0101.ABATR,F0101.ABEFTB,F0101.ABAC01,
    F0101.ABAC02, F0101.ABAC03, F0101.ABAC04, F0101.ABAC05, F0101.ABAC06, F0101.ABAC07, F0101.ABAC08, F0101.ABAC09, F0101.ABAC10, F0101.ABAC11,
    F0101.ABAC12, F0101.ABAC13, F0101.ABAC14, F0101.ABAC15, F0101.ABAC16, F0101.ABAC17, F0101.ABAC18, F0101.ABAC19, F0101.ABAC20, F0101.ABAC21, F0101.ABAC22, F0101.ABAC23,
    F0101.ABAC24, F0101.ABAC25, F0101.ABAC26, F0101.ABAC27, F0101.ABAC28, F0101.ABAC29, F0101.ABAC30,F0101.ABUSER, F0101.ABUPMJ,F0101.ABUPMT,F0101.ABTICKER, F0101.ABEXCHG, F0101.ABDUNS,
    F0101.ABNOE,F0101.ABGROWTHR,F0101.ABYEARSTAR,F0101.ABREVRNG, D.FaxPhoneArea, d.Phonearea, D.Fax AS Fax ,D.Phone As Phone,D.WPUPMJ AS WPUPMJ,R.Email AS Email,R.Internet As Internet,R.EAupmj As EAUPMJ,F0111.WWAN8,F0111.WWIDLN,
    F0111.WWSLNM,F0111.WWGNNM,F0111.WWMDNM,F0111.WWSRNM,F0111.WWUSER,F0111.WWUPMJ,F0111.WWUPMT,F0111.WWNTYP,F0111.WWNICK,F0111.WWPCM,F0116.ALAN8,
    F0116.ALEFTB,F0116.ALADD1,F0116.ALADD2,F0116.ALADD3,F0116.ALADD4, F0116.ALADDZ, F0116.ALCTY1,F0116.ALADDS,F0116.ALCTR, F0116.ALUPMJ,F0116.ALUPMT,F03012.AIAN8, F03012.AICO,F03012.AIMCUR,F03012.AICRCD,F03012.AIACL,
    F03012.AIARPY,F03012.AIDB,F03012.AICRCA,F03012.AIASTY,F03012.AISPYE,F03012.AIOPY,F03012.AIPOPN,F03012.AIDAOJ,F03012.AIAN8R,F03012.AICPGP,F03012.AIFRTH,
    F03012.AIMAN8,F03012.AIUPMJ,F03012.AIUPMT, F03012.AICUSTS,F03012.AITERRID, F03012.AIDTEE, F0401.A6AN8, F0401.A6MCUP, F0401.A6CRRP,F0401.A6CRCA, F0401.A6AN8R,F0401.A6CPGP, F0401.A6FRTH, F0401.A6UPMJ,F0401.A6UPMT, CAST(F0101.ABAC03 AS CHAR(10)) AS FLEX_ATTRIB_1_CHAR,
    CAST(F0101.ABAC23 AS CHAR(10)) AS FLEX_ATTRIB_2_CHAR,
    CAST(F0101.ABAC05 AS CHAR(10)) AS FLEX_ATTRIB_3_CHAR,
    CAST(F0101.ABAC15 AS CHAR(10)) AS FLEX_ATTRIB_4_CHAR,
    CAST(F0101.ABAC09 AS CHAR(10)) AS FLEX_ATTRIB_5_CHAR,
    CAST(F0101.ABAC11 AS CHAR(10)) AS FLEX_ATTRIB_6_CHAR,
    CAST(F0101.ABAC19 AS CHAR(10)) AS FLEX_ATTRIB_7_CHAR,
    CAST(F0101.ABAC21 AS CHAR(10)) AS FLEX_ATTRIB_8_CHAR,
    CAST(F0101.ABAC27 AS CHAR(10)) AS FLEX_ATTRIB_9_CHAR,
    CAST(NULL AS CHAR(10)) AS FLEX_ATTRIB_10_CHAR,
    CAST(F0101.ABAC17 AS CHAR(10)) AS FLEX_ATTRIB_11_CHAR,
    CAST(F0101.ABAC06 AS CHAR(10)) AS FLEX_ATTRIB_12_CHAR,
    CAST(F0101.ABAC08 AS CHAR(10)) AS FLEX_ATTRIB_13_CHAR,
    CAST(F0101.ABAC14 AS CHAR(10)) AS FLEX_ATTRIB_14_CHAR,
    CAST(F0101.ABAC22 AS CHAR(10)) AS FLEX_ATTRIB_15_CHAR,
    CAST(F0101.ABAC28 AS CHAR(10)) AS FLEX_ATTRIB_16_CHAR,
    CAST(F0101.ABAC18 AS CHAR(10)) AS FLEX_ATTRIB_17_CHAR,
    CAST(F0101.ABAC10 AS CHAR(10)) AS FLEX_ATTRIB_18_CHAR,
    CAST(F0101.ABAC20 AS CHAR(10)) AS FLEX_ATTRIB_19_CHAR,
    CAST(NULL AS CHAR(10)) AS FLEX_ATTRIB_20_CHAR,
    CAST(F0101.ABAC30 AS CHAR(10)) AS LINE_OF_BUSINESS,
    CAST(F0101.ABAC14 AS CHAR(10)) AS REGION,
    CAST(NULL AS CHAR(10)) AS ACCNT_AHA_NUM,
    CAST(F0101.ABAC07 AS CHAR(10)) AS ACCNT_CLASS,
    CAST(F0101.ABAC11 AS CHAR(10)) AS ACCNT_HIN_NUM,
    CAST(F0101.ABAC02 AS CHAR(10)) AS ACCNT_REGION,
    CASt(F0101.ABAC08 AS CHAR(10)) AS ACCNT_VALUE,
    CAST(F0101.ABAC16 AS CHAR(10)) AS CUST_CAT_CODE, '0' AS X_CUSTOM
    from F0101
    LEFT OUTER JOIN F03012 ON F0101.ABAN8 = F03012.AIAN8
    INNER JOIN F0401 ON F0101.ABAN8 = F0401.A6AN8
    LEFT OUTER JOIN F0116 ON F0101.ABAN8 = F0116.ALAN8 AND F0101.ABEFTB = F0116.ALEFTB
    LEFT OUTER JOIN F0111 ON F0101.ABAN8 = F0111.WWAN8 AND F0111.WWIDLN =
    LEFT OUTER JOIN (select a.WPAN8 as an8,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPAR1 end) FaxPhoneArea,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPPH1 end) Fax,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPPH1 end) Phone,
    min(case when a.WPPHTP= and a.WPRCK7=b.MinWPRCK7 then WPAR1 end) Phonearea,
    max(wpupmj) as WPUPMJ
    from F0115 a,
    (select WPAN8,WPPHTP ,min(WPRCK7) MinWPRCK7 from F0115
    group by WPAN8,WPPHTP
    ) b
    where a.WPAN8=b.WPAN8 and a.wpidln =0
    group by a.WPAN8)D on f0101.aban8 = D.an8
    LEFT OUTER JOIN (SELECT P.EAAN8 as an8,
    min(case when P.EAETP= and P.EARCK7=Q.MinRCK7E then EAEMAL end) Email,
    min(case when P.EAETP= and P.EARCK7=Q.MinRCK7E then EAEMAL end) Internet,Max(eaupmj) as EAupmj
    FROM F01151 P,
    (SELECT EAAN8,EAETP,MIN(EARCK7) MinRck7E from f01151
    group by eaan8,eaemal,eaetp)Q
    where
    P.EAAN8 = Q.EAAN8 and P.EAIDLN =
    GROUP BY P.EAAN8)R on f0101.aban8 = R.an8
    Oracle Fatal Error
    Database driver error...
    Function Name : Execute
    *****************************************************

    "ORA-00933: SQL command not properly ended"
    this error may be seen due to reasons like the Informatica properties are not set correct.
    Are all the informatica properties set correct? how many ETL jobs completed, what analytic apps are in the ETL process?

  • JWSDP 1.6 xws-security Simple fails with "block not properly padded"

    Environment:
    - Windows 2000
    - Tomcat50-jwsdp
    - JAVA_HOME=C:/Progra~1/Java/jdk1.5.0_05
    - Security environment handler: SecurityEnvironmentHandler.java supplied with JWSDP 1.6 (Hello, Ron!)
    I get the following in the Tomcat Window:
    ==== Received Message End ====
    Nov 13, 2005 10:38:56 AM com.sun.org.apache.xml.internal.security.encryption.XMLCipher decryptKey
    INFO: Decryption of key type http://www.w3.org/2001/04/xmlenc#tripledes-cbc OK
    Nov 13, 2005 10:38:56 AM com.sun.xml.wss.impl.apachecrypto.DecryptionProcessor decryptElementWithCipher
    SEVERE: WSS_ENC0004: Exception [ Given final block not properly padded ] while trying to decrypt message
    Nov 13, 2005 10:38:56 AM com.sun.xml.wss.impl.filter.DumpFilter process
    INFO: ==== Sending Message Start ====
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/enco
    ding/" xmlns:ns0="http://xmlsoap.org/Ping" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.or
    g/2001/XMLSchema-instance">
    <env:Body>
    <env:Fault>
    <faultcode xmlns:ans1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">ans1:Fail
    edCheck</faultcode>
    <faultstring>Unable to decrypt message</faultstring>
    </env:Fault>
    </env:Body>
    </env:Envelope>
    ==== Sending Message End ====
    Please help!
    George

    Hi, I got the xws-security/samples/simple application
    working successfully with my own keystores. I have 2
    questions regarding this sample application.
    1) When running the application with the
    encrypt-server.xml and encrypt-client.xml
    configuration, why is it necessary to import the
    client's certificate into the server's truststore and
    the server's certificate into client's truststore when
    their certificates have already been signed by a
    trusted root CA (e.g. Verisign), whose certificate is
    in both truststores? Shouldn't their certificates
    containing their public keys get automatically
    exchanged during the connection request? It's a pain
    to publish a web service and expect a manual public
    certificate import for each client wanting to use the
    service.Certificates are sent only when the keyReferenceType is "Direct" which is the default. It's possible that our code is checking the certificate sent with one found in the KeyStore, but a quick scan of the code doesn't show it. If that's what's happening it's a bug. All of the other key reference strategies send only a referece to the sender's certificate in which case the reciever must have a copy of that certificate in its keystore.
    2) I use Tomcat to run the sample application and did
    set up the SSL connector to point to the keystores.
    When the client connects to the server, it uses a
    http endpoint not https. I'm aware that htpps is
    needed for SSL support but not clear on where does
    https come into play during the client's
    request/server's response process.We share the SSL keystore so that certificates don't have to be stored in more than one place. The functionality of XWS-Security and SSL is logically the same so it make sense to use the same keystore. XWS-Security operates completely separately from the transport and never knows whether HTTPS is in use or not.
    Phil Goodwin
    Technical Lead
    XWS-Security

  • PBE; final block not properly padded help!

    Hi there,
    I'm having problems decrypting passwords using password based encryption (PBE), throwing me a "final block not properly padded" exception.
    The passwords are also encrypted uses PBE in a seperate class called the PasswordEncryption. The code necessary to generate the Cipher is in a seperate method which is passed a String to determined if it would be initialized in "encrypt" or "decrypt" mode.
    The class where the passwords are decrypted, UserManager, is passed the encrypted passwords as a String. It calls the PasswordEncryption class gets getcipher() to get the Cipher, and then decrypts the password. The data is read from the database by another class which reads database info, and passed in as a string to the decrypting class. The decrypting class converts the string to a byte[].
    Below I have the UserManager class and PasswordEncryption class:
    public class UserManager
    implements SecurityServerInterface, PETComponent {
    public UserManager() {
    private static String decryptPassword(String asPassword) throws
    SecurityException {
    PasswordEncryption passwordEncryption = new PasswordEncryption();
    Cipher pbeCipher = passwordEncryption.getCipher("decrypt");
    String clearText = new String();
    byte[] encryptedPassword = asPassword.getBytes();
    try {
    //This is where decryption failed! Given final block not properly padded
    byte[] cipherText = pbeCipher.doFinal(encryptedPassword);
    System.out.println(cipherText);
    System.out.println("test cipher text");
    clearText = new String(cipherText);
    System.out.println("original:" + asPassword);
    System.out.println("decrypted:" + clearText);
    catch (IllegalBlockSizeException e) {
    System.out.println(e.getMessage());
    String illegalBlock = e.getMessage();
    throw new SecurityException(illegalBlock);
    catch (BadPaddingException e) {
    System.out.println(e.getMessage());
    String badPadding = e.getMessage();
    throw new SecurityException(badPadding);
    catch(Exception e) {
    System.out.println(e.getMessage());
    String exception = e.getMessage();
    throw new SecurityException(exception);
    System.out.println(clearText);
    return clearText;
    public class PasswordEncryption {
    public static void main(String[] args) throws PETDBException,
    SecurityEncryptionException {
    PasswordEncryption encryptor = new PasswordEncryption();
    ArrayList mainList = encryptor.getAllPasswords();
    mainList = encryptor.encryptAllPasswords(mainList);
    encryptor.updateAllPasswords(mainList);
    public PasswordEncryption() {
    //Get passwords from the user table of the database, e.g, loginName and passwords
    private ArrayList getAllPasswords() throws PETDBException {
    ArrayList passwordList = new ArrayList();
    DBConnection.setConnection("jdbc:mysql://localhost/Mysql/data/pet?user=root&password=");
    DBConnection dbCon = DBConnection.createConnection();
    Connection con = dbCon.getConnection();
    System.out.println(con);
    try {
    String allPasswordQuery = " SELECT " + DBColumns.USPASSWD.trim() + " , " +
    DBColumns.USLOGINNAME.trim() + " from " + DBColumns.USER;
    Statement stmt = con.createStatement();
    ResultSet rs;
    rs = stmt.executeQuery(allPasswordQuery);
    if (rs.isFirst()) {
    throw new PETDBException("No password found in the database.");
    while (rs.next()) {
    UserDO loUserDO = new UserDO();
    loUserDO.setPassword(rs.getString(DBColumns.USPASSWD));
    loUserDO.setLoginName(rs.getString(DBColumns.USLOGINNAME));
    passwordList.add(loUserDO);
    catch (SQLException sql) {
    String sqlError = sql.getMessage();
    throw new PETDBException(sqlError);
    return passwordList;
    private ArrayList encryptAllPasswords(ArrayList aoPasswordList) throws
    SecurityEncryptionException {
    // Encrypt the password
    Cipher pbeCipher = getCipher("encrypt");
    Iterator passwordIterator = aoPasswordList.iterator();
    UserDO loUserDO = new UserDO();
    try {
    while (passwordIterator.hasNext()) {
    loUserDO = (UserDO) passwordIterator.next();
    String lsPassword = loUserDO.getPassword();
    byte[] clearTextPassword = lsPassword.getBytes();
    byte[] cipherText = pbeCipher.doFinal(clearTextPassword);
    String cipherString = new String(cipherText);
    loUserDO.setPassword(cipherString);
    System.out.println(cipherString);
    catch (IllegalBlockSizeException e) {
    throw new SecurityException("Can't encrypt password, illegal block size");
    catch (BadPaddingException e) {
    throw new SecurityException("Can't encrypt password, bad padding");
    System.out.println(aoPasswordList);
    return aoPasswordList;
    public Cipher getCipher(String mode) {
    PBEKeySpec pbeKeySpec;
    PBEParameterSpec pbeParamSpec;
    SecretKeyFactory keyFac;
    // Salt
    byte[] salt = {
    (byte)0xc7, (byte)0x73, (byte)0x21, (byte)0x8c,
    (byte)0x7e, (byte)0xc8, (byte)0xee, (byte)0x99
    // Iteration count
    int count = 20;
    // Create PBE parameter set & a SecretKey
    pbeParamSpec = new PBEParameterSpec(salt, count);
    SecretKey pbeKey;
    // Use our own encryption password.
    // Collect the password as char array and convert
    // it into a SecretKey object, using a PBE key
    // factory.
    char[] password = new String("cmuw-team5").toCharArray();
    pbeKeySpec = new PBEKeySpec(password);
    try {
    keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    pbeKey = keyFac.generateSecret(pbeKeySpec);
    catch (NoSuchAlgorithmException e) {
    throw new SecurityException("Can't collect password as a char array");
    catch (InvalidKeySpecException e) {
    throw new SecurityException("Can't convert password into a SecretKey Object");
    // Create PBE Cipher
    Cipher pbeCipher;
    try {
    pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
    catch(NoSuchAlgorithmException e) {
    throw new SecurityException("Can't create a PBE Cipher, no such algorithm");
    catch(NoSuchPaddingException e) {
    throw new SecurityException("Can't create a PBE Cipher, no such padding");
    // Initialize PBE Cipher with key and parameters
    if (mode == "encrypt") {
    try {
    pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);
    catch(InvalidKeyException e) {
    throw new SecurityException("Can't initialize PBE Cipher with key");
    catch(InvalidAlgorithmParameterException e) {
    throw new SecurityException("Can't initialize PBE Cipher with parameters");
    if (mode == "decrypt") {
    try {
    pbeCipher.init(Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec);
    catch(InvalidKeyException e) {
    throw new SecurityException("Can't initialize PBE Cipher with key");
    catch(InvalidAlgorithmParameterException e) {
    throw new SecurityException("Can't initialize PBE Cipher with parameters");
    return pbeCipher;
    //Get encrypted passwords out of the ArrayList and update the database
    private void updateAllPasswords(ArrayList aoUpdatePasswordList) throws
    PETDBException {
    DataService dataService = new DataService();
    Iterator getEncryptPassword = aoUpdatePasswordList.iterator();
    String lsUpdatePassword = new String();
    String lsUserName = new String();
    Statement stmt;
    DBConnection dbCon = DBConnection.createConnection();
    Connection con = dbCon.getConnection();
    try {
    stmt = con.createStatement();
    System.out.println(stmt);
    catch (SQLException sql) {
    String sqlError = sql.getMessage();
    System.out.println(sqlError);
    throw new PETDBException(sqlError);
    while (getEncryptPassword.hasNext()) {
    UserDO loUser = (UserDO) getEncryptPassword.next();
    lsUpdatePassword = loUser.getPassword();
    lsUserName = loUser.getLoginName();
    String allUpdatePassword = " UPDATE " + DBColumns.USER + " SET " +
    DBColumns.USPASSWD + " = " + "'" + lsUpdatePassword + "'" + " WHERE "
    + DBColumns.USLOGINNAME + " = " + "'" + lsUserName + "'";
    System.out.println(allUpdatePassword);
    try {
    int returnValue = stmt.executeUpdate(allUpdatePassword);
    System.out.println(returnValue);
    catch (SQLException sql) {
    String sqlError = sql.getMessage();
    throw new PETDBException(sqlError);
    try {
    con.commit();
    con.close();
    catch (SQLException sql) {
    String sqlError = sql.getMessage();
    throw new PETDBException(sqlError);

    Thanks for the prompt response! I got this example
    from the Sun Java cryptography extensions web page at:
    http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/
    CERefGuide.html#PBEExThe code I'm pointing out did not come from there. Nowhere in Sun's examples do you see them creating Strings directly from ciphertext. (Which is good, because if you did, their examples wouldn't work). To give some more context on where the problem is:private ArrayList encryptAllPasswords(ArrayList aoPasswordList) throws SecurityEncryptionException {
      // Encrypt the password
      Cipher pbeCipher = getCipher("encrypt");
      Iterator passwordIterator = aoPasswordList.iterator();
      UserDO loUserDO = new UserDO();
      try {
        while (passwordIterator.hasNext()) {
          loUserDO = (UserDO) passwordIterator.next();
          String lsPassword = loUserDO.getPassword();
          byte[] clearTextPassword = lsPassword.getBytes();
          byte[] cipherText = pbeCipher.doFinal(clearTextPassword);
          // DOING THE FOLLOWING TO CIPHERTEXT TURNS IT INTO GARBAGE!
          String cipherString = new String(cipherText);
          loUserDO.setPassword(cipherString);
          System.out.println(cipherString);
      } catch (IllegalBlockSizeException e) {
        throw new SecurityException("Can't encrypt password, illegal block size");
      } catch (BadPaddingException e) {
        throw new SecurityException("Can't encrypt password, bad padding");
      System.out.println(aoPasswordList);
      return aoPasswordList;
    }(Note: Please use the [ code ] tags when you post code - it makes it MUCH easier to figure out what you're doing.)
    Also, my decryption code in the UserManager class does
    work for two out of 8 users....I can't really figure
    out why it's working for Only 2 users, and not the
    rests. It's possible that the ciphertext is successfully string-able in those two cases (although I doubt it). But I can absolutely guarantee to you that trying to treat ciphertext as a String will turn your ciphertext into grabage, and that will result in a BadPaddingException when you decrypt. You need to stop doing that.
    If you need to treat ciphertext or keys as Strings, the right way to do it is to Base64-encode the byte[] into a String, and then Base64-decode when you want to decrypt.
    Grant

  • Given final block not properly padded

    I am working on an application that sends encrypted data over the network using Blowfish. I developed a simple server and client to test and I getting this error when I try to decrypt the cypher in the server. Here is what I do:
    This happens on the client side:
    I encrypt my message with this method
    public byte[] encryptedMessage() throws Exception{
            KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
            keyGenerator.init(128);     
            Key key = keyGenerator.generateKey();
            Cipher cipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
            cipher.init(Cipher.ENCRYPT_MODE, key);
            byte[] plaintext = getMessage().getBytes("UTF8");
            byte[] ciphertext = cipher.doFinal(plaintext);
            return ciphertext;
        }Then send it to the server like this:
    //get my cypher from the method shown before
    cipher = mc.encryptedMessage();
    //put the cypher in this simple object          
    InformationShared cipherToSend = new InformationShared(cipher.length);
    cipherToSend.setMessage(cipher);
    //Send it accross through the network
    Socket socket =  new Socket("127.0.0.1",8085);
    ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
    out.writeObject(cipherToSend);This is what happens in the server side:
    //Get the incoming object
    ObjectInputStream in = new ObjectInputStream( incoming.getInputStream() );
    //downcast the object
    InformationShared cipherIn = (InformationShared)in.readObject();
    //decypher the message  in the decypher method             
    String result = decypher(cipherIn.getMessage());
    //This is the decipher method
    public String decypher(byte cipherIn[]) throws Exception{
               KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
               keyGenerator.init(128);     // need to initialize with the keysize
               Key key = keyGenerator.generateKey();
               Cipher ciph = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
               ciph.init(Cipher.DECRYPT_MODE, key);
               // Perform the decryption
               byte[] decryptedText = ciph.doFinal(cipherIn);
               String output = new String(decryptedText,"UTF8");;
               return output;
            }The error happens in the decypher method in this line:
    byte[] decryptedText = ciph.doFinal(cipherIn);Thanks for any help!

    Hi
    I am woriking on an web application that send Encrypted data over the network and stores into the databse.After that I want to retrieve that data from database then I want decrypt it by using DES.
    After Encryting It is storing properly into the database but while retriving from database and want to decrypt it the It is giving exception like "javax.crypto.BadPaddingException: Given final block not properly padded"
    For Encryption I am using one bean class tha are
    package EncryptBean;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.security.*;
    import java.security.spec.*;
    import javax.crypto.spec.*;
    import com.sun.crypto.provider.*;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.Cipher;
    import java.security.NoSuchAlgorithmException;
    import java.security.InvalidKeyException;
    import java.security.InvalidAlgorithmParameterException;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import sun.misc.BASE64Encoder;
    import sun.misc.BASE64Decoder;
    import javax.crypto.*;
    public class DesEncrypterBean {
    Cipher ecipher;
    Cipher dcipher;
    public DesEncrypterBean(SecretKey key) {
    try {
    ecipher = Cipher.getInstance("DES");
    dcipher = Cipher.getInstance("DES");
    ecipher.init(Cipher.ENCRYPT_MODE, key);
    dcipher.init(Cipher.DECRYPT_MODE, key);
    } catch(javax.crypto.NoSuchPaddingException e)
         {System.out.println("NoSuchPaddingException : "+e);     
                } catch (java.security.NoSuchAlgorithmException e)
    {System.out.println("NoSuchAlgorithmException : "+e);     
                } catch (java.security.InvalidKeyException e)
    {System.out.println("InvalidKeyException : "+e); }
    public String encrypt(String str) {
    try {
    // Encode the string into bytes using utf-8
    byte[] utf8 = str.getBytes("UTF8");
    // Encrypt
    byte[] enc = ecipher.doFinal(utf8);
    // Encode bytes to base64 to get a string
    return new sun.misc.BASE64Encoder().encode(enc);
    } catch (javax.crypto.BadPaddingException e) {
    System.out.println("encrypt BadPaddingException : "+e);
    } catch (IllegalBlockSizeException e) {
    System.out.println(" encrypt IllegalBlockSizeException : "+e);
    } catch (UnsupportedEncodingException e) {
    System.out.println("encrypt UnsupportedEncodingException : "+e);
    } catch (java.io.IOException e) {
    System.out.println("encrypt IOException : "+e);
    } return null;
    public String decrypt(String str) {
    try {
    // Decode base64 to get bytes
    // byte[] utf8 = str.getBytes("UTF8");
    byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
    // Decrypt
    byte[] utf8 = dcipher.doFinal(dec);
    // Decode using utf-8
    return new String(utf8, "UTF8");
    } catch (javax.crypto.BadPaddingException e)
         {System.out.println("encrypt BadPaddingException : "+e);
                } catch (IllegalBlockSizeException e) {
    System.out.println("encrypt IllegalBlockSizeException : "+e);
    } catch (UnsupportedEncodingException e) {
    System.out.println("encrypt UnsupportedEncodingException : "+e);
    }catch (java.io.IOException e) {
    System.out.println("encrypt IOException : "+e);
    return null;
    ** By using bellow screen I am retrieving the data from screen and encrypting it and sended to the database I is working properly
    import EncryptBean.DesEncrypterBean;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.security.*;
    import java.security.spec.*;
    import javax.crypto.spec.*;
    import com.sun.crypto.provider.*;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.Cipher;
    import java.security.NoSuchAlgorithmException;
    import java.security.InvalidKeyException;
    import java.security.InvalidAlgorithmParameterException;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import sun.misc.BASE64Encoder;
    import javax.crypto.*;
    public class Secure_Encrypt extends HttpServlet
              Connection con=null;
              Statement stmt=null;
              Cipher ecipher;
    Cipher dcipher;
              String uname=null,pwd=null;
              ServletOutputStream sos;
              SecretKey key=null;
    public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
    uname=req.getParameter("username");               pwd=req.getParameter("password");
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:GMT","sa","iqm");
    stmt=con.createStatement();
    sos=res.getOutputStream();
    // Generate a temporary key. In practice, you would save this key.
    // See also e464 Encrypting with DES Using a Pass Phrase.
    key = KeyGenerator.getInstance("DES").generateKey();
    // Create encrypter/decrypter class
    DesEncrypterBean encrypter = new DesEncrypterBean(key);
    // Encrypt
    String encrypted = encrypter.encrypt(uname);
    System.out.println("Don't tell anybody! "+encrypted);
    stmt.execute("insert into Admin(UserName,Passward) values('"+encrypted+"','"+encrypted+"')");
    System.out.println("......record saved");
    sos.println("Record Saved : "+encrypted);
    catch(Exception e)
    {System.out.println("Exception in login" +e);}
    In above Programe Woking Properly
    ** Bellow programe using for retrieving data from database.After retrieving data I want Decrypt it but not working properly
    import EncryptBean.DesEncrypterBean;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.security.*;
    import java.security.spec.*;
    import javax.crypto.spec.*;
    import com.sun.crypto.provider.*;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.Cipher;
    import java.security.NoSuchAlgorithmException;
    import java.security.InvalidKeyException;
    import java.security.InvalidAlgorithmParameterException;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import sun.misc.BASE64Encoder;
    import javax.crypto.*;
    public class Secure extends HttpServlet
              Connection con=null;
              Statement stmt=null;
              Cipher ecipher;
    Cipher dcipher;
              String uname=null,pwd=null;
              ServletOutputStream sos;
              SecretKey key=null;
    public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
    try
    {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:GMT","sa","iqm");
    stmt=con.createStatement();
    ResultSet rs=stmt.executeQuery("select UserName,Passward from Admin");
    while(rs.next())
         uname=rs.getString(1);
         pwd=rs.getString(2);
    sos=res.getOutputStream();
    // Generate a temporary key. In practice, you would save this key.
    // See also e464 Encrypting with DES Using a Pass Phrase.
    key = KeyGenerator.getInstance("DES").generateKey();
    // Create encrypter/decrypter class
    DesEncrypterBean encrypter = new DesEncrypterBean(key);
    // Decrypt
    uname=uname.trim();
    String decrypted = encrypter.decrypt(uname);
    System.out.println("Original message is! "+decrypted);
    }catch(Exception e)
    {System.out.println("Exception in login" +e);
    In above Programe giving Exception " javax.crypto.BadPaddingException: Given final block not properly padded"
    Please analyze my application and send me suitable solution for decryption
    one more thing When I encrypting that time KeyGenerator generating one key.same as when I Decrypting that time also KeyGenerator generating one key but both are not same.
    How can we generate both key are same

  • Given final block not properly padded : PLEASE HELP!!

    hi guys
    please can you help me with the following error that i am getting.
    i appear to be encyrpting ok as image a am readin in and the file reading out are the same size.
    but i am getting this pading error. been at it all day and cant find the answer to this error.
    Exception: javax.crypto.BadPaddingException: Given final block not properly padd
    ed
    javax.crypto.BadPaddingException: Given final block not properly padded
    at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
    at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
    at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)
    at javax.crypto.Cipher.doFinal(DashoA13*..)
    at Securitytest.decrypt(Securitytest.java:208)
    at Securitytest.byteConvert(Securitytest.java:117)
    at Securitytest.main(Securitytest.java:265)
    the code i am using is the following. please help me i am going mad! the iv is the same for reading in and out and the secret key appears to be the same.
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.PrintStream;
    import java.security.interfaces.RSAPrivateKey;
    import java.security.spec.PKCS8EncodedKeySpec;
    import java.security.spec.RSAPrivateKeySpec;
    import javax.imageio.stream.FileImageInputStream;
    import java.security.*;
    import java.io.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import sun.misc.*;
    import java.lang.*;
    public class Securitytest{
    public static void imageConvert( ) throws Exception {
    try{
    System.out.println("please select the file to encrypt");
    BufferedReader fileInput = new BufferedReader(new InputStreamReader(System.in));
    String filetoread = null;
    filetoread = fileInput.readLine();
    System.out.println("please select the file to save to");
    BufferedReader fileOutput = new BufferedReader(new InputStreamReader(System.in));
    String filetostore = null;
    filetostore = fileOutput.readLine();
    FileImageInputStream input = new FileImageInputStream(new File(filetoread));
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    PrintStream stream = new PrintStream(output);
    byte[] buffer = new byte[1024];
    byte[] data = null;
    int numberBytesRead = 0;
    while ((numberBytesRead = input.read(buffer)) != -1)
    output.write(buffer, 0, numberBytesRead);
    data = output.toByteArray();
    System.out.println("encrytped" + buffer);
    System.out.println("going to encrypt");
    byte[] imageOutput = encrypt(data);
    System.out.println("back to imageconvert");
    System.out.println("encrytped" + buffer);
    FileOutputStream imageOut = new FileOutputStream(new File(filetostore));
    imageOut.write(imageOutput,0,imageOutput.length);
    imageOut.close();
    //BASE64Encoder encoder = new BASE64Encoder();
    //String enc = encoder.encodeBuffer(imageOutput);
    //FileWriter fw = new FileWriter(filetostore);
    FileOutputStream fos = new FileOutputStream(filetostore);
    fos.write(imageOutput);
    fos.close();
    System.out.println("sent to file");
    output.close();
    input.close();
    } catch(Exception ex) {
    System.out.println("Exception: " + ex);
    ex.printStackTrace();
    public static void byteConvert()throws Exception{
        try{
    System.out.println("please select the file to decrypt");
    BufferedReader fileInput = new BufferedReader(new InputStreamReader(System.in));
    String filetoread = null;
    filetoread = fileInput.readLine();
    System.out.println("please select the file to save to");
    BufferedReader fileOutput = new BufferedReader(new InputStreamReader(System.in));
    String filetostore = null;
    filetostore = fileOutput.readLine();
    FileInputStream fis = new FileInputStream(filetoread);
    byte[] decrypt = new byte[fis.available()];
    fis.read(decrypt);
    fis.close();
    //String dec = new String(decrypt);
    //BASE64Decoder decoder = new BASE64Decoder();
    //byte[] byteSeed = decoder.decodeBuffer(dec);
    // FileInputStream input = new FileInputStream(new File(filetoread));
    // ByteArrayOutputStream inStream = new ByteArrayOutputStream();
    // PrintStream stream = new PrintStream(inStream);
    // PrintStream stream = new PrintStream(input);
    // BASE64Decoder decoder = new BASE64Decoder();
    // String dec = decoder.decodeBuffer(stream);
    // String dec = new String(stream);
    // byte[] decryptionBytes = inStream;
    // byte[] s = decrypt(dec);
    // decryptionBytes =(byte [])stream.readStream();
    // stream.close();
    // for(int i=0; i < decryptionBytes.length; i++)
        // System.out.print(decryptionBytes);
    byte[] imageOutput = decrypt(decrypt);
    //byte[] imageOutput = decrypt(decrypt);
    FileOutputStream imageOut = new FileOutputStream(new File(filetostore));
    imageOut.write(imageOutput,0,imageOutput.length);
    imageOut.close();
        }catch(Exception ex) {
    System.out.println("Exception: " + ex);
    ex.printStackTrace();
    //new being used for AES
    public static byte[] encrypt(byte[] imageBytes) throws Exception {
    byte[] iv = new byte[] {(byte)0x2A, (byte)0x98, (byte)0xB2, (byte)0xBA, (byte)0x99, (byte)0xC0,
                (byte)0xF1, (byte)0x22, (byte)0x72, (byte)0x54, (byte)0xBC,
                (byte)0xB5, (byte)0x34, (byte)0x2F, (byte)0xBA, (byte)0xC4};
    byte[] encrypte = new byte[imageBytes.length];
    //System.out.println("Imagebyte length: " + imageBytes.length);
    System.out.println("in encrypt");
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    SecretKey secretKeySpec = AESkeyGeneration();
    //IvParameterSpec ivSpec = new IvParameterSpec();
    //Cipher.getIV()
    System.out.println("read out" + secretKeySpec);
    //IvParameterSpec iv = new IvParameterSpec(IV_BYTE_ARRAY);
    cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, new IvParameterSpec (iv));
    //byte[] encrypted = cipher.doFinal(imageBytes);
    FileOutputStream fos = new FileOutputStream("c:/text.txt");
    CipherOutputStream cOut = new CipherOutputStream(fos, cipher);
                // Your plaintext MUST be multiple of 16 bytes because NoPadding requires your input text
                // to be a multiple of block size.
    cOut.write(imageBytes);
    cOut.close();
    return cipher.doFinal(imageBytes);
    //return encrypted;
    public static byte[] decrypt(byte[] bytesIn) throws Exception{
    byte[] iv = new byte[] {(byte)0x2A, (byte)0x98, (byte)0xB2, (byte)0xBA, (byte)0x99, (byte)0xC0,
                (byte)0xF1, (byte)0x22, (byte)0x72, (byte)0x54, (byte)0xBC,
                (byte)0xB5, (byte)0x34, (byte)0x2F, (byte)0xBA, (byte)0xC4};
    System.out.println("in decrypt");
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    System.out.println("cipher instance");
    SecretKey secretKeySpec = AESkeyGeneration();
    System.out.println("key" + secretKeySpec);
    System.out.println("keyRead in");
    //PrivateKey prvk = loadPrvkey();
    System.out.println("read out" + secretKeySpec);
    cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, new IvParameterSpec (iv));
    System.out.println("Decrypt mode");
    return cipher.doFinal(bytesIn);
    //byte[] decodeData= cipher.doFinal(bytesIn);
    //return decodeData;
    private static SecretKeySpec AESkeyGeneration() {
    SecretKeySpec secretKeySpec = null;
    try {
    KeyGenerator kgen = KeyGenerator.getInstance("AES");
    kgen.init(128);
    SecretKey skey = kgen.generateKey();
    byte[] key = skey.getEncoded();
    secretKeySpec = new SecretKeySpec(key, "AES");
    FileOutputStream fosKey = new FileOutputStream ("c:/AES.key");
    fosKey.write (key);
    fosKey.close();
    }catch(Exception e) {
      System.out.println("error in keygen = "+e);
      return secretKeySpec;
    public static void main (String[] unused) throws Exception {
    System.out.println("***********************************************");
    System.out.println("***    Biometric Encrytion Program          ***");
    System.out.println("***********************************************");
    System.out.println("Please select a process");
    System.out.println("e for encryption ");
    System.out.println("d for decrytion");
    boolean choose = false;
    BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
    String choice = null;
    choice = userInput.readLine();
    if (choose = choice.equals("e")){
    imageConvert();
    System.out.println("Encryption");
    else
    System.out.println("Decryption");
    byteConvert();
    }

    sorry i misinterepreted something. that program failured for some input only

  • ORA-00933 SQL Comand not properly ended

    Hi,
    While running SQL * Plus report,I am getting the Error.ORA-00933 SQL Command not properly ended.
    Please advise

    Hi,
    This is the query.I want to run the report for 2 different org_ids.Each Org_id runs individually and it shoul be resticted only one org_id for a particular user.The user is resticted only his particular org_id.
    I am getting the same error.
    Please advise and Help me
    SELECT org_id
    , ctype
    , invoice_day inv_date
    , ROUND (TRUNC (SYSDATE) - invoice_date, 0) days_from_inv_date
    , CASE
    WHEN ROUND (TRUNC (SYSDATE) - invoice_date, 0) <= 0
    THEN 'Current'
    WHEN ROUND (TRUNC (SYSDATE) - invoice_date, 0) BETWEEN 1 AND 30
    THEN '1 - 30'
    WHEN ROUND (TRUNC (SYSDATE) - invoice_date, 0) BETWEEN 31 AND 60
    THEN '31 - 60'
    WHEN ROUND (TRUNC (SYSDATE) - invoice_date, 0) BETWEEN 61 AND 90
    THEN '61 - 90'
    WHEN ROUND (TRUNC (SYSDATE) - invoice_date, 0) > 90
    THEN '> 90'
    END inv_date_bucket
    , COUNT (DISTINCT invoice_number) num_invoices
    , SUM (amt_due_orig) total_amt_invoiced
    , SUM (amt_due_remain) total_amt_remain
    , ROUND ((SUM (amt_due_remain) / SUM (amt_due_orig)) * 100, 0) "%_DUE"
    FROM (SELECT rcta.org_id
    , TRUNC (rcta.printing_original_date) printing_date
    , hp.party_name customer_name
    , hca.account_number customer_number
    , hcsua.attribute1 ctype
    , hcsua.attribute2 ctype1
    , hcsua.attribute3 branch_agent_id
    , rcta.trx_date invoice_date
    , TO_CHAR (rcta.trx_date, 'DD-MON-YYYY - Day') invoice_day
    , rcta.trx_number invoice_number
    , apsa.amount_due_original amt_due_orig
    , apsa.amount_due_remaining amt_due_remain
    , (apsa.amount_due_original - apsa.amount_due_remaining)
    amt_paid
    , rcta.purchase_order
    , apsa.due_date
    FROM apps.ra_customer_trx_all rcta
    , apps.ar_payment_schedules_all apsa
    , apps.hz_parties hp
    , apps.hz_cust_accounts hca
    , apps.hz_cust_site_uses_all hcsua
    WHERE 1 = 1
    AND rcta.customer_trx_id = apsa.customer_trx_id
    AND apsa.CLASS = 'INV'
    AND rcta.bill_to_customer_id = hca.cust_account_id
    -------- AND rcta.org_id = :org_id
    AND hca.party_id = hp.party_id
    AND rcta.bill_to_site_use_id = hcsua.site_use_id
    AND rcta.trx_date >= SYSDATE - 180
    AND rcta.trx_date < SYSDATE + 1)
    GROUP BY org_id
    , ctype
    , invoice_day
    , invoice_date
    ORDER BY 1
    , 2
    , 4

Maybe you are looking for

  • Building a Kernel without InitRAMFS [SOLVED]

    Hello! I'm trying to build my custom kernel (already done that in Gentoo some time ago) without InitRAMFS. I've done an "alpha" version: it actually starts but the resolution is TOTALLY out and a section of the screen is kinda "fuzzed". What am I doi

  • How to Copy Customized Partner From One Opprtunity to Another in CRM

    Hi experts, How to save more than one same type partner(with same partner FCT) in CRM opportunity Application? I am using following Function Module... CALL FUNCTION 'CRM_ORDER_MAINTAIN' EXPORTING it_partner = lt_partner_com CHANGING ct_input_fields =

  • Silly question (I hope) re: Adjustment Brush in LR3

    For some strange reason, my Adjustment brush is not working for "Sharpening."  All of the other functions (i.e. Exposure, Clarity, etc.) seem to work just fine....only the sharpening is causing me headache.  Does anyone have a suggestion?  For the re

  • Someone suggest a Toshiba laptop for me pleez...

    Hello to all: I'm looking for a new laptop.  I've had 2 Toshibas in the past and I'd like to stick with Toshiba for my next one.  After looking at everything in the stores, however, I'm not finding exactly what I want...which is: -curved front edge (

  • HT2509 Can you see the list of fonts in the actual font?

    Is it possible to see the name of the font in the list in the actual font?