Use a password as a key

hi,
I am working with some code which encrypts data being sent to streams. I currently initialise the instance in the following way.
SecretKey key = KeyGenerator.getInstance("DES").generateKey();
STStreamEncryptor encrypter = new STStreamEncryptor(key);
Here's the constructor for the STStreamEncryptor class......
public STStreamEncryptor(SecretKey key) {
// Create an 8-byte initialization vector
byte[] iv = new byte[]{
(byte)0x8E, 0x12, 0x39, (byte)0x9C,
0x07, 0x72, 0x6F, 0x5A
AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
try {
ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
// CBC requires an initialization vector
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
} catch (java.security.InvalidAlgorithmParameterException e) {
} catch (javax.crypto.NoSuchPaddingException e) {
} catch (java.security.NoSuchAlgorithmException e) {
} catch (java.security.InvalidKeyException e) {
What I want to do is to be able to use a password or phrase as the encryption key instead of generating the key. Can anyone help??
Thanks
Steve

hi,
I've used this class but it throws a number of exceptions. For example when I run the first encryption and decryption on a string it works fine. But when I try to encrypt and decrypt the next string I get an exception, IllegalBlockSizeException: Input length (with padding) not multiple of 8 bytes. Any ideas what the problem is??
Thanks
Steve

Similar Messages

  • I have accidentally deleted my IMAP password from my key chain, therefore i can no longer access my emails using mail.  I can access my email through my Gmail account no problem, so how do i fix this as i cannot remember my IMAP password.

    I have accidentally deleted my IMAP password from my key chain, as a result i cannot access my google email using the Mac Mail.  I cannot remember what the password was for IMAP, so can anyone help to resolve this.  i can access my mail by going directly to Google Mail.
    Regards JKG1135

    The password for use in the Mail application would be the same password you use when accessing Gmail by using an internet browser. The exception to that would be if you have 2-step verification enabled for Gmail. If that is the case then you would need to use an "application-specific password." If you are using 2-step, you can revoke the previous application-specific password and get a new one as described in https://support.google.com/mail/answer/1173270?hl=en

  • Installed Windows 8 on a late 2011 MacBook Air and was working fine now keyboard not working so cannot enter password? Caplocks key works but I am locked out on my own PC and cannot seem to get it to recognize built in keyboard,bluetooth,generic USB one.

    Installed Windows 8 on a late 2011 MacBook Air and was working fine now keyboard not working so cannot enter password? Caplocks key works but I am locked out on my own PC and cannot seem to get it to recognize built in keyboard,bluetooth,generic USB one.

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • Can I using Oracle Password filter without using DIP?

    Hi expert,
    Can I using Oracle Password filter without using DIP?
    I installed OID 1.1.1.5.0 and AD MS 2008 + Password Filter without other configuration about DIP.
    While Install password filter, I use 'sAMAccountName' as Source Attribute (Microsoft Active Directory) and 'orclSAMAccountName' as Target Attribute (Oracle Internet Directory) instead of using objectGUID.
    My Scenario test
    1. setup password filter follow by 20 Deploying the Oracle Password Filter for Microsoft Active Directory
    2. create user in AD
    3. create user in OID
    4. reset password in AD
    I found that it can't send password from AD to OID.
    See log below
    OID Base DN is ---->
    dc=ksso,dc=com
    About to retrive connection
    Got the Connection
    Inside Add Parent
    About to add node
    Node Added
    retval is NOT success
    Out of Add Parent
    Domain String -->
    KSSO.LOCAL
    User Domain String -->
    [email protected]
    Inside OID Search User sgslodac
    About to fire the search request
    TEST BASE -->
    dc=ksso,dc=com
    Password Update Failed. No record to update
    Search did not reterive any data
    Writing data into persistence store
    INSIDE IF PERSISTENT STORE
    Inside sgsladds::sgslperwriteData YOOOO
    Inside sgsladac c-tor
    AD Host
    10.20.5.60
    AD Port
    389
    AD Base DN
    DC=KSSO,DC=LOCAL
    Only dataattribute
    Got Registry enteries
    contact
    description
    Got Entiredn
    OU=orclpwfKSSO.LOCAL,DC=KSSO,DC=LOCAL
    Encrypted record already exists in Datastore
    Already Exists
    Encrypted record already exists in Datastore
    Already Exists
    Inside sgsladdsSearchUser
    Firing Search Request
    AD search for a user objectGUID is successfull
    Count success
    Search result fetched
    0:437 7 monsoft314 420 AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAlfdA8eazxkaNLy8BEBQHKgAAAAAmAAAAUABhAHMAcwB3AG8AcgBkACAARQBuAGMAcgBwAHQAaQBvAG4AAAAQZgAAAAEAACAAAAALknXvaho0gPrrP34AQqdBSMLHHcVupTrFuuN0lQdV0QAAAAAOgAAAAAIAACAAAAAKxX3FGNQ/lJBjETm3pRiveLFRiiCwxbrf3UNlQtk5C0AAAAC66Ip1jAzC6U1gTVP9LHETW1MwEfzxSXHcCny9wy7pFyDlLtmpnP1nGYUegAMxvJTu5yGmciBMmfZAgS1Oan3PQAAAAETSu3JcNAkdSqm2E1zxSWxClWrBid/eLHpbasjHo5cLgkGjzI6+UWNHzhfOf86wJ0uuex+++0ttFRzzMEf9atE=
    Inside sgsladds::sgsladdsgetData NEW Look
    0:437 7 monsoft314 420 AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAlfdA8eazxkaNLy8BEBQHKgAAAAAmAAAAUABhAHMAcwB3AG8AcgBkACAARQBuAGMAcgBwAHQAaQBvAG4AAAAQZgAAAAEAACAAAAALknXvaho0gPrrP34AQqdBSMLHHcVupTrFuuN0lQdV0QAAAAAOgAAAAAIAACAAAAAKxX3FGNQ/lJBjETm3pRiveLFRiiCwxbrf3UNlQtk5C0AAAAC66Ip1jAzC6U1gTVP9LHETW1MwEfzxSXHcCny9wy7pFyDlLtmpnP1nGYUegAMxvJTu5yGmciBMmfZAgS1Oan3PQAAAAETSu3JcNAkdSqm2E1zxSWxClWrBid/eLHpbasjHo5cLgkGjzI6+UWNHzhfOf86wJ0uuex+++0ttFRzzMEf9atE=
    Encoded Data Extracted in sgsladdsgetData
    437 7 monsoft314 420 AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAlfdA8eazxkaNLy8BEBQHKgAAAAAmAAAAUABhAHMAcwB3AG8AcgBkACAARQBuAGMAcgBwAHQAaQBvAG4AAAAQZgAAAAEAACAAAAALknXvaho0gPrrP34AQqdBSMLHHcVupTrFuuN0lQdV0QAAAAAOgAAAAAIAACAAAAAKxX3FGNQ/lJBjETm3pRiveLFRiiCwxbrf3UNlQtk5C0AAAAC66Ip1jAzC6U1gTVP9LHETW1MwEfzxSXHcCny9wy7pFyDlLtmpnP1nGYUegAMxvJTu5yGmciBMmfZAgS1Oan3PQAAAAETSu3JcNAkdSqm2E1zxSWxClWrBid/eLHpbasjHo5cLgkGjzI6+UWNHzhfOf86wJ0uuex+++0ttFRzzMEf9atE=
    Moving out sgsladdsgetData
    Encoded Data Extracted
    437 7 monsoft314 420 AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAlfdA8eazxkaNLy8BEBQHKgAAAAAmAAAAUABhAHMAcwB3AG8AcgBkACAARQBuAGMAcgBwAHQAaQBvAG4AAAAQZgAAAAEAACAAAAALknXvaho0gPrrP34AQqdBSMLHHcVupTrFuuN0lQdV0QAAAAAOgAAAAAIAACAAAAAKxX3FGNQ/lJBjETm3pRiveLFRiiCwxbrf3UNlQtk5C0AAAAC66Ip1jAzC6U1gTVP9LHETW1MwEfzxSXHcCny9wy7pFyDlLtmpnP1nGYUegAMxvJTu5yGmciBMmfZAgS1Oan3PQAAAAETSu3JcNAkdSqm2E1zxSWxClWrBid/eLHpbasjHo5cLgkGjzI6+UWNHzhfOf86wJ0uuex+++0ttFRzzMEf9atE=
    Incrementing the MAX_RETRY LIMIT:
    1
    numretries ====== 
    1
    Inside sgslcodsupdateChild
    1:437 7 monsoft314 420 AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAlfdA8eazxkaNLy8BEBQHKgAAAAAmAAAAUABhAHMAcwB3AG8AcgBkACAARQBuAGMAcgBwAHQAaQBvAG4AAAAQZgAAAAEAACAAAAALknXvaho0gPrrP34AQqdBSMLHHcVupTrFuuN0lQdV0QAAAAAOgAAAAAIAACAAAAAKxX3FGNQ/lJBjETm3pRiveLFRiiCwxbrf3UNlQtk5C0AAAAC66Ip1jAzC6U1gTVP9LHETW1MwEfzxSXHcCny9wy7pFyDlLtmpnP1nGYUegAMxvJTu5yGmciBMmfZAgS1Oan3PQAAAAETSu3JcNAkdSqm2E1zxSWxClWrBid/eLHpbasjHo5cLgkGjzI6+UWNHzhfOf86wJ0uuex+++0ttFRzzMEf9atE=
    Encrypted record data updated successfully
    Inside sgsladac destructor
    Inside sgslodac destructor
    Inside sgsladac destructor
    Password updation failed in child process
    Moving out sgslpascsynchDataStoreWithOID
    About to UNBIND datastore after processing the Records
    Deleting datastore object pointer
    ***********Inside sgslldpcopenLDAPConnection****************
    REG BASE Key === 
    SYSTEM\CurrentControlSet\Control\Lsa\orclidmpwf\OIDConfig
    OID Host Key
    OIDHost
    OID Host Value ====
    Oracle.OID
    am I missing something?
    or this scenario can't work without DIP?
    Thank you
    Noraset,

    Hi,
    As yingkuan had provided nice link for understanding...
    Why you od this doubt... Since, When you are holding two different Database, then you can carry out stream replicaiton, the bottom line is on the on two different DB's.. .still if they are on same host.. !!
    - Pavan Kumar N

  • Using string password

    Hi
    Can someone give me a sample code about how to use string password when encrypting and decrypting data?
    I have made an application that encrypts and decrypts data and it can even save password. Password is not created from string see code:
    KeyGenerator kgen = KeyGenerator.getInstance("Blowfish");
    SecretKey skey = kgen.generateKey();
    byte[] raw = skey.getEncoded();
    SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");
    Now I want that client can give a password and application use that while encrypting and decrypting.
    I'm using CipherOutputStream and CipherInputStream to save and open data. I'm using Blowfish algorithm.
    Regards
    Juha

    Hi Juha,
    Here is the sample code for encrypting and decrypting a string.
    import java.io.*;
    import java.security.*;
    import javax.crypto.*;
    import sun.misc.*;
    public class SecretWriting{
    public static void main(String args[]) throws Exception{
    if(args.length<2)
    System.out.println("Usage : SecretWriting -e|-d text");
    return;
    Security.addProvider(new com.sun.crypto.provider.SunJCE());
    Key key;
    try{
    ObjectInputStream in=new ObjectInputStream(new FileInputStream("des.key"));
    key=(Key)in.readObject();
    in.close();
    catch(FileNotFoundException fnfe)
    KeyGenerator generator= KeyGenerator.getInstance("DES");
    generator.init(new SecureRandom() );
    key=generator.generateKey();
    ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream("des.key"));
    out.writeObject(key);
    out.close();
    Cipher cipher=Cipher.getInstance("DES/ECB/PKCS5Padding");
    if(args[0].indexOf("e") !=-1)
    cipher.init(Cipher.ENCRYPT_MODE,key);
    String amalgam=args[1];
    for(int i=2;i<args.length;i++)
    amalgam+=" "+args;
    byte[] stringBytes=amalgam.getBytes("UTF8");
    byte[] raw=cipher.doFinal(stringBytes);
    BASE64Encoder encoder = new BASE64Encoder();
    String base64 = encoder.encode(raw);
    System.out.println(base64);
    else if(args[0].indexOf("d")!=-1)
    cipher.init(Cipher.DECRYPT_MODE,key);
    BASE64Decoder decoder = new BASE64Decoder();
    byte[] raw = decoder.decodeBuffer(args[1]);
    byte[] stringBytes = cipher.doFinal(raw);
    String result = new String(stringBytes,"UTF8");
    System.out.println(result);
    I hope this will help you out.
    Thanks
    Bakrudeen
    Technical Support Engineer
    Sun MicroSystems Inc, India

  • Preparing for the inevitable - passwords and license keys backup

    Hey all,
    I have found my HD has some issues and therefore I'll need to (unfortunately) format it entirely and restore it....
    I am doing a backup using Time Machine anyways, but to be super safe I would like to save all settings, passwords and license keys for my applications.
    Is there a place where MacOs stores this data and is there a way to save it?
    thanks a lot in advance for your help.
    ciao,
    ale

    Hi there,
    1Password cannot 'read' licences automagically from installed software. I suspect because each developer stores this in a different manner (some may not store it all). However, if you have your software licenses in email, then you can re-enter them into 1Password
    Also see Agile's help article on 1Password backups: http://help.agile.ws/1Password3/data_backup.html
    Saj

  • How do i use my own image with keying (or green screen)

    how do i use my own image witrh keying (or green screen)

    Put your sky clip on a layer below the clip you want to key. One or the other will be a connected clip. Apply  the Keying filter to foreground clip (the one with the green screen). The green will be seen as transparent and the sky will show through as the BG. Adjust as necessary in the Inspector.
    Good luck.
    Russ

  • How can I use ONE password that serves to open up multiple mozilla functions instead of entering & reentering password?

    Firefox just reset itself. Before that, I could enter a safety site, type in 1 password, and thereafter have my username and gmail password automatically display in yellow - saving my entering those two items each time. Since the Firefox reset, I can't figure out how to reset Firefox or Google or whoever it is to do what it used to do. Thanks

    Hello ericmorrel, see : [https://support.mozilla.org/en-US/kb/password-manager-remember-delete-change-passwords Password manager - Remember, delete and change saved passwords in Firefox]
    see also : [https://support.mozilla.org/en-US/kb/use-master-password-protect-stored-logins Use a Master Password to protect stored logins and passwords]
    thank you

  • JCOerror: This system does not let you log on using a password

    Hi,
    "JCOerror: This system does not let you log on using a password"
    This is the error message I get from MII tries to connect to the Production ECC using my credentials to perform a BAPI call.
    These credentials work fine interactively (using the SAP GUI) and for BAPI calls from MII on SAP Development instances.
    I can interpret this message in two ways:
    - My login can not log on using password (though I can interactively)
    - The server does not allow logging on using password only. (It might require to pre-authorize the connecting server as well).
    I guess my question can be if this error requires adding additional rights to my login for the production environment, or if this is a global SAP setup for this system?  Or something else?
    In either way, what is required to have this work?
    Thanks.

    Hi,
    Kindly try the following options.
    Try executing the BAPI seperately in se37, using your login credentials.
    Check whether RFC is enabled for the BAPI.
    Check whether the SAP server is details are furnished correctly in "SAP Server"(available under "Data Services") editor.
    We can ensure this by checking the connection status link in xMII.(Link is available under "Data Services").
    If connection status is "Running" then SAP server setting configuration is fine. Else it is not configured properly.
    Try executing the BAPI in BLS(Business Logic Services) using JCO connector.
    I believe if any one of these scenarios fail then "Proxy Error" might thrown.
    Thanks
    Rajesh Sivaprakasam

  • This system does not let you log on using a password

    hi all,  i  am very new to sap basis. i have changed the below profile parameters in RZ10.
    login/min_password_length=3
    login/min_password_lowercase=1
    login/min_password_uppercase=1
    login/min_password_digits=2
    login/min_password_specials=1
    after changing values i restarted the Instance. But the problem is when i am trying to login to the system it is showing  an error message : "This system does not let you log on using a password". I know why  this error occurs...
    but how to resolve this error? plz Help.
    Thanks in advance

    login/min_password_length=3
    login/min_password_lowercase=1
    login/min_password_uppercase=1
    login/min_password_digits=2
    login/min_password_specials=1
    The correct parameter for Min password Lenght is login/min_password_lng.
    You can change this at OS level restart and see how it goes...
    Regards
    Juan

  • Not able to open mail from my mac, gmail repeatedly asking for password. but using same password able to open gmail on safari

    not able to open mail from my mac, gmail repeatedly asking for password. but using same password able to open gmail on safari

    okay well they got me to take out some .plist files to see if that would help it didn't. I'm not sure what ones that they deleted for my self maybe someone here would be abel to tell you what ones to take out but didn't work the one that came close to working was this going into keychain and deleting the account(s) then reading them again.
    if you are to do this please back up first with Time Machine. You can do this with a usb drive.
    Okay so go back to where you had internet accounts and make sure mail is shut. click the - on the account your having problems with then quit system preferences.
    Okay so then press cmd and space bar at the same time then type 'keychain access' into the search then click on 'keychain access'
    once it is open go to the top of the window and put your email address that you are having problems with.
    once you have put in your full email, have a look at what comes up i deleted things in the kind colome with 'internet password' and anything with under name that had smtp.gmail.com or imap.gmail.com so it would look like this, map.gmail.com - internet password.
    right click and delete them. make sure not to touch any other files that dont say them things on them.
    Once you have done this quit keychain access and then restart the computer, once the computer is restarted go back to system preferences and internet accounts and re-add the account.
    Hope this helps. if something is not clear just ask.

  • I'm running windows XP using boot camp. What key do I push on the keyboard to bring up my desktop?

    I'm running windows XP using boot camp. What key do I push on the keyboard to bring up/go to my desktop?

    Have a look here http://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
    Stefan

  • I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is!

    I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is!  Can anyone help??

    You selected Encrypt iPhone Backups in iTunes.  Then you entered a password.
    It would be that specific password it is asking for.
    See here:
    https://discussions.apple.com/thread/3284065?start=0&tstart=0

  • HT204053 I cannot use the password to update apps on my second IPhone.  It only works on one of the phones. They both have the same Apple ID and password.

    I cannot use the password to update apps on my second IPhone.  It only works on one of the phones. They both have the same Apple ID and password.

    If it really does not work, change your password here https://appleid.apple.com (Manage account) and try to add the account again. I hope it helps.

  • I have two iPads and giving one to my grandson. Using my Apple id for both, can we use different passwords to access our "own" apps. Also I don't want the downloaded App to go to both iPads. Been looking for hours for an explanation! Thanks for any help.

    I have two iPads and giving 1st gen. to my grandson. Using my Apple idI for both... can we use different passwords to access our "own" apps. Also I don't want the downloaded App to go to both iPads. Been looking for hours for an explanation! Thanks for any help.

    Look at this link.
    Giving your former iPad to a spouse or family member: the quick guide
    http://www.tuaw.com/2012/03/17/giving-your-former-ipad-to-a-spouse-or-family-mem ber-the-quick/
    How to Share a Family iPad
    http://www.macworld.com/article/1163347/how_to_share_a_family_ipad.html
    Using iPhone, iPad, or iPod with multiple computers
    http://support.apple.com/kb/ht1202
    iOS & iCloud Tips: Sharing an Apple ID With Your Family
    http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/
    How To Best Use and Share Apple IDs across iPhones, iPads and iPods
    http://www.nerdsonsite.com/blog/2012/06/07/help-im-appleid-confused/
     Cheers, Tom

Maybe you are looking for

  • BAPI_GOODSMVT_CREATE giving error  purchase order is locked by user

    I am calling multiple times BAPI_GOODSMVT_CREATE for same Purchase order to post goods receipt. first goods receipt created successfully but second one has given the error the Purchase order is lockecd by USER 'XXXX' . i am calling 'BAPI_TRANSACTION_

  • Mail configuration in Netweaver ABAP Trial version 7.0

    Hi all,         Is it possible to do Mail configuration in Netweaver ABAP Trial version 7.0. If yes can you get me the steps to do mail configuration. Regards, Dinesh.

  • WSDL without endpoint in Services Registry

    Hi, I have successfully configured an enterprise service from ECC 6.0 by following this tutorial ([Configuration of Enterprise Services using SICF and SOAMANAGER|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/20b723f8-a422-2c10-aca5-fe64eeda1

  • NEED HELP! loosing the will to live... MAC Lion OS

    bought a brand new mac book pro this week, OS X LION 10.7.2 wanted a mac for using indesign as screen resolution and smooth operation. PROBLEMS I AM HAVING I wanted to download the free indesign trial (why not) and can't install the following... 1. A

  • How to select a row in JTable

    Hello, I have a problem selecting a row in a JTable. I use mytable.getSelectionModel().setSelectionInterval(row, row); to select a row, but after that this row is only highlighted. After calling this method I cannot change the selection using the arr