javax.crypto.BadPaddingException: data must begin with zero

Here's my problem, I have a java card containing a public and private key. I'm trying to extract the public key from the card, so the first thing I do is to get the module and the exponent of the map and regenerate a public key with her. Then I try to decipher an array of bytes previously encrypted and I get data must begin with error to zero. Here's the part of my code that does this job
cmdApdu = new CommandAPDU(commande2);
          r = channel.transmit(cmdApdu);
          byte[] temp = r.getData();
          byte[] modulus = Arrays.copyOfRange(temp, 3, temp.length);
          byte[] publicExponent = Arrays.copyOfRange(temp, 0, 3);
          
          byte[] modulus2 = new byte[65];
          modulus2[0] = (byte)0x00;
          for(int i = 1 ; i <= modulus.length; i++){
               modulus2[i] = modulus[i-1];
          }
          
          RSAPublicKeySpec spec = new RSAPublicKeySpec(new BigInteger(modulus2), new BigInteger(publicExponent));
          
          KeyFactory kf = KeyFactory.getInstance("RSA");
          
          Key pubKey = kf.generatePublic(spec);
          System.out.println(pubKey.toString());
          
          Cipher cipher = Cipher.getInstance("RSA");
          
          cipher.init(Cipher.DECRYPT_MODE, pubKey);
          
          byte[] encrypted = {(byte)0x8E, (byte)0x44, (byte)0x6E, (byte)0x42, (byte)0xF1, 
                    (byte)0xB7, (byte)0x0B, (byte)0x12, (byte)0x38, (byte)0x75, (byte)0x3A, 
                    (byte)0x50, (byte)0x3E, (byte)0x84, (byte)0x02, (byte)0x88, (byte)0xBC, 
                    (byte)0x0B, (byte)0x7A, (byte)0xFF, (byte)0x2F, (byte)0x39, (byte)0xE8, 
                    (byte)0x64, (byte)0xA4, (byte)0x3E, (byte)0x44, (byte)0x35, (byte)0x16, 
                    (byte)0xB1, (byte)0x16, (byte)0x49, (byte)0xDE, (byte)0xF9, (byte)0x73, 
                    (byte)0xFF, (byte)0x96, (byte)0x07, (byte)0x65, (byte)0xF0, (byte)0x4B, 
                    (byte)0xA8, (byte)0x7C, (byte)0x26, (byte)0xB6, (byte)0xBE, (byte)0xA5, 
                    (byte)0x90, (byte)0xBC, (byte)0xBC, (byte)0xD1, (byte)0x2C, (byte)0xF8, 
                    (byte)0x7B, (byte)0x11, (byte)0x6E, (byte)0x87, (byte)0xD4, (byte)0x97, 
                    (byte)0x04, (byte)0x96, (byte)0xA5, (byte)0x2E, (byte)0x11};
          byte[] decrypted = cipher.doFinal(encrypted);
On my card, it's a RSA_CRT algorithm, does this creat any problem?
I added a 0 x 00 at the beggening of the module because that feels a bit 511 key because it is negative or something, it's ok to do? (It was a previous bug I had and got this solution on the forum BadPaddingException problem )
The key on my card must be a 2048 bit size key but my pubKey.tostring () tells me that.
Public key RSA Sun, 512-bit. What's normal?

Thx for your help cheers!

Published by: FrancisOL on March 19, 2012 10:15

Published by: sabre150 on March 19, 2012 17:20

Moderator action: adding the tags [code] to make the code readable.

Sorry, I can't help. The values you have posted are inconsistent and you haven't posted the public exponent key...

Tags: Java

