How to Generate a key (for SecretKeySpec) out of a string literal.

Hi,
I have a string literal representation of a HEX value key which I use to send encrypted data from C++ to Java (on Sockets).
I haven't managed to convert the string representation to a value that I can use with SecretKeySpec() constructor to create a working AES 128b key.
The last attempt was this:
String strKey = new String("E5E6E7E9EA392A2B2D256489012145E5");
byte[] byteKey = new BigInteger(strKey,16).toByteArray();
SecretKey skey = new SecretKeySpec(byteKey, "AES");It didn't work because the byte array was of size 17 byte. (java.security.InvalidKeyException: Invalid AES key length: 17 bytes)
Is there an obvious straight forward way to this which I'm missing? (How would you transfer a key in HEX representation?)
Thank you.

Because of the way negative BigIntegers are represented, when the high-order bit of the high-order byte of a positive BigInteger is 1, the toByteArray() emits an "extra" high order byte of zero hence your length of 17. Another problem is that, if your Hex string happens to begin "00X..." where X is less than 8, then toByteArray() will not emit the superflous leading zero byte and the size will be 15 or less.
java.math.BigInteger b = new java.math.BigInteger("ECBA1127878", 16);
byte [] keyBytes = new byte[16];
byte [] bigBytes = b.toByteArray();
System.arraycopy(bigBytes, 0, keyBytes, 0, Math.min(keyBytes.length, bigBytes.length));as an example is only a 4 lines of code.

