Decoding base64-encoded SSL files

There is a way to decode the base64 contents of .crt, .key, and .pem files to display human-readable text, but I can't remember how to do it.  "base64 -d" doesn't work cause there's some garble in there.  I think I used the openssl command for this.  Anyone know?

Is this what you are looking for? http://www.madboa.com/geek/openssl/#cert-exam

Similar Messages

  • Decode Base64 and save as binary file

    Hi there,
    I am using Adobe Air 1.5 with JavaScript and want to save a file to my hard
    drive. I get the data from a WebService via SOAP as a Base64 encoded string. A test-string is attached. When I try to decode it with
    the WebKit function "atob()" and try to save this bytes with following code, I can't open the file.
    this.writeFile = function(outputfile, content, append){
    var file =a ir.File.applicationStorageDirectory.resolvePath(outputfile);
    var stream = newa ir.FileStream();
    if (append) {
    stream.open(filea, ir.FileMode.APPEND);
    }else {
    stream.open(filea, ir.FileMode.WRITE);
    try{//Binärdaten
    stream.writeBytes(content0, , content.length);
    }catch(e){//Textdaten
    stream.writeUTFBytes(content);
    stream.close();
    The same happens when I try to open a file from my HDD and read in the bytes. When I decode it to base64, the string is not equal to the string, which is correct.
    I attached a working Base64 string, which I could convert back to a zip-file via a only encoder.
    So my question is, how can I decode a Base64 string and save the binary data to a file?
    Thank you for your help.

    I rewrote the Base64 decoder/encoder to use it with a ByteArray. Here ist the code:
    var byteArrayToBase64 = function(byteArr){
        var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         var encOut = "";
        var bits;
        var i = 0;
        while(byteArr.length >= i+3){
            bits = (byteArr[i++] & 0xff) << 16 | (byteArr[i++] & 0xff) << 8 | byteArr[i++] & 0xff;
              encOut += base64s.charAt((bits & 0x00fc0000) >> 18) + base64s.charAt((bits & 0x0003f000) >> 12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f));
        if(byteArr.length-i > 0 && byteArr.length-i < 3){
            var dual = Boolean(byteArr.length - i - 1);
            bits = ((byteArr[i++] & 0xff) << 16) | (dual ? (byteArr[i] & 0xff) << 8 : 0);
            encOut += base64s.charAt((bits & 0x00fc0000) >> 18) + base64s.charAt((bits & 0x0003f000) >> 12) + (dual ? base64s.charAt((bits & 0x00000fc0) >> 6) : '=') + '=';
        return encOut;
    var base64ToByteArray = function(encStr){
        var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         var decOut = new air.ByteArray(); 
        var bits;
        for(var i = 0, j = 0; i<encStr.length; i += 4, j += 3){
            bits = (base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | base64s.indexOf(encStr.charAt(i +3)) & 0xff;
            decOut[j+0] = ((bits & 0xff0000) >> 16);
              if(i+4 != encStr.length || encStr.charCodeAt(encStr.length - 2) != 61){
                   decOut[j+1] = ((bits & 0xff00) >> 8);
              if(i+4 != encStr.length || encStr.charCodeAt(encStr.length - 1) != 61){
                   decOut[j+2] = (bits & 0xff);
        return decOut;

  • Problem with base64 encoding an xml file with accented characters

    Oracle 10.2.0.1.0 Enterprise Edition running under windows 2003 server
    DB Characterset UTF-8
    I have a routine which takes an xml file and base64 encodes it, and the base64encoded text is stored in a clob column of a table.
    The xml file is stored in UTF-8 format.
    The routine works correctly, except when there are accented characters.
    I am using dbms_lob.loadclobfrom file to load the file.
    DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
        DBMS_LOB.LoadCLOBFromFile(
              DEST_LOB     => dest_clob
            , SRC_BFILE    => src_clob
            , AMOUNT       => DBMS_LOB.GETLENGTH(src_clob)
            , DEST_OFFSET  => dst_offset
            , SRC_OFFSET   => src_offset
            , BFILE_CSID   =>dbms_lob.default_csid
            , LANG_CONTEXT => lang_ctx
            , WARNING      => warning
        DBMS_LOB.CLOSE(src_clob);base 64 encoded xml with accented character -- incorrect
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxncDpBcHBs
    aWNhdGlvblByb2ZpbGUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx
    L1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0
    dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2Zp
    bGVzLzEuMS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9z
    eXN0ZW1zLXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAu
    QXBwbGljYXRpb25Qcm9maWxlLnhzZCINCiAgICB4bWxuczpncD0iaHR0cDovL25h
    bWVzcGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4x
    LjAiDQogICAgVW5pcXVlSUQ9Ik1FIiBQcm9maWxlVmVyc2lvbj0iMS4xLjAiIEVy
    cmF0YVZlcnNpb249IjAiPg0KICAgIDxncDpEZXNjcmlwdGlvbj5Gb3J1bSBUZXN0
    PC9ncDpEZXNjcmlwdGlvbj4NCiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iw6Fj
    Y2VudCIgRXh0ZXJuYWw9InRydWUiIFR5cGU9IkJ5dGVTdHJpbmciIEVuY29kaW5n
    PSJIRVgiIEZpeGVkTGVuZ3RoPSJmYWxzZSIgTGVuZ3RoPSIxNiIgUmVhZFdyaXRl
    PSJ0cnVlIiBVcGRhdGU9InRydWUiIE9wdGlvbmFsPSJ0cnVlIiAvPiAgICANCjwv
    Z3A6QXBwbGljYXRpb25Qcm9maWxlPg0Kbase 64 encoded xml without accented character -- correct
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxncDpBcHBs
    aWNhdGlvblByb2ZpbGUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx
    L1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0
    dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2Zp
    bGVzLzEuMS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9z
    eXN0ZW1zLXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAu
    QXBwbGljYXRpb25Qcm9maWxlLnhzZCINCiAgICB4bWxuczpncD0iaHR0cDovL25h
    bWVzcGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4x
    LjAiDQogICAgVW5pcXVlSUQ9Ik1FIiBQcm9maWxlVmVyc2lvbj0iMS4xLjAiIEVy
    cmF0YVZlcnNpb249IjAiPg0KICAgIDxncDpEZXNjcmlwdGlvbj5Gb3J1bSBUZXN0
    PC9ncDpEZXNjcmlwdGlvbj4NCiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iYWNj
    ZW50IiBFeHRlcm5hbD0idHJ1ZSIgVHlwZT0iQnl0ZVN0cmluZyIgRW5jb2Rpbmc9
    IkhFWCIgRml4ZWRMZW5ndGg9ImZhbHNlIiBMZW5ndGg9IjE2IiBSZWFkV3JpdGU9
    InRydWUiIFVwZGF0ZT0idHJ1ZSIgT3B0aW9uYWw9InRydWUiIC8+ICAgIA0KPC9n
    cDpBcHBsaWNhdGlvblByb2ZpbGU+DQo=the xml file in use is
    <?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:ApplicationProfile>The file is being loaded from a windows xp professional 32 bit system.
    If I just convert the xml text of the file using
    select utl_raw.cast_to_varchar2(
    utl_encode.base64_encode(
    utl_raw.cast_to_raw(
    '<?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:applicationprofile>'
    ))) from dual;I get the following
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGdwOkFwcGxp
    Y2F0aW9uUHJvZmlsZSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEv
    WE1MU2NoZW1hLWluc3RhbmNlIgogICAgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRw
    Oi8vbmFtZXNwYWNlcy5nbG9iYWxwbGF0Zm9ybS5vcmcvc3lzdGVtcy1wcm9maWxl
    cy8xLjEuMCBodHRwOi8vbmFtZXNwYWNlcy5nbG9iYWxwbGF0Zm9ybS5vcmcvc3lz
    dGVtcy1wcm9maWxlcy8xLjEuMC9HUC5zeXN0ZW1zLnByb2ZpbGVzLjEuMS4wLkFw
    cGxpY2F0aW9uUHJvZmlsZS54c2QiCiAgICB4bWxuczpncD0iaHR0cDovL25hbWVz
    cGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4xLjAi
    CiAgICBVbmlxdWVJRD0iTUUiIFByb2ZpbGVWZXJzaW9uPSIxLjEuMCIgRXJyYXRh
    VmVyc2lvbj0iMCI+CiAgICA8Z3A6RGVzY3JpcHRpb24+Rm9ydW0gVGVzdDwvZ3A6
    RGVzY3JpcHRpb24+CiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iw6FjY2VudCIg
    RXh0ZXJuYWw9InRydWUiIFR5cGU9IkJ5dGVTdHJpbmciIEVuY29kaW5nPSJIRVgi
    IEZpeGVkTGVuZ3RoPSJmYWxzZSIgTGVuZ3RoPSIxNiIgUmVhZFdyaXRlPSJ0cnVl
    IiBVcGRhdGU9InRydWUiIE9wdGlvbmFsPSJ0cnVlIiAvPiAgICAKPC9ncDphcHBs
    aWNhdGlvbnByb2ZpbGU+Edited by: Keith Jamieson on Jul 13, 2012 9:59 AM
    added code tag for last base64 encoded object

    Not sure if utl_i18n is already there in version prior to 11.2.0.2.
    But on above mentioned version I can do the simplified method
    SQL> SELECT utl_i18n.raw_to_char (
             utl_encode.base64_encode (
               xmltype (
                 '<?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:ApplicationProfile>').getblobval (
                 NLS_CHARSET_ID ('utf8'))),
             'utf8')
             x
      FROM DUAL
    X                                                                                                                                                    
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGdwOkFwcGxp                                                                                     
    Y2F0aW9uUHJvZmlsZSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEv                                                                                     
    WE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6c2NoZW1hTG9jYXRpb249Imh0dHA6Ly9u                                                                                     
    YW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2ZpbGVzLzEu                                                                                     
    MS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1z                                                                                     
    LXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAuQXBwbGlj                                                                                     
    YXRpb25Qcm9maWxlLnhzZCIgeG1sbnM6Z3A9Imh0dHA6Ly9uYW1lc3BhY2VzLmds                                                                                     
    b2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2ZpbGVzLzEuMS4wIiBVbmlxdWVJ                                                                                     
    RD0iTUUiIFByb2ZpbGVWZXJzaW9uPSIxLjEuMCIgRXJyYXRhVmVyc2lvbj0iMCI+                                                                                     
    CiAgPGdwOkRlc2NyaXB0aW9uPkZvcnVtIFRlc3Q8L2dwOkRlc2NyaXB0aW9uPgog                                                                                     
    IDxncDpEYXRhRWxlbWVudCBOYW1lPSLDoWNjZW50IiBFeHRlcm5hbD0idHJ1ZSIg                                                                                     
    VHlwZT0iQnl0ZVN0cmluZyIgRW5jb2Rpbmc9IkhFWCIgRml4ZWRMZW5ndGg9ImZh                                                                                     
    bHNlIiBMZW5ndGg9IjE2IiBSZWFkV3JpdGU9InRydWUiIFVwZGF0ZT0idHJ1ZSIg                                                                                     
    T3B0aW9uYWw9InRydWUiLz4KPC9ncDpBcHBsaWNhdGlvblByb2ZpbGU+Cg==                                                                                         
    1 row selected.which encodes and decodes properly on my system even with accented characters.

  • Encode and Decode Base64

    Hi All,
    I need to Encode and Decode Base64 File. 
    Please let me know if there is any Function Modules or Class Methods to achieve the requirement.
    Thanks in advance.
    Regards
    Joseph
    Message was edited by: Joseph Brown

    Hi,
    This is the encoded base64 file in XML format:
    <?xml version="1.0" encoding="UTF-8"?>
    <Z_CREFO_DOC>
    <E_PDF><![CDATA[JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29k
    ZT4+CnN0cmVhbQp4nE2MPQ/CMAxEd/8Kj/aQEKehIWvFh8QElTfEVNFOGUr7/0UagcTd8vSkuxmd
    FY9u6wGDLs4rRA1dhfvvCeYIaDbbZU8c9Dxk7LMGG50RGkWsHobExpj7F1NjhBzfCgG5tAR/Z0
    5pYMN6Qs9OJACxuhlY0n5Kde4aRwL/0A6e4hnWVuZHN0cmVhbQplbmRvYmoKNiAwIG9iagoxMzEK
    ZW5kb2JqCjQgMCBvYmoKPDwvVHlwZS9QYWdlL01lZGlhQm94IFswIDAgNTk1LjIyIDg0Ml0KL1Jv
    dGF0ZSAwL1BhcmVudCAzIDAgUgovUmVzb3VyY2VzPDwvUHJvY1NldFsvUERGIC9UZXh0XQovRXh0
    R1N0YXRlIDEwIDAgUgovRm9udCAxMSAwIFIKPj4KL0NvbnRlbnRzIDUgMCBSCj4+CmVuZG9iagoz
    IDAgb2JqCjw8IC9UeXBlIC9QYWdlcyAvS2lkcyBbCjQgMCBSCl0gL0NvdW50IDEKL1JvdGF0ZSAw
    Pj4KZW5kb2JqCjEgMCBvYmoKPDwvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMyAwIFIKPj4KZW5kb2Jq
    CjcgMCBvYmoKPDwvVHlwZS9FeHRHU3RhdGUKL09QTSAxPj5lbmRvYmoKMTAgMCBvYmoKPDwvUjcK
    NyAwIFIPgplbmRvYmoKMTEgMCBvYmoKPDwvUjkKOSAwIFIPgplbmRvYmoKMT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0nqC
    naRkeRRcKaUpXQo+PgpzdGFydHhyZWYKMjU5NgolJUVPRgo=]]>
    </E_PDF>
    <C_ERROR></C_ERROR>
    </Z_CREFO_DOC>
    Can i pass all these characters or i need to transform it first, extract the value of the element and decode? Finally i need to write the decoded outcome to a file (a pdf file) to the hard drive (may be with: OPEN DATASET P_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT)
    I saw this hint but I think there should be more to it (eg. transformation of the initial decoded xml file and the writing it to hard drive using the Open Dataset for Input...):
    ****************being of report *************************
    DATA: z       TYPE string,
          encode  TYPE string,
          decode  TYPE string .
    DATA: obj  TYPE REF TO cl_http_utility,
          cref TYPE REF TO if_http_utility.
    CREATE OBJECT : obj.
    cref = obj.
    z = 'what u have to encode'.
    encode = obj->if_http_utility~encode_base64( z ) .
    decode = obj->if_http_utility~decode_base64( encode ).
    ****************end of report ***************************
    What do i need more to the above report

  • Base64 encode decode question

    Hi
    I use the auclair base64 class to encode and decode base64 locally and it works great.
    But when I send the string to my server and back (aspx), I cannot decode it I have the 2030 error from flash.
    When I compare the encoded string from both end they look the same.
    I make sure it is fully loaded before attempting the decode.
    Is this a common bug or I'm I wrong somewhere?
    Thanks
    I use the latest air.

    The -d switch on the openssl base64 command enables debugging; it's the short version of the --debug switch.  Probably not what you're after, either.  The -D switch would be more typical, that's the short version of --decode switch, and probably what you had intended.
    The -i (--input) and -o (--output) switches allow you to specify input and output files, which is one way to pass a whole lot of data into that command.
    Do you have an example of some of the text that you're working with?

  • Improper decoding of base64 encoded attachment on Exchange 2007 SP1

    I'm using Exchange 2007 SP1. My java application sends email to users of exchange 2007 SP1. The email contains an email as an attachment which is base64 encoded . This email when sent to users on exchange 2007 SP1 shows blank attachment. The same email when sent to users on different exchange (e.g. Exchange 2003) shows the correct attachment i.e. the attachments are not blank. While sending the mail i'm setting name of the attachment in Content-Type header but it is not there when we look at the rfc contents of the mail received on ex 2007 SP1.  It seems exchange 2007 is not able to decode the base 64 contents properly. Below are the rfc contents of the mail which show few headers in the attachment part instead of the base64 content. Please suggest some solution to it. It's urgent.
    Received: from test80.psjpr.com (192.168.0.243) by exchange01.psjpr.com
     (192.168.0.138) with Microsoft SMTP Server id 8.1.263.0; Fri, 11 Apr 2008
     18:53:12 +0530
    From: Admin <[email protected]>
    To: test test1 <[email protected]>
    Date: Fri, 11 Apr 2008 18:53:12 +0530
    Subject: Retrieved from : testingggggg
    Thread-Topic: Retrieved from : testingggggg
    Thread-Index: Acib1zFeboxSL6S4RuaeI0AaCou0pQ==
    Message-ID: <[email protected]>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Exchange-Organization-AuthAs: Anonymous
    X-MS-Exchange-Organization-AuthSource: exchange01.psjpr.com
    X-MS-Has-Attach: yes
    X-MS-TNEF-Correlator:
    Content-Type: multipart/mixed;
     boundary="_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_"
    MIME-Version: 1.0
    --_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_
    Content-Type: text/plain; charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    The message you requested is attached.
    --_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_
    Content-Type: message/rfc822
    Subject:
    Thread-Index: Acib1zFexS+KMQAOSD+lcMut076Wyg==
    Accept-Language: en-US
    X-MS-Has-Attach:
    X-MS-TNEF-Correlator:
    Content-Type: text/plain; charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    MIME-Version: 1.0
    --_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_--

    Did you ever this to work ?

  • Since Firefox 4, I can get a background image to work using base64 encoded, but not a local file, this worked in Firefox 3, how do I resolve this.

    Using either of the 4 examples shown below, to have a background image display inside about:blank worked in Firefox 3.x (using Stylish add-on), however since Firefox 4, only using the base64 encoded version of images works. Is there any way to fix this so I don't have to encode every image I wish to use? Encoding the image makes the stylish file absolutely huge, & a real pain to keep encoding whenever I want to change the image.
    body:empty { background: url("resource:/res/images/OnFire.jpg")
    body { background-image: url("resource:/res/images/OnFire.jpg")
    body:empty { background:url("data:
    body { background-image: url("data:
    I've also previously disabled most of the add-ons, except for Status-4-Evar, Stylish, & Firebug, in an attempt to see if something else was interfering, but no change.
    I can supply a copy of the previously working (FF 3.x) code to some of the about:blank styles if needed for testing purposes.

    Type '''about:addons'''<enter> in the address bar to open the '''Add-ons Manager.'''
    Hot key; '''<Control>''(Mac:<Command>)'' <Shift> A)'''
    On the left side of the page, select '''Plugins.'''
    Is it listed here? Select '''Disable.'''

  • Yet another Base64 encoder / decoder

    Hi, I would like introduce a different Base64 encoding scheme which yields slightly more compact results when encoding international characters.
            This is an implementation of BASE64UTF9 encoder and decoder.
            Common practice converts Java strings to UTF8 before Base64 encoding.
            UTF8 is not so space efficient in representing non-ASCII characters.
            While UTF9 is impractical as raw data in most 8 bit machines, it fits
            well within Base64 streams since 3 symbols can represent 2 UTF9 nonets.
            In this implementation, a modified UTF9 (flipped bit 9) is chosen to
            ensure nonet '0x000' never appear but maybe be inserted if needed.
            This implementation is also coded in such a way that it is possible to
            use Base100 encoding. When run from command line, it will perform a
            test with random strings and display encoding compactness compared to
            to other existing schemes.
    public class B64utf9 {
            private static final String look =
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
    //"\u0010\u0011\u0012\u0013\u0014!\"#$%&'()*+,-./ 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
            private static final int BASE = look.length();
            private static final int SYMB = (int)java.lang.Math.pow(BASE, 1.5) / 2;
            public static String decode(String str) {
                    long j = 1, k = 0, q = 0;
                    StringBuffer buf = new StringBuffer();
                    for(int p = 0; p < str.length(); p++) {
                            k += look.indexOf(str.charAt(p)) * j;
                            for(j *= BASE; j >= SYMB * 2; j /= SYMB * 2) {
                                    q = q * SYMB + k % SYMB;
                                    if(k % (SYMB * 2) >= SYMB) {
                                            buf.append((char)q);
                                            q = 0;
                                    k /= SYMB * 2;
                    return buf.toString();
            public static String encode(String str) {
                    long j = 1, k = 0;
                    StringBuffer buf = new StringBuffer();
                    for(int p = 0; p < str.length(); p++) {
                            long r, q = str.charAt(p);
                            for(r = 1; r * SYMB <= q; r *= SYMB);
                            for(; r > 0; r /= SYMB) {
                                    k += ((q / r) % SYMB + (r > 1 ? 0 : SYMB)) * j;
                                    for(j *= SYMB * 2; j >= BASE; j /= BASE) {
                                            buf.append(look.charAt((int)k % BASE));
                                            k /= BASE;
                    if(j > 1) buf.append(look.charAt((int)k));
                    return buf.toString();
            public static void main(String arg[]) throws Exception {
                    java.util.Random rnd = new java.util.Random();
                    for(double q = 1; q < 9; q++) {
                            int x = 0, y = 0, z = 0;
                            int r = (int)java.lang.Math.pow(Character.MAX_VALUE, 1 / q);
                            for(int p = 0; p < 999; p++) {
                                    StringBuffer buf = new StringBuffer();
                                    while(rnd.nextInt(99) > 0) {
                                            char k = 1;
    // varying ASCII density
                                            for(int j = 0; j < q; j++)
                                                    k *= rnd.nextInt(r);
                                            buf.append(k);
                                    String str = buf.toString();
    // regression
                                    if(!decode(encode(str)).equals(str))
                                            System.out.println(str);
    // count encoded length
                                    x += encode(str).length();
                                    y += new sun.misc.BASE64Encoder().encode(str.getBytes("utf8")).length();
                                    z += new sun.misc.BASE64Encoder().encode(str.getBytes("gb18030")).length();
                            System.out.println(x +","+ y +","+ z);
    }{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Good idea! Sometimes it depends on what you want to encode too, however.
    I suppose there is a case where general purpose compression does not work very well - random generated data.
    Here's how I tested it:
    class Count {
            private static String enc(String src, String set) throws Exception {
                    return new String(src.getBytes(set), "iso-8859-1");
            private static byte[] dec(byte[] src, String set) throws Exception {
                    return new String(src, set).getBytes("iso-8859-1");
            public static void main(String[] arg) throws Exception {
                    java.util.Random rnd = new java.util.Random();
                    int x = 0, y = 0;
                    for(int k = 0; k < 99; k++) {
                            byte[] raw = new byte[rnd.nextInt(99)];
                            for(int z = 0; z < raw.length; z++)
                                    raw[z] = (byte)(rnd.nextInt(256));
                            String str = new String(raw, "utf16");
                            byte[] b6u = str.getBytes("x-base64utf9");
                            byte[] gz2 = enc(enc(str, "utf8"), "x-gzip").getBytes("x-base64");
                            x += b6u.length;
                            y += gz2.length;
                            if(!str.equals(new String(b6u, "x-base64utf9")))
                                    System.out.println(str);
                            if(!str.equals(new String(dec(dec(gz2, "x-base64"), "x-gzip"), "utf8")))
                                    System.out.println(str);
                    System.out.println(x +","+ y);
    }The above code does not include my my encoders, I put my encoders code as nio.charset package and can be downloaded from [SF.|http://sourceforge.net/project/showfiles.php?group_id=248737]
    PS: sorry about the confusion, please allow me to clarify that the UTF9 encoder is not interchangeable with existing Base64 encoders. There is a compatible (hopefully) encoder in my package, however.

  • File saveAsOpen and Base64 encoding...

    In order to send the activeDocument to a web service, i need to save is as a file image, and send in an xml format.
    Thus, i also need to encode it in Base64.
    At this point everything is OK.
    But between the saveAs of the file, its reopening, and its encoding, its corrupted.
    I receive an error on the Mongrel server.
    The Base64 encoder seems to work well, the rest of the code seem to be also ok, so I think my problem is either I do not save it correctly, either i do not reopen it correctly...
    Please save me :(
    Here is the code :
              /* STEP 1 : save current document as image file (temporary) */
              var docRef = activeDocument;
              var filepath=app.path.toString()+"/"+docRef.name+".jpg";//create the image file in the installation folder of Photoshop
              var file = new File(filepath);
              //var options = new ExportOptionsSaveForWeb();
              //options.format = SaveDocumentType.PNG;
              var options = new JPEGSaveOptions();
              options.quality=8;
              docRef.saveAs (file, options, true, Extension.LOWERCASE);
              //docRef.exportDocument (file, ExportType.SAVEFORWEB , options);
              file.close();
    /* I code here dialogBox and httpCOnenction object creation
    that do not need to be written here
    (but if you think it's important, i can give you the full script)
              var f= new File(filepath);
              f.open();
              var buffer = f.read(f.length);
              f.close();
    I build an HttpConnection object called "send"
    */                 send.request='"+f.name+""+f.length+""+base64encode(buffer)+"';
    Here is the Server error :
    Exception working with image: Not a JPEG file: starts with 0xc7 0xff `/var/folders/Nz/NzlixjchF+WAvFkZK9vVRU+++TM/-Tmp-/test599-0.jpg'

    Let's give you everything in fact, it will be more simple (by the way the code is suppose to become OpenSource)<br /><br />I work on Mac, Photoshop CS3 (10.0.1)<br />I use JavaScript<br />HTTP request received by a Mongrel server (Ruby on Rails)<br /><br />// Copyright 2008. Studio Melipone. All rights reserved. <br />// Licence GNU LGPL<br />// Send the active document to the UpShot web service (http://upshotit.com)<br />//  The document is sent as a .png file, as a draft on the user's account.<br />// Therefore you must have a document opened and Adobe Bridge installed to perform this script.<br /><br />/*<br />     <javascriptresource><br />          <name>UpShot</name><br />          <type>automate</type><br />          <about><br />          Script for Upshot <br />          Copyright 2008 Studio Melipone <br />          http://upshotit.com <br />          </about><br />          <enableinfo>true</enableinfo><br />     </javascriptresource>     <br />*/<br /><br />#target photoshop<br />#include "Base64.jsx"<br /><br />app.bringToFront();<br /><br />if( documents.length==0)// is a document opened ?<br />     alert("There are no Photoshop documents opened !")<br />else {<br />          /*********************************************/<br />          /* STEP 1 : save current document as image file (temporary) */<br />          /******************************************/<br />          var docRef = activeDocument;<br />          var filepath=app.path.toString()+"/"+docRef.name+".jpg";//create the image file in the installation folder of Photoshop<br />          var file = new File(filepath);<br />          //var options = new ExportOptionsSaveForWeb();<br />          //options.format = SaveDocumentType.PNG;<br />          var options = new JPEGSaveOptions();<br />          options.quality=8;<br />          docRef.saveAs (file, options, true, Extension.LOWERCASE);<br />          //docRef.exportDocument (file, ExportType.SAVEFORWEB , options);<br />          file.close();<br />          <br />          /********************************************************/<br />          <br />     // Only Bridge can use HttpConnection, so we test if it is installed<br />     var bridgeTarget = BridgeTalk.getSpecifier(getAppSpecifier("bridge")); <br />                    <br />     if( !bridgeTarget ) { <br />          alert("Adobe Bridge not installed, needed to continue."); <br />     } <br />     else {     <br />          preferences.rulerUnits = Units.PIXELS;<br />          displayDialogs = DialogModes.NO;<br />          <br />          /**********************************/<br />          /* STEP 2 : retrieve user's login & password */<br />          /*******************************/<br />          <br />          res = "dialog { text: 'UpShot authentication', \<br />                         info: Panel { orientation: 'column', alignChildren:'right', \<br />                                             text: 'Please Identify Yourself', \<br />                                             login: Group { orientation: 'row', \<br />                                                  s: StaticText { text:'Login :' }, \<br />                                                  e: EditText { characters: 30 } \<br />                                             }, \<br />                                             passwd: Group { orientation: 'row',  \<br />                                                  s: StaticText { text:'Password :' }, \<br />                                                  e: EditText { characters: 30, properties:{noecho: true} }, \<br />                                             } \<br />                                   }, \<br />                         buttons: Group { orientation: 'row', \<br />                                        okBtn: Button { text:'OK', properties:{name:'ok'} }, \<br />                                        cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \<br />                         } \<br />                    }"; <br />          <br />          dlg = new Window (res); <br />          dlg.center(); <br />          dlg.show(); <br /><br />          var login = dlg.info.login.e.text;//retrieve the values given in the form<br />          var pass = dlg.info.passwd.e.text;<br /><br />          /******************************/<br />          /* STEP 3 : send image through Bridge */<br />          /***************************/<br />          var f= new File(filepath);<br />          f.open();<br />          var buffer = f.read(f.length);<br />          f.close();<br />          <br />          alert("file size "+file.length);<br />          alert("f size "+f.length);<br />          alert("BUF "+buffer);<br />          alert(base64encode("B64 "+base64encode(buffer)));<br />          <br />          // create a new BridgeTalk message object <br />          var bt = new BridgeTalk; <br />          // target the Adobe Bridge application <br />          bt.target  = bridgeTarget; <br />          //p173 of Javascript Tools Guide for CS3 for http message<br />          bt.body = "\<br />               if(!ExternalObject.webaccesslib ) {\<br />                    ExternalObject.webaccesslib = new ExternalObject('lib:webaccesslib');\<br />               }\<br />               var http = new HttpConnection('http://127.0.0.1:3000/en/users/get_id.xml') ; \<br />               var idfile = new File('"+app.path.toString()+"/id.xml') ;\<br />               http.response = idfile ; \<br />               http.username = '"+login+"';\<br />               http.password = '"+pass+"';\<br />               http.mime='text/xml';\<br />               http.responseencoding='utf8';\<br />               http.execute();\<br />               http.response.close();\<br />               http.close();\<br />               idfile.open();\<br />               var send = new HttpConnection('http://127.0.0.1:3000/en/users/'+idfile.read()+'/upshots') ; \<br />               send.method = 'POST';\<br />               send.username = '"+login+"';\<br />               send.password = '"+pass+"';\<br />               send.mime='text/xml';\<br />               send.requestheaders=['Host','http://localhost:3000'];\<br />               send.requestheaders=['Accept','*/*'];\<br />               send.requestheaders=['Content-Type','text/xml'];\<br />               send.request='<upshot><title>titleforyourimage</title><file_name>"+f.nam e+"</file_name><size>"+f.length+"</size><javafile>"+base64encode(buffer)+"</javafile></ups hot>';\<br />               send.execute();\<br />               idfile.toSource();\<br />          ";<br />          <br />          bt.onResult = function(result) { <br />               object = bt.result = eval(result.body);<br />               //file.remove();<br />               //object.remove();<br />               //bridge.quit ();<br />               return eval(result.body); <br />          } ;<br />          <br />          bt.onError = function( message ) { <br />               var errCode = parseInt (message.headers ["Error-Code"]); <br />               throw new Error (errCode, message.body); <br />          } ;<br />                    <br />          //send the message ( also launch the targetted application)<br />          bt.send(10);<br />     <br />     /**********************************************/<br />     /* STEP 4: Once all done, delete the image previously created */<br />     /*******************************************/<br />     }<br />}<br /><br />//////////////////////////////////////////////////////////////////<br />/////////////////////////////////////////////////////////////////<br />/*functions from http://www.ps-scripts.com/bb/viewtopic.php?t=1282 */<br />//////////////////////////////////////////////////////////////<br />/////////////////////////////////////////////////////////////<br /><br />function getAppSpecifier(appName) {<br /><br />   if (isCS2()) {<br />      if (appName == 'photoshop') {<br />         return 'photoshop-9.0';<br />      }<br />      if (appName == 'bridge') {<br />         return 'bridge-1.0';<br />      }<br />      // add other apps here<br />   }<br /><br />   if (isCS3()) {<br />      if (appName == 'photoshop') {<br />         return 'photoshop-10.0';<br />      }<br />      if (appName == 'bridge') {<br />         return 'bridge-2.0';<br />      }<br />      // add other apps here<br />   }<br /><br />   return undefined;<br />};<br /><br />function isCS2() {<br />   var appName = BridgeTalk.appName;<br />   var version = BridgeTalk.appVersion;<br /><br />   if (appName == 'photoshop') {<br />      return version.match(/^9\./) != null;<br />   }<br />   if (appName == 'bridge') {<br />      return version.match(/^1\./) != null;<br />   }<br /><br />   return false;<br />};<br />function isCS3() {<br />   var appName = BridgeTalk.appName;<br />   var version = BridgeTalk.appVersion;<br /><br />   if (appName == 'photoshop') {<br />      return version.match(/^10\./) != null;<br />   }<br />   if (appName == 'bridge') {<br />      return version.match(/^2\./) != null;<br />   }<br /><br />   return false;<br />};

  • XML file with an attached MIME encoded ZIP file

    Hi all,
    I'm new to SAP WAS and MIME encoding/decoding, and I'm trying to generate an XML file with an attachment which is also MIME encoded.
    1) I have dummy files (1.jpg, 2.jpg) and I'm trying to zip these files into one zip file (files.zip).
    2) I'm trying to MIME encode/decode this zip file.
    3) I'm trying to attach this MIME encoded zip file to existing XML file.
    Which FMs could I use to accomplish this?  Your help is very appreciated.
    Thank you.
    below is a file example that I'm trying to generate.
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="--XXXXboundary text"
    Content-Transfer-Encoding: 7bit
    This is a multi-part message in MIME format.
    --XXXXboundary text
    Content-Type: text/xml;
         charset="utf-8"
    Content-Transfer-Encoding: 8bit
    <?xml version="1.0" encoding="utf-8"?>
    <abc/>
    <def/>
    --XXXXboundary text
    Content-Type: application/octet-stream;       name="files.zip"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment
    UEsDBBQAAAAIAI9EejAs5k34H84DAAYgBAAMAAAAMDAyMjQ5MTEucGRmnLsJWBNJ2zb6jmJIIIFE
    BAMIJGEVBSKGRRAhEGQNoGwKYoiAEnYRUFGIkBAQFzYXRNHAAEGQZRy2ATFDUAHfGScSIUwQMMrM
    ECGADptA0n/jzLtc//dd51znVAKdru6uqn7q6fu5764qQz

    Just create an applet (extend JApplet)... add a JTextArea to it....fill the text area with the text from an XML doc.
    To get the text of the XML doc just do something like..
    File xmlFile = new File("<path to xml file>");
    FileInputStream fis = new FileInputStream(xmlFile);
    byte[] bytes = new byte[(int) xmlFile.length()];
    fis.read(bytes);
    fis.close();
    String xmlText = new String(xmlBytes);
    textArea.setText(xmlText);
    ...try something like that (assuming..i understand what it is u want)

  • Parse xml in inputstreamobject and decode base64

    Hello
    I have got a http-package with content-type text/xml, from a HttpURLConnection object.
    From the HttpURLConnection object i get an InputStreamObject.
    Now i'm looking for the easiest to parse the xml, that is in the Inputstream object.
    The xml just contains base64 encoded data and i need to decode this data into a byte array.
    I have not much experience with java and xml, so it would be nice when somebody could help me.
    Kind regards,
    ClaudeMichelle

    ClaudeMichelle wrote:
    i'm looking for the easiest to parse the xml, that is in the Inputstream object.
    The xml just contains base64 encoded data and i need to decode this data into a byte array.Below tutorial will help.
    BASE64 Decoder Stream from Sun Microsystems:*
    This class implements a BASE64 Decoder. It is implemented as a FilterInputStream, so one can just wrap this class around any input stream and read bytes from this filter. The decoding is done as the bytes are read out.
    Authors: John Mani, Bill Shannon+[For actual tutorial visit here |http://www.java2s.com/Code/Java/File-Input-Output/BASE64DecoderStreamfromSunMicrosystems.htm]
    *Cheers,
    typurohit* (Tejas Purohit)

  • Base64 encoded attachments misunderstood by recipients

    My boss uses Mail.app, and a number of people have reported that they can never open her attachments. When I look at the files they receive from her, they appear to be base64 encoded, and indeed decoding them makes them perfectly readable. Unfortunately, I don't think any of the built-in apps in OS X can do this decoding. Also, not all of the recipients use Macs.
    At first I thought that the issue might be that she was not using the 'Windows friendly attachments'. However, I tried sending a message from another coworker's computer without selecting that option, and it worked fine. I then discovered that the problem is that if she drags her attachments into the message rather than selecting them via 'add attachment', they don't work. Basically, if the attachment is inline rather than at the end of the message.
    I still thought that using 'Windows friendly attachments' would fix the problem, so on another Mac I tried setting Mail.app to always send Windows Friendly attachments (To do this, just open Mail.app, make sure you aren't composing an e-mail, and then under Edit > Attachments, select 'Always send Windows Friendly attachments'). However, this didn't work, either.
    So, I think that the solution is just to tell her either to use the 'Add Attachment' button or to drag the file to the end of the message.
    It's a shame that inline attachments don't work for so many e-mail clients (notably Gmail). I don't think that this is an Apple innovation... is it?
    I hope that helps someone,
    Greg

    Did you ever this to work ?

  • Get canvas.toDataURL('image/jpeg') and convert base64 encoding to java.sql.Blob

    Convert canvas.toDataURL('image/jpeg') to java.sql.Blob.
    I am using oracle adf so I am able to action a backing bean from javascript and pass in parameters as a map. I pass in the canvas.toDataURL('image/jpeg') which I then try to decode in my bean. Using BASE64Decoder and the converting the bytearray to a file I can see the image is corrupted as I can't open the file thus converting the bytearray to blob is also a waste.
    Has anyone any ideas on base64 encoding from canvas.toDataURL to file or Blob?

    Use Case:
    A jsf page that enables a user to take photos using the HTML5 canvas feature - interact with webcam -, take photos and upload to profile
    1. I have created the jsf page with the javascript below; this pops up as a dialog and works okay and onclick an upload image, triggers the snapImage javascript function below and sends the imgURL parameter to the serverside managedbean
    <!-- java script-->
    function snapImage(event){
                    var canvas = AdfPage.PAGE.findComponent('canvas');
                    AdfCustomEvent.queue(event.getSource(),"getCamImage",{imgURL:canvas.toDataURL('image/jpeg'),true);
                    event.cancel();
    <!-- bean -->
    public void getCamImage(ClientEvent ce){
    String url=(String)ce.getAttributes().get("imgURL");
    decodeBase64URLToBlob(url);
    private BlobDomain decodeBaseB4URLToBlob(String url64){
                    BASE64Decoder de=new BASE64Decoder();
                    byte[] bytes=de.decode(url64);
                    File file=new File("abc.jpg");
                    InputStream in = new ByteArrayInputStream(bytes);
                    BufferedImage bImageFromConvert = ImageIO.read(in);
                    in.close();
                    ImageIO.write(bImageFromConvert, "jpg", file);
                    return createBlobDomainFromFile(file);
    ----problem---
    Accessing the generated jpeg file shows the image is corrupted, probably missing bytes or encode/decoder issues.and the blob image after uploading to database is saved as a binary stream which ondownload doesnt render as an image or anything i know of.
    Is there anyways of achieving the conversion without errors?

  • Decode Base64(Pdf) to binary

    Hi all,
    I have a WS - PI - File scenario.
    So I get a base64 coded PDF-File and have to create a decoded binary file.
    First I used an UDF. But the created document is invalid and not to open by Acrobat. After reading the forum the conclusion is,  it is impossible to convert data in mapping step, is'nt it.
    But what are the other possibilities?
    Regards
    Mathias

    You can do this in the mapping using Base64.decode() method from SAP standard API (com.sap.aii.utilxi.base64.api.*)
    Check my WIKI section for ref: [Sending Binary Data to Inbound Plain HTTP Adapter in XI and PI |http://wiki.sdn.sap.com/wiki/display/XI/SendingBinaryDatatoInboundPlainHTTPAdapterinXIand+PI] where i used encode method in HTTP client code.
    You can check decode method code in the java snippet  "Java Mapping - Base64 Decryption and Unzipping Code "
    Edited by: Praveen Gujjeti on Jul 16, 2010 4:59 PM

  • Illegal character in Base64 encoded data

    Hi,
    I'm trying to get a print out the public key as a String, which I am getting it in as a base64 encoded, but I get error:
    Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in Base64 encoded data.
    Code below:
    public static void main(String[] args) {
              File pubKeyFile = new File("C:\\usercert.pem");
              StringBuffer buffer = new StringBuffer();
                   try {
                        FileInputStream fis = new FileInputStream(pubKeyFile);
                        try {
                             InputStreamReader isr = new InputStreamReader(fis, "UTF8");
                             Reader in = new BufferedReader(isr);
                             int ch;
                             while((ch = in.read()) > -1) {
                                  buffer.append((char)ch);
                             in.close();
                             String key = buffer.toString();
                             System.out.println("key is: " + key);
                                          //This is where the code fails:
                             String keyDecode = Base64.decodeString(key);
                             System.out.println("key ecode is: " + keyDecode);
                        } catch (UnsupportedEncodingException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                        } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                        }

    Hi ejp,
    It's a rsa public, the usercert.pem looks like below,
    so since it's not an x509 certificate not sure if I
    can read it using a
    java.security.cert.CertificateFactory?
    Basically I just want to print the public and private
    key out as a String. Any help is appreciated.
    -----BEGIN PUBLIC KEY-----
    MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCg8yo6rDhsNiwUfV
    R37HgF4bWq
    oG13Nd9XLT+Z0VLzCkWJZOdzGNQnnm7ujoQ8gbxeDvIo9RG5I3eZte
    BwD91Nf6P/
    E9lvJQDL2Qnz4EXH/CVW9DeEfvY1UJN9kc6q6KkYEPWssvVvlDOp2s
    lbEKZCJtaP
    vVuGCAqfaps8J0FjOQIDAQAB
    -----END PUBLIC KEY-----
    import java.security.KeyFactory;
    import java.security.interfaces.RSAPublicKey;
    import java.security.spec.X509EncodedKeySpec;
    import sun.misc.BASE64Decoder;
    public class MakeRSAPublicKeyFromPEM
        public static void main(String[] args) throws Exception
            final String publickeyAsString =
                    "-----BEGIN PUBLIC KEY-----\n"+
                    "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCg8yo6rDhsNiwUfVR37HgF4bWq\n"+
                    "oG13Nd9XLT+Z0VLzCkWJZOdzGNQnnm7ujoQ8gbxeDvIo9RG5I3eZteBwD91Nf6P/\n"+
                    "E9lvJQDL2Qnz4EXH/CVW9DeEfvY1UJN9kc6q6KkYEPWssvVvlDOp2slbEKZCJtaP\n"+
                    "vVuGCAqfaps8J0FjOQIDAQAB\n"+
                    "-----END PUBLIC KEY-----\n";
            final BASE64Decoder decoder = new BASE64Decoder();
            final byte[] publicKeyAsBytes = decoder.decodeBuffer(publickeyAsString.replaceAll("-+.*?-+",""));
            final X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(publicKeyAsBytes);
            final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            final RSAPublicKey publicKey = (RSAPublicKey)keyFactory.generatePublic(publicKeySpec);
            System.out.println("Modulus ........... " + publicKey.getModulus());
            System.out.println("Public exponent ... " + publicKey.getPublicExponent());
    }

Maybe you are looking for

  • Path selection question for an image of neurons

    I have a photo of neurons taken by a microscope as a TIFF.  I'd like to remove the black background color and any "cloudiness" that appears in the photo but still maintain the detail of the neurons and the connections.   Essentially, I'd like to chan

  • Cisco Email IronPort is not sneding email to outside [Errno 61] Connection refused

    Dears, I have deployed new ESA C170. for incoming emails it works normally. But when we send email to most of domains like yahoo, hotmail, gmail...etc, the email get stuck and tracking shows ( queued for delivery). Mail logs show the following error:

  • Outlook 2013 window missing Last Modified By information for Sharepoint 2010 calendar appointment

    We have been running Sharepoint 2010 for about a year now, along with Office 2010. We have recently begun testing the upgrade to Office 2013. What we've found is that when in Outlook 2013 viewing a synced Sharepoint 2010 calendar appointment, you no

  • Delete Personnel Numbers

    Hi My clent has deleted one personnel Number by using PU00, But when he go to Pa20 and enter particular deleted personnel number system gives a message "personnel number not assigned" but a flag will come in front of Personnel data. Please suggest ho

  • Error code:-2147217401 Error code name:agentTimeout

    Hi, We are getting the below error ReportSDKException Occurred com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Server agent has timed out.---- Error code:-2147217401 Error code name:agentTimeout while adding SQL to crystal report f