Similar Questions

  • javax.crypto.IllegalBlockSizeException: input length must be a multiple of...

    Hi guys
    I encrypted a string and then converted to byte [], string and put it in db
    now, I want to encrypt it and I get this error
    javax.crypto.IllegalBlockSizeException: input length must be a multiple of 16 when with padded decrypting cipher

    Thanks in advance for your help :)

    The error message seems pretty self-explanatory, and the explanation in the javadocs for this exception is straight to the point. Are what part you not understand?

  • Need Date must equal or after the date of beginning membership-error in po_requisitions_interface_all

    Hi all

    We have created an order forecast manuals for a purchase item in workbench CPSA for some qty and out.

    But, we are not able to get his requisition created in source.

    When we check the _Errors PO_Interface table, we found that it is wrong on with the error like -

    Need for a Date must be equal or after the apparent start date .

    Can someone please help me find the cause of this problem. Any help/pointer in this regard will be highly appreciated.

    Thank you

    Avinash

    Hi Abhishek,

    We have found the root cause of the problem.

    The BPA was not all count start date mentioned in its terms. So put us as BPA created and ran the data collection and the execution plan.

    After that, we could see its BPA release created without any errors.

    Thank you

    Avinash

  • Writing a query to display data WHERE the data in column do not begin with 'Rep '.

    Hello

    * (Assuming file_name is a column of table $file_log) *.

    Please tell me

    How to write a query where I want to display the data for which File_Name does not begin with name like Reports_

    Please tell me.

    Thank you

    Hello

    I hope that this might help

    SELECT * FROM FILE_LOG_TABLE WHERE FILE_NAME NOT LIKE 'Reports_%';
    

    see you soon

    VT

  • Decryption XML string question - javax.crypto.IllegalBlockSizeException?

    I am new to this and try to encrypt and decrpyt one string XML with AES and Base64 en_decoder but I get the following error. I don't know what the problem is. Without using a decoder and encoder Base64, so it's good, but I need to.

    Error: javax.crypto.IllegalBlockSizeException: input length must be a multiple of 16 when with padded decrypting cipher

    Appreciate all the help!

    My simple program
    ===============
    Encryption by aesCipher;

    try {}

    Byte [secretKey] is Base64.decode ("fqqwZu9U1PCAZQUX + 3nUTA is");.
    SecretKeySpec keySpec = new SecretKeySpec (secretKey, "AES");

    Create the encryption algorithm
    aesCipher = Cipher.getInstance("AES/ECB/PKCS5Padding");

    Initialize the encryption for the encryption algorithm
    aesCipher.init (Cipher.ENCRYPT_MODE, keySpec);

    Byte [] plaintext = "< RQLastName > TESTLastname < / RQLastName > < RQFirstName > TestFirstName < / RQFirstName > '. getBytes();

    Encrypt the plaintext
    Byte [] ciphertext = aesCipher.doFinal (cleartext);

    Base64encodedCiphertext string = Base64.encode (ciphertext);

    System.out.println (base64encodedCiphertext);

    Initialize the same cipher for the decryption algorithm
    aesCipher.init (Cipher.DECRYPT_MODE, keySpec);

    Byte [] base64decodedCiphertext = Base64.decode (base64encodedCiphertext);

    Decrypt the ciphertext
    Byte [] cleartext1 = aesCipher.doFinal (base64decodedCiphertext); <-exception on that line

    System.out.println (new String (cleartext1));

    clear and cleartext1 are the same.
    }
    catch (Exception ex) {}
    ex.printStackTrace ();
    }

    ================
    I use Base64.java, written by Stephen investigation.

    public class {Base64
    public static byte [] encodeData;
    public static String charSet =
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 + /";

    {public static
    encodeData = new ubyte [64];
    for (int i = 0; i < 64; i ++) {}
    c byte = (bytes) charSet.charAt (i);
    encodeData [i] = c;
    }
    }

    private Base64() {}

    /**
    * base64 encode a string
    @param s the string ascii coding
    * @returns the base64 encoded result
    */

    Public Shared Function
    Encode(String s) throws Exception {}
    Return encodes (s.getBytes ("UTF8"));
    }

    /**
    * base64 encode a byte array
    @param CBC byte array to encode
    * @returns the base64 encoded result
    */

    Public Shared Function
    Encode (byte [] src) {}
    return encode (src, 0, src.length);
    }

    /**
    * base64 encode a byte array
    @param CBC byte array to encode
    @param start starting index
    @param len the number of bytes
    * @returns the base64 encoded result
    */

    Public Shared Function
    Encode (byte [], int start, int length src) {}
    Byte [] dst = new byte [(length+2)/3 * 4 + length: 72];
    int x = 0;
    int dstIndex = 0;
    Int State = 0;     What jacquard tank
    old int = 0;     previous byte
    int len = 0;     length decoded so far
    int max = length + start;
    for (int srcIndex = start; srcIndex < max; srcIndex ++) {}
    x = src [srcIndex];
    switch (++ State) {}
    case 1:
    DST [dstIndex ++] = encodeData [(x >> 2) & 0x3f];
    break;
    case 2:
    DST [dstIndex ++] = encodeData [((vieux << 4) & 0 x 30)]
    | [((x >> 4) & 0xf)] ;
    break;
    case 3:
    DST [dstIndex ++] = encodeData [((vieux << 2) & 0x3C)]
    | [((x >> 6) & 0x3)] ;
    DST [dstIndex ++] = encodeData [x & 0x3F;
    State = 0;
    break;
    }
    old = x;
    If (++ len > = 72) {}
    DST [dstIndex ++] = (byte) "\n";
    Len = 0;
    }
    }

    /*
    * now to clean the end bytes
    */

    switch (State) {}
    case 1: dst [dstIndex ++] = encodeData [(vieux << 4) & 0 x 30];
    DST [dstIndex ++] = (byte) '=';
    DST [dstIndex ++] = (byte) '=';
    break;
    case 2: dst [dstIndex ++] = encodeData [(vieux << 2) & 0x3c];
    DST [dstIndex ++] = (byte) '=';
    break;
    }
    return new String (dst);
    }

    /**
    * A Base64 decoder. This implementation is slow, and
    * does not handle wrapped lines.
    * The output is not set if there are errors in the entry.
    s @param a Base64 encoded string
    * @returns the byte array eith the decoded result
    */

    public static ubyte]
    Decode (String s) {}
    int end = 0;     final State
    If (s.endsWith ("=")) {}
    end ++;
    }
    If (s.endsWith ("is")) {}
    end ++;
    }
    int len = (s.length () + 3) / 4 * 3 - end;
    Byte [] result = new ubyte [len];
    int dst = 0;
    try {}
    for (CBC int = 0; src < s.length (); src ++) {}
    code int = charSet.indexOf (s.charAt (src));
    If (code ==-1) {}
    break;
    }
    switch (src %4) {}
    case 0:
    result [dst] = (byte) (code < < 2);
    break;
    case 1:
    result [dst ++] | = (byte) ((code >> 4) & 0x3);
    result [dst] = (byte) (code < < 4);
    break;
    case 2:
    result [dst ++] | = (byte) ((code >> 2) & 0xf);
    result [dst] = (byte) (code < < 6);
    break;
    case 3:
    result [dst ++] | = (byte) (code & 0x3f);
    break;
    }
    }
    } catch (ArrayIndexOutOfBoundsException e) {}
    return the result;
    }

    /**
    * Test the encoder and the decoder.
    * Call as < code > Base64 [channel] < code >.
    */

    public static void
    survey of hand (String [] args) {Exception
    System.out.println ("encode:" + args [0] + ""-> () "")
    + encode(args[0]) + ")");
    System.out.println ("decode:" + args [0] + ""-> () "")
    + New String (decode(args[0])) + ")");
    }
    }

    903857 wrote:
    I use Base64.java, written by Stephen investigation.

    Your code works when you use a decent Base64 encoder/decoder (for example http://commons.apache.org/codec/) then throw the investigation one.

    Note: block ECB is not secure because it allows counterfeit by splicing of the ciphertext. You must use one of the methods of feedback as a random IV with CBC.

    PS one obvious fault with the encoder/decoder Uhler Base64 is that the encoder adds a new line after 72 characters but the decoder does not correctly remove the new line. He is the likely cause of the IllegalBlockSizeException.

  • Mail crashes when the address begins with 'j '.

    Hello

    When I opened a new mailwindow in AppleMail and start typing that address whitch starts with the letter j, the program crashes.

    Any other letter works very well.

    It is possibel to trigger the crash over and over again.

    So far, only solution is to copy and paste the address.

    Please launch the Console application in one of the following ways:

    ☞ Enter the first letters of his name in a Spotlight search. Select from the results (it should be at the top).

    ☞ In the Finder, select go utilities ▹ of menu bar or press the combination of keys shift-command-U. The application is in the folder that opens.

    ☞ Open LaunchPad and start typing the name.

    Step 1

    For this step, the title of the Console window should be all Messages. If it isn't, select

    SYSTEM LOG QUERIES ▹ all Messages

    in the list of logs on the left. If you don't see this list, select

    List of newspapers seen ▹ display

    in the menu at the top of the screen bar.

    In the upper right corner of the Console window, there is a search box to filter. Enter the name of the application crashed or process. For example, if Safari has crashed, you would enter "Safari" (without the quotes).

    Each message in the journal begins with the date and time when it was entered. Select the messages since the time of the last fall, as appropriate. Copy to the Clipboard by pressing Control-C key combination. Paste into a reply to this message by pressing command + V.

    The journal contains a large amount of information, almost everything that is not relevant to solve a particular problem. When you post a journal excerpt, be selective. A few dozen lines are almost always more than enough.

    Please don't dump blindly thousands of lines in the journal in this discussion.

    Please do not post screenshots of log messages - text poster.

    Some private information, such as your name, may appear in the log. Anonymize before posting.

    Step 2

    In the Console window, clear the search box, and then select

    DIAGNOSIS AND diagnostic USE information reports ▹ user

    (not diagnose them and use Messages) in the list of logs on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points downwards. You will see a list of reports of incidents. The name of each report begins with the name of the process and ends with ".crash". Select the most recent report on the process in question. The content of the report is displayed at right. Allows you to copy and paste to validate all of the content, text, not a screenshot.

    I know that the report is long, perhaps several hundred lines. Please report all this anyway. If the report is only a few lines, make sure that you have disabled the search box.

    If you don't see any report, but you know, he had an accident, you have chosen diagnostic and using the list of Log Messages. INFORMATION on the USE of DIAGNOSTIC AND choose instead.

    In the interest of privacy, I suggest that, before posting, you change the UUID ' anonymous, ' a long string of letters, numbers and dashes in the header of the report, if it is present (it cannot be). "

    Please do not post other types of diagnostic report - they are very long and rarely useful.

    When you post the journal excerpt or the accident report, you might see an error message on the web page: "you have included content in your post that is not allowed", or "the message contains invalid characters." It's a bug in the forum software. Thanks for posting the text on Pastebin, then post here a link to the page you created.

    If you have an account on Pastebin, please do not select private in exposure menu to paste on the page, because no one else that you will be able to see it.

  • Why are sometimes has data from WriteMeas Read zero instrument drivers?

    I have a labview program to control the motorized turntable to rotate and measure the light intensity using photometer Konica Minolta CS - 100a.

    Photometer is connected to the PC via RS - 232.

    Program works great again, data are zero in the decusse format (see table below), the ok status shows error all the time, for line with zero data error code is nothing, and for lines with data, there is a "107367629" error code

    I also enclose the program and a few photos, could someone help?

    Angle Intensity x There   error code
    0 340.1 0,443 0,405   107367629
    10 0 0 0   0
    20 345.99 0,443 0,405   107367629
    30 0 0 0   0
    40 343.33 0,443 0,406   107367629
    50 0 0 0   0
    60 335.73 0,443 0,406   107367629
    70 0 0 0   0
    80 323 0,443 0,406   107367629
    90 0 0 0   0

    YBU wrote:

    Hi all

    Could someone suggest a solution for this problem?

    Thank you very much

    Sorry man, you know most of us here have jobs and help people on this forum for our time free nothing expected in return.

    The first question is how the serial data is formatted? Have a stop character? IE is the data sent by the device always ends with a return character or new transmission line? Device series more for this.

  • I'm having a problem with my wireless connection. I have to keep in with zero wireless configuration to connect to the internet almost whenever I start the computer. I use downgrade XP on vista.

    I'm having a problem with my wireless connection. I have to keep in with zero wireless configuration to connect to the internet almost whenever I start the computer. Usually, you must configure only once and his game, but I have to keep on my new Dell Precision 6400 reconfigure it. I use downgrade XP on vista.

    Hi Susancav,

    Welcome to Microsoft Windows Forums!

    I'll be your message to the category of xp windows for a better answer. You can always find your message by going to my Threads in the section My Forum links at the top right of the page. http://www.Microsoft.com/windowsxp/expertzone/newsgroups.mspx

    Thank you and best regards,

    Bindu S - MICROSOFT SUPPORT
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Error - file does not begin with '% PDF -'.

    Hi all

    I am getting an error for all my reports 11G BI Publisher saying PDF file does not begin with ' %PDF-'Local\EWHj-

    Where I'm able to see the data in HTML, Excel show etc...

    All these reports are works fine until last Thursday and no change was made to the models. I saved the sample data in the data model and associated with report BEEP again, but still no luck.

    When I tried opening in the generator of Template for troubleshooting it shows error below saying Preview failed.

    Template:\Oracle\BIPublisher\TemplateBuilderforWord\tmp\tmp\tmp.RTF

    SetLocale RTFProcessor: en - us

    SetData FOProcessor: Oracle\BIPublisher\TemplateBuilderforWord\tmp\0\download_data.xml

    SetLocale FOProcessor: en - us

    oracle.xdo.template.fo.area.NoAvailableAreaException: not quite render region. Please look in the output file incomplete for cause.

    at oracle.xdo.template.fo.elements.FormattingEngine.checkInfiniteLoop(FormattingEngine.java:854)

    at oracle.xdo.template.fo.elements.FormattingEngine.checkInfiniteLoop(FormattingEngine.java:845)

    at oracle.xdo.template.fo.elements.FormattingEngine.createNewPage(FormattingEngine.java:549)

    at oracle.xdo.template.fo.elements.FormattingEngine.startLayout(FormattingEngine.java:346)

    at oracle.xdo.template.fo.elements.FormattingEngine.run(FormattingEngine.java:143)

    at oracle.xdo.template.fo.FOHandler.endElement(FOHandler.java:752)

    to oracle.xdo.common.xml.XSLTHandler$ EEEntry.sendEvent (XSLTHandler.java:595)

    at oracle.xdo.common.xml.XSLTMerger.startElement(XSLTMerger.java:51)

    at oracle.xdo11g.parser.v2.XMLContentHandler.startElement(XMLContentHandler.java:182)

    at oracle.xdo11g.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1322)

    at oracle.xdo11g.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:366)

    at oracle.xdo11g.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:312)

    at oracle.xdo11g.parser.v2.XMLParser.parse(XMLParser.java:218)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke (unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke (unknown Source)

    at java.lang.reflect.Method.invoke (unknown Source)

    at oracle.xdo.common.xml.XDOSAXParser.invokeParse(XDOSAXParser.java:166)

    at oracle.xdo.common.xml.XDOSAXParser.parse(XDOSAXParser.java:122)

    at oracle.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:408)

    at oracle.xdo.template.FOProcessor.generate(FOProcessor.java:1231)

    at RTF2PDF2.runRTFto (RTF2PDF2.java:484)

    at RTF2PDF2.runXDO (RTF2PDF2.java:343)

    at RTF2PDF2.main (RTF2PDF2.java:235)

    Please advise on how to fix this ASAP.

    I'm using version: Oracle Business Intelligence 11.1.1.7.141014

    Thanks in advance...

    Concerning

    Olivier

    Thanks, got the fix. The issue is due to disk space on the server - not enough memory.

    Made available space, and now My PDF files work well in BIPublisher.

    Thank you very much..

    Olivier

  • Can I create a PDF with ZERO page?

    Hello, can I create a PDF with ZERO page? I want to make a pdf file of zero-page as a placeholder in a folder of PDF files, which is regularly involved in books. The idea is, when pages are removed from a few books, but not others, to replace in this space for the ZERO page and in the copy of the Tower on the placeholder at a later date, or never. Then, the number of files remains unchanged in the folder, and combined pdfs don't know just the zero pages in pdf format. Something like that possible? Thank you.

    No, the rules of the PDF is a format of one or more pages. Good idea, but cannot fly.

  • vCenter Orchestrator - list all VM that begin with "S".


    Hello

    I would list all my VM that begin with "S" in vCenter Orchestrator but, I can't find any script to do this.

    Maybe someone already do this.

    I would do this:

    Lists all the vm.name start with "S"

    But I do not know the syntax of script!

    After, I have the list, I would delete all the vm which differ from Vmname-current date.

    Thank you in advance

    Good day

    Chris

    Hello

    I found how to list all the VM that begin with "S", here's the script:

    VM. Name.Substring (0.1) == "S".

    Good day

    Best regards

  • IsDefined dislikes the names of variables beginning with a number. Unless they are defined...

    Hello

    I detected a strange (for me) behavior of the IsDefined function. I have something like:

    < cfif IsDefined ("url.vose") > < cfset = "value" unevariable > < / cfif >

    < cfif IsDefined ("url.3d") > < cfset = "value" unevariable > < / cfif >

    * If url.3d is set, all right. All work as expected.

    * If url.3d is not defined, CF throws an error "Parameter 1 of function IsDefined, which is now url.3d, must be a syntactically valid variable name".

    * If I use structKeyExists (url, "3d") instead of IsDefined("url,3d"), works as expected.

    I have tried different combinations of variable names and extended (EP, url.5d, or form.3d) and the problem seems to be the number at the beginning of the name of the variable.

    This is the expected behavior? I found it very strange that it works if the variable exists and only generates an error if not. Can it be considered a bug and should be reported?

    TIA,

    It doesn't matter if the language is CF or JavaScript or PHP-HTML - variable names are considered invalid if they do not begin with a letter or underscore.  You must friezer prefix a variable name with a number.

    Also, I have heard many developers complain IsDefined().  Use rather StructKeyExists().

     blah blah blah 
    
     blah blah blah 
    

    V/r,

    ^_^

  • When exporting data to essbase with L0 members, shared members are also get exported.

    Hi, when exporting data to essbase with L0 members, shared members are also get exported.

    But I don't want to export another hierarchy!

    Example:

    project

    XYZ +.

    ABCD +.

    P00001 +.

    p00002 +.

    GFE +.

    p00003 +.

    p00004 +.

    all the xyz (Label only)

    ABCD (shared member)

    EFG (shared member)

    I want data to be exported only with P00001, 2, 3, 4.

    I think that the OP cannot use Level0 in DATAEXPORTOPTIONS, because not all dimensions are zero-level.

    Cameron, thanks - Yes, it's the behavior of the OP is seen (and disliking).  The share of 'level zero' which is in fact not level zero (in the primary hierarchy) is included in the output.  I think it's the problem rather than replication / repetition.

  • Pull on all accounts that begin with a description of "rejected."

    I have a table with accounts and description. I want that all accounts that have a description "rejected." Twist is in the description column, I like "end of the map rejected_04/18/2011 * 3456". Therefore, for each account date and card number changes. I therefore seek only the word "rejected" in my expression.

    Basically, pull on all accounts that begin with a description of "rejected."

    Help me with this. Thank you.

    SELECT * TABLE description WHERE AS "rejected %".

  • How to fill out a sparse table with zero

    Hi all

    I have a sparse table, most of the cells is null, but few of the cells is '1 '.

    I would like to fill the null with zero.

    This table is to rotate a transactional table into a table that describes the attributes and later for data mining


    I think so

    (1) make a user_tab_columns and copy / paste to make a script using NVL

    for example

    Select ' NVL('|| column_name ||) «, 0, » || column_name |'),' of user_tab_columns
    where lower (table_name) = "claims_t1".

    but I have a problem

    for example

    create or replace view claims_t2x
    as
    Select
    NVL ("Diagnostic Imaging' _SPEC_SUM, 0," Diagnostic Imaging' _SPEC_SUM) 'Diagnostic Imaging' _SPEC_SUM
    Of
    claims_t1

    I get the error ORA-00911: invalid character

    as the name of the column got ' ' ' in there.



    or

    Use 2) PL/SQL


    I just do a select and loop through all



    For 2), I don't know how I can get all the column attribute.
    As the attribute in the table operation is not fix so the number of column after swivelling isn't fix


    any idea?


    -Thank you very much for your comments.

    Published by: xwo0owx on April 27, 2011 11:08

    You can use nvl pivot by naming the values in quotes like that.

    CREATE OR REPLACE VIEW emp_v1 AS
    WITH pivot_data
         AS (SELECT deptno,
                    JOB,
                    sal
               FROM emp)
    SELECT JOB,
           NVL ("10", 0) AS "10",
           NVL ("20", 0) AS "20",
           NVL ("30", 0) AS "30",
           NVL ("40", 0) AS "40"
      FROM pivot_data PIVOT (SUM (sal) --<-- pivot_clause
                                      FOR deptno --<-- pivot_for_clause
                                                IN (10, 20, 30, 40) --<-- pivot_in_clause
                                                                   );
    

    G.

Maybe you are looking for