Similar Messages

  • How to get the "Key" for Dimension in SSAS.

    Hi
    How to get the "Key" for Dimension in SSAS.
    (Below value is the PPSParameters table XML column value in PPSDatabase in SharePoint.
    Below three key values are belongs to "Dimension". I have tried to find the key but I could net get it.)
    <NewDataSet>
    <UserValues><Key>16A201A9E75128559F947D58E6D187A9</Key></UserValues>
    <UserValues><Key>7FBEA449A6ED5606973306445839619E</Key></UserValues>
    <UserValues><Key>A8F75F9720817BCD2E1DFC1C1CF1E678</Key></UserValues>
    </NewDataSet>
    Thanks & Regards
    Poomani Sankaran

    To Be Honest there is not one straight Cmdlet that atleast I have come across 
    The best way would if you have Lync monitoring server 
    Using the Lync Server 2013 Monitoring Server
    If you have the Monitoring Server role configured in your environment, and for Lync Server 2013 everyone should!, you can use information contained in the LcsCDR database to pull back the last time a user signed in.  You can run the following query* to
    pull back the user's SIP URI and their last login time:
    USE LcsCDR
    SELECT dbo.Users.UserUri, dbo.UserStatistics.LastLogInTime
    FROM dbo.UserStatistics
    JOIN dbo.Users ON dbo.Users.UserId = dbo.UserStatistics.UserId
    ORDER BY UserUri
    Which produces the following output:
    The advantage to using the Monitoring Server to obtain this data is that unlike the information contained in the rtcdyn database, the information from the LcsCDR data will persist even when the user isn't signed into Lync.
    To get approx count of users enable for Lync Server in your organisation 
    Get-CsUser -Filter {Enabled -eq $true} | MeasurE
    Please not the above command let will give you an approx number not exact 
    From the Monitoring report yet the SIP account that signed in and then from count find out how many user havent signed in this is manual task 
    Hope this is helpful 
    Please remember, if you see a post that helped you please click ;Vote As Helpful" and if it answered your question please click "Mark As Answer" Regards Edwin Anthony Joseph

  • How to generate xml-file for SAP Fiori (UI add-on) with Solution Manager 7.0.1?

    Hello Guru,
    could you please help with my issue with Fiori Installation.
    We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
    Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
    But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
    But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option  "install Add-on" as it written in Guide for ui add-on installation.
    Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
    If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
    Thanks in advance for any help!!!
    Bets regards,
    Natalia.

    Hello Guru,
    could you please help with my issue with Fiori Installation.
    We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
    Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
    But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
    But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option  "install Add-on" as it written in Guide for ui add-on installation.
    Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
    If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
    Thanks in advance for any help!!!
    Bets regards,
    Natalia.

  • How to set Shortcut keys for button in Apex

    Hi
    Could anyone help me on how to set shortcut keys for buttons in Apex.
    I need to use say ALT + S to submit the page.
    The following thread pertaining to HTML DB refered to use ACCESS key. but that couldnt work in my case.
    Re: operation of the app. with the keyboard
    Any pointers on achieving this would be helpful.
    Thanks
    Vijay

    Hi Vijay,
    I’m afraid you must do it using javascript key listener. You can’t use action() on template based buttons because they are actually not HTML buttons but images with hyperlink.
    Key listener checks which key has been pressed down and invoke some JS function. For example, write this code in page header:
    <script>
    document.onkeydown=keyCheck;
    function keyCheck(e){
         var KeyId = (window.event) ? event.keyCode : e.keyCode;
         switch(KeyId){         
              case 113:
                   doSubmit('SAVE');
                   break;                    
              case 118:
                   alert('Hello');
                   break;
    </script>
    This script will submit page with request 'SAVE' if you press F2 or will show alert message if you press F7. Modify it to your issue.
    Regards,
    Przemek

  • Exact Steps to Generate Installation keys for other systems In SolMgr4.0

    Hi friends,
    Please provide me exact Steps to Generate Installation keys for other systems In SolMgr 4.0 SR1.
    I have steps to make this thing in solmgr 3.2 as please change as it in solmgr4.0 sr1
    txn SMSY
    Expand Landscape components -> Systems
    Right click on Systems  ->New System
    Type SAPID, & Installation No. (S44 , 0040099252) & sAVE
    Expand Newly Added system
    Right Click & Create
    Now we can use the key provided by the system.
    Please make required changes as applicable in solmgr4.0 So that I can proceed.
    Also clear vat is the difference between ECC & ERP as solmgr4.0 mention both as two systems.
    Thanks & regards
    Jaswant
    +91 9949676055
    Cheers 'N' Joyce

    Hi Jaswant,
    to generate a Solution Manager Key you can process a little bit easier.
    Call transaction SMSY, press shift+F5 (you get the "other objects" popup).
    As System enter the SID of your Solution Manager.
    ->select gen.Installation/Upgrade Key (shiftctrlF10))
    then you get a new popup. In this popup you DELETE all values, enter SID of the new system, the message server of the new system and the system number of the new system. Then press generate key.
    With this procedure you do not have to add the system to SMSY to generate the key.
    Later you should add it to SMSY, maybe you have added an SLD to SMSY then the system will be added automatically. If not you have to add it manually.
    Second question ERP <> ECC
    Good question, ECC is part (a main instance) of ERP, so it is up to you if you classify your system as an ERP or ECC.
    Regards,
    Udo Lang

  • Solution Manager can't generate  installation key  for Netweaver 2004s

    I am trying to generate installation key for a new installation of
    Netweaver 2004s or 7.0 and the Solution Manager only display SAP ECC
    5.0 or 6.0 in the field production version, when i am trying do create
    a new system landscape. My Solution Manager is 4.0 release and support
    package 10. The keys generated by ECC 5.0 or 6.0 doesn't work.

    That is because SAP has not released an ECC 7.0
    NW2004s is also refered to as 7.0.  It appears that you are confusing this with ECC 5.0 and ECC 6.0
    A NW2004s installation can contain an ECC5.0 or ECC 6.0, just like it can contain a CRM 5.0 or SRM, or EP, et cetera
    The generated keys probably do not work because you have wrong hostname or instance number entered.

  • Using Solution Manager 7.0 to Generate Solution Key for SAP Netweaver 7.3 ?

    Hi, SDN Gurus.
    We are running Solution Manager 7.0.
    I am trying to generate solution key for SAP Netweaver 7.3 system. When I was creating a new system (in TCode SMSY);  I only see Newtweaver 7.1 is the latest version available in the SAP Netweaver  product version drop down list.
    Is that true that I always need to upgrade the latest/compatible version (SP & patches) of SAP Solution Manager to generate solution key for the latest released of SAP products?
    If this is the case, what version of SAP Solution Manager I need to create new system and generate solution key for SAP Netweaver 7.3? 
    Thanks for advices,
    KC

    Hi,
    Please follow the note [Note 1274430 - Installation of Solution Manager 7.0 Stack 18 and higher|https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1274430]
    and the discussions here [Direct Upgrade from Solution Manager SP16 to SP26|Direct Upgrade from Solution Manager SP16 to SP26]
    Thanks,
    Jansi

  • How to generate an Interupt for DMA transfer from Counter on NI-PCI-6602

    dear guys:
          how to generate an Interupt for DMA transfer from Counter on NI-PCI-6602,and I have set the DMA and DMA_INT, and also the global interrupt register.
    but there is no Interupt generated in the Interupt callback function.And when I have set the DMA_INT and global interrupt register ,and then read the relevant register,the relevant bit is also 0.
         I suspect there is an Interupt register contral, like the MITE, you must write the value to 0xc4 for opening .
         there is some codes In my enclosure .What can I do?
    Attachments:
    TEST.C ‏21 KB

    dear Steven_T:
            the registers are In my enclosure ,if you have some ideas,please reply me  first time.thank you !
    Attachments:
    PCI6602.pdf ‏818 KB

  • How we generate Surrogate Keys without using identify column

    Hi All,
    How we generate Surrogate Keys without using identify column.
    Regards,
    Manish

    There are various options
    1.IDENTITY columns - simplest to implement
    2. Using NEWID(), NEWSEQUENTIALID() functions (if you want to use GUID values as surrogate keys)
    3. SEQUENCE object (if SQL 2012 and above)
    4. Using custom functions to generate keys yourself
    This is an good article which compares use of GUIDs against integers as surrogate keys
    http://blog.jonathanoliver.com/integers-vs-guids-and-natural-vs-surrogate-keys/
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How we use Surrogate Keys for snowflake dimension

    Hi All,
    my question is - How we use  Surrogate Keys for  snowflake dimension
    i heard from some body Surrogate Keys only work with star schema.
    please correct me if i wrong.
    Regards,
    Manish

    Hi manishcal16PPS,
    According to your description, you can only create natural key in your dimension. But it's not working when using surrogate key. Right?
    In Analysis Services, the snowflake schema of the dimensions are represented by more than one dimension table in other words its takes multiple dimension tables to define a dimension. Surrogate key are just some extra, redundant, unique key based on the
    natural key. So there's no direct relationship or some limitations between surrogate keys and snowflake schema.
    In this scenario, since there's relationship between the two dimensions, you should create natural key. For using natural key or surrogate key. Please refer to an article below:
    Surrogate Key vs. Natural Key
    For understanding star/snowflake schema, please see:
    Understanding Star and Snowflake Schemas 
    Regards,
    Simon Hou
    TechNet Community Support

  • How much will it cost for an out of warranty repair for a water damaged iPhone 4S in the UK?

    How much will it cost for an out of warranty repair for a water damaged iPhone 4S in the UK?
    I got water in my iPhone 4S (not drenched as it was within a LifeStyle waterproof case).
    I dried it out in a bowl of rice, but the phone no longer charges, will not allow wifi, cannot locate network.

    You have to get a refurbished iPhone. As your phone is out of warranty, you will have to pay £139 at an Apple Store in order to get it > http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne

  • How to generate BP number for the employee (ECC to CRM) ...

    Hi all,
    can any one give solution for ,how to generate BP number for the employee from ECC to CRM other than active status,as i downloaded employee data from ECC to CRM through ALE/IDOC,as only active employment status employees are got BP number generated,remaining also transfered to CRM but BP number is not generated for those employees,these employee records i can able to see in the HRP5580- HRP5587 tables.
    thanks in advance.
    vamshi.
    Message was edited by:
            vamshidher rao

    Hi,
    Or are you looking for this:
    SELECT serial_number, paaf.assignment_number
    FROM pay_assignment_actions paa, per_all_assignments_f paaf
    WHERE action_status = 'C'
    AND paaf.assignment_id = paa.assignment_id
    AND serial_number IS NOT NULL
    AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date;
    - Viky
    Edited by: Viky on Dec 17, 2010 11:42 AM

  • How To Generate Spool request for a SAP-Script form

    How To Generate Spool request for a SAP-Script form

    Hai   Rahaman,
    After getting the print preview of the SCRIPT.
    Click On  PRINT.
    Buttom of the page one spool request will be generated by system.
    Go to  SP01.
    You Can Find  SPOOL Reqest Number.
    Regards.
    Eshwar.

  • Generating crypto keys for SSH support

    Hi,
    I'm having no problems getting SSH to work using the CLI crypto key command but I've noticed one thing. The crypto key command does not show up in the config...is it hidden somehow? The reason I ask is when I take an AP(1121 in this case) right out of the box and copy an existing config into it (where this config had the RSA keys already config'd)....it works with SSH? How do the keys get generated on this new AP when there is no crypto key command in the config I just loaded into it?
    .....thanks.........J

    you need to use a K9 image that supports crypto features
    For ssh dont copy and paste the config.
    Create a domain name and generate a key.

  • How to add License Key For Integration Tool kit For SAP in Linux Server

    Dear Experts,
    We are Using BO XI R3.1 SP3 Enterprise Version ,Integration Tool Kit For SAP,Live Office.
    The Server is Linux Server.
    But while generating reports in Infoview it is giving error like ""_check that you are licensed to access SAP Data Source_".
    So we came to know that license Key might Expire for Integraton Tool Kit For SAP in Bo Server.
    So can you tell me how to add the license key For BO XI R3.1 SP3 Integration Tool Kit For SAP in Linux Server.
    Thanks & Regards,
    Venkat

    On Unix / Linux you should be able to leverage the response from Raphael and change:
    Location=%BOBJDIR%/bobje/data/.bobj/registry/software/business objects/suite 11.5/sap/keycode/.registry
    For more information verify the below link
    [How do you update the SAP Integration Kit license?;
    Regrads
    Pardhu

Maybe you are looking for

  • Instalação JWS fora do Stack Java do PI

    Senhores, aqui no projeto a equipe BASIS resolveu instalar o EJB de assinatura digital SLL-NFE-JWS fora do stack java do PI, num WebAS Java específico para outras aplicações. O basis subiu os certificados, deu permissão conforme o manual e etc, porém

  • Itunes crashes on startup

    I recently updated my Iphone to IOS 7. Itunes would not allow me to connect to my phone unless I updated Itunes. After updating Itunes it proceeds to open for about 1-2 seconds followed by a message prompt that Itunes has stopped working and quits. I

  • Cant figure out what my keychain password is.

    Hey, I didn't set up this computer and I need to figure out what my keychain password is. Every thing finder help tells me to do already requires it. Any ideas? G5 Dual 1.8   Mac OS X (10.3.9)  

  • Converting epoch time to a date

    Anyone know of a function to do this. I cant find any in the api and my searches bring up nothing.

  • Exporting from Entourage to Address Book and iCal

    Dear All, I have a corrupt Entourage database which is making syncing to my iPhone through the Apple apps impossible. as such and with a huge leap of faith to mobileme I'm ditching Entourage. Anybody got any easy ways to export the contacts from Ento