Set my own key instead of using KeyGenerator.generateKey() - how?
How can I set my own key instead of using KeyGenerator.generateKey()?
I don´t see any method that is alowing this.
I have now tried my own.
To send encrypted data through a CipherOutputStream, I have done this:
private File file;
private CipherOutputStream cos;
private Cipher cipher;
private PBEKeySpec key;
private char[] password = "test".toCharArray();
public SendFileThread(File file)
this.file = file;
try
key = new PBEKeySpec(password);
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
SecretKey pbeKey = factory.generateSecret(key);
cipher = Cipher.getInstance("PBEWithMD5AndDES");
cipher.init(Cipher.ENCRYPT_MODE, pbeKey);
catch(Exception err) {err.printStackTrace();}
public void run()
byte [] mybytearray = new byte [(int)file.length()];
try
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
bis.read(mybytearray,0,mybytearray.length);
OutputStream os = socket.getOutputStream();
cos = new CipherOutputStream(os, cipher);
int byteCount = 0;
int length = mybytearray.length;
while(byteCount < mybytearray.length)
cos.write(mybytearray[byteCount]);
os.flush();
os.close();
socket.close();
catch(FileNotFoundException err){err.printStackTrace();}
catch(IOException err){err.printStackTrace();}To receive the encrypted data and then decrypt it, I use the same password and Cipher.DECRYPT_MODE in the Cipher.init() method.
private Socket sock;
private DataInputStream din;
private CipherInputStream cin;
private BufferedOutputStream out_file;
private Cipher cipher;
private PBEKeySpec key;
private char[] password = "test".toCharArray();
public ListenForConnectionThread()
try
key = new PBEKeySpec(password);
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
SecretKey pbeKey = factory.generateSecret(key);
cipher = Cipher.getInstance("PBEWithMD5AndDES");
cipher.init(Cipher.DECRYPT_MODE, pbeKey);
catch(Exception err) {err.printStackTrace();}
public void run()
try
serverSocket = new ServerSocket(2000);
sock = serverSocket.accept();
Runnable r = new Runnable()
public void run()
try
cin = new CipherInputStream(sock.getInputStream(), cipher);
out_file = new BufferedOutputStream(new FileOutputStream("received_file.txt"));
int inputLine;
while((inputLine = cin.read()) != -1)
out_file.write(inputLine);
out_file.flush();
catch(Exception err){err.printStackTrace();}When I run the application, I get this error:
java.security.InvalidKeyException: requires PBE parameters.
Why?
Similar Messages
-
I got a new iPod my whole family uses the same Apple ID we both have different game centers I was setting the new iPod up and I got her Game Center instead of mine how do I get my old one back on my new ipod
Each person should have his/her own unique Apple ID. Period.
-
I want to use from keyboard(to hold this for example T)and left-click on the link to open the link.Exactly my question is about "Opening links in a new tab".I prefer to use LEFT-click.thank you so so much.
Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
You can use "Disable all add-ons" on the ''Safe mode'' start window.
You have to close and restart Firefox after each change via "File > Exit" (on Mac: "Firefox > Quit") -
Need a shortcut to "Allow pages to choose their own colors, instead of my selections above option preference" I know where it is and how to use it but I have to go through 7 mouse clicks to change it, then a few minutes later change it back. I also know the sequnce is alt t, alt o, alt c, alt a, then ok, ok. Got to be a way to make a one key short cut for this. I use a black background to reduce eye strain, but about 10% of the webpage I go to can't be send with black so I have to go into tools and hit 6 or 7 things to chnage it then after through with webpage have to do it all over at Not allow webpages to have own color. Very very cumbersome.
== This happened ==
A few times a week
== made that wayhttps://addons.mozilla.org/en-US/firefox/addon/toggledocumentcolors-198916/
The above addon will solve your problem.
Shortcut to toggle user color/page color :- Ctr+Shift+C -
How can I use the enter key instead of tab to change field focus?
I am using Acrobat 9 Pro.
We have a fillable PDF where the users enter numbers into fields. They want to be able to use the <enter> key on the 10-key pad instead of the <tab> key on the keyboard to move the focus to the next data entry field.
How can I set my PDF so that it recognizes the <enter> key instead of the <tab> key for changing focus?
Thanks!You can use a custom Keystroke script, something like:
// Custom Keystroke script for text field
if (event.willCommit && event.commitKey === 2) {
getField("Text2").setFocus();
Where "Text2" is the name of the next field. This doesn't disable the Tab key though. For more information, see: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.608.html -
How to set my own gui status when i use selection-screen
how to set my own gui status when i use selection-screen command
and
how to set the names in the application tool bar when function keys are createdMake sure that you do this in event "AT SELECTION-SCREEN OUTPUT".
Run Txn ABAPDOCU and check 'DEMO_SEL_SCREEN_STATUS' for sample.
Also check out following discussion -
Selection Screen PF-STATUS
Cheers,
Sanjeev -
Here is the breakdown. I just bought my wife a new iPhone 4s and I'm trying to decide how to set it up for her. Should she have her own Apple ID or use mine? If she uses my Apple ID, will that cause issues with iMessage - say when I'm chatting with someone else and vice a versa. Will our messages show up on each others devices? How will a FaceTime call work? Will the video call come across both our devices (ipad also)?
Just some information that might be of note:
I have the new iPhone 4s, iPad2 and one iTunes account - the iTunes account is my Apple ID which I use also for the iCloud (I think...it's getting murky
What am I trying to achieve is having the ability for me (iphone, ipad) and my wife (iphone) to be able to share and sync just music, apps, movies, etc... I have Google Calender and I have not made up my mind yet if we will share a contacts list (I have large business list). Also this might be of note, I most likely will be using iTunes on my LG LCD TV (appleTV) at some point in the near future.
So, basically I'm confused, which is not unusual for me. If I'm thinking to much inside the box, please let me know and feel free to offer up any suggestions. Even if the suggestion is I'm not asking the right questions. Of course if that is your suggestion, then please tell me the question. And an answer would be nice to.
Thanks.
BentleyNo it's not stealing. They have an allowance that you can share with so many computers/devices. You'll have to authorize her computer to play/use anything bought on your acct. You can do this under the Store menu at top when iTunes is open on her computer.
As far as getting it all on her computer....I think but I am not sure (because I don't use the feature) but I think if you turn on Home Sharing in iTunes it may copy the music to her computer. I don't know maybe it just streams it. If nothing else you can sign into your acct on her computer and download it all to her computer from the cloud. Not sure exactly how to go about that, I haven't had to do that yet. I wonder if once you authorize her computer and then set it up for automatic downloads (under Edit>Preferences>Store) if everything would download. Sorry I'm not much help on that. -
I just bought a new MacBook Air. In my old one, I could go from screen to screen by using three fingers to swipe over the key pad. This one just sits there. It is Yosemite. How do I set up preferences so I can use three fingers to move from screen to screen?
Those choices are controlled via System Preferences, Trackpad.
-
How can I use a mySQL database schema with numeric auto increment primary key instead of GUID?
Hello!
I'm using the TestStand "MySQL Insert (NI)" database schema with GUID as primary key. So everything works fine.
But I prever using numeric values as primary key, because the database is in conjunction with another database which uses numeric values as primary key.
Is this possible?
Has anyone an idea how I can modify the "Generic Recordset (NI)" for use with MySQL?
Thanks!
Configuration:
Microsoft Windows XP
TestStand 3.1
MySQL 4.1.12a
MySQL ODBC 3.51 Driver
BrosigAdam -
The TestStand Database Logging feature does not allow you to run a separate SQL command after executing the command for a statement(table), so I do not think that you can use an auto incrementing column for the tables. There is just no way to get it back in a generic way. One option that I tried is something similar to the Oracle schema where you call a store procedure to return a sequence ID for each record that you want to add.
So you would have to create the following sequence table in MySQL:
CREATE TABLE sequence (id INT NOT NULL);
INSERT INTO sequence VALUES (0);
Then create a stored procedure as shown below that will increment the sequence value and return it in a recordset:
CREATE PROCEDURE `getseqid`()
BEGIN
UPDATE sequence SET id=LAST_INSERT_ID(id+1);
SELECT LAST_INSERT_ID();
END
Then update the MySQL tables to use INT primary and foreign key values, so the TestStand MySQL SQL file to create all tables would have text like this:
CREATE TABLE UUT_RESULT
ID INT PRIMARY KEY,
~
CREATE TABLE STEP_RESULT
ID INT PRIMARY KEY,
UUT_RESULT INT NOT NULL,
~
Then update the schema primary and foreign key columns in the TestStand Database Options dialog box to be INT to match the table. For the primary key columns, you will have to set the Primary Key Type to "Get Value from Recordset" and set the Primary Key Command Text to "call getseqid()". This will call the stored procedure to determine the next value to use as the ID value.
Hope this helps...
Scott Richardson
National Instruments -
I recently downloaded Firefox 5 and noticed that all my keyboard shortcuts default to using "Alt" key instead of the "Ctrl" key (so, for example, opening a new tab is Alt + T instead of Ctrl + T).
I noticed that this is even true for copying and pasting within Firefox (Alt + C and Alt + P are the only commands that work).
Any idea why this is happening? I am running Windows 7 and Firefox 5.0.1.Thanks, eveostay! That worked. (And for the record, what a crazy user agent string...)
-
Why is my iphone4 not letting me delete my pics from my gallery ? InsteAd it keeps asking for a password, what would that password be cause I don't recall ever setting it up to have to use a password to delete pics
Sounds like you encrypted your iPhone backup, & if so it's asking for the encrypted backup password. Do you have a company Exchange account on your phone?
-
How does one delete background music and use ones own music instead
How does one delete annoying background music and use ones own music instead in imovie
Hi
I have done exactly as you have said without success, the background music just keeps on playing even over my own choice of music.Perhaps I have unkowingly locked something out.
Many thanks for trying to solve the problem
F.F -
GR without PO (501) using own price instead of M.Master Rec's price.
Hi all,
I have the following business process issue which I urgently need your help:
Background:
Currently our company will perform buying from another subsidiary (another plant in another company code) from a buying price offer by them and this process will not incur any initial PO, we will just receive the good from them.
Prior to using MIGO to post 501, finance side perform a account posting (at FI) using a dummy interco account (i.e. debit stock, credit dummy interco) on stock from other plant.
Lately we decide to make use of Migo-501.
However, when we perform GR without PO (mvmt type 501) in SAP, there is no price field for us to enter the price, and system will treat the valuation of goods receipt on the basis of the valid price in the material master record.
Question:
Because we buy some stock from this plant with a specific price, and it's different to the material price, Thus, our accounting people wants use the actual buying price from instead of using the material master price automatically from the system.
Is there a way to do this in the SAP?.
thanks a millionHi,
the best area to post your question is <a href="http://tets">SAP's Service Marketplace</a>.
Here you'll get support by all the SAP specialists working in your business area.
Together with your questions you should also provide the name of the ERP component (if possible).
Kind Regards. -
How to use the Function keys as function keys instead of action keys?
When I press F1 or any of the other F keys it does what the symbol says on the key (volume/skip track etc).
How do I actually use the F keys and not the symbols?Hi again John,
...is there a way to switch that around so I use the "fn" key for sound etc?
Do the following:
1. Fire up System Preferences
2. Select Keyboard & Mouse
3. Select the Keyboard tab.
4. Tick the "Use all F1, F2, etc. keys as standard function keys" box.
That's it. You have now reversed the default use of the function keys. If you need to increase/decrease sound, brightness etc then press 'fn' plus the appropriate function key.
Kryten -
Using function key instead of mouse click to control as bsp form
Hello,
Is it possible to use functionkeys or a keystroke (the arrowkeys) to control a BSP form?
Greetings, Edwinyou can use javascript to capture which key is pressed and act on it. do a google search on "javascript caputre key stroke" and you will find lot of code samples.
here is one such link
http://www.geekpedia.com/tutorial138_Get-key-press-event-using-JavaScript.html
Regards
Raja
Maybe you are looking for
-
Out of office replies in Exchange 2013 not working for external recipients
Hi, Few days ago a couple of company workers went to vacation. They set up OOF automatic replies in OWA 2013. However automatic replies are not working for external recipients (outside of company). Internal users (company users) receive OOF notificat
-
My 2006 iMac running Snow Leopard won't boot even after erasing and re-installing Snow Leopard. I erased and re-installed by putting the iMac in Target Disk mode and usin my MacBookPro as the host. But after numerous attempts I still can't get it
-
WIN_API_UTILITY.INTERRUPTCHECK in 11g
Hello! I have a problem after Forms Migration from 6i to 11g that the win_api_utility.interruptcheck doesn't work in 11g. After executing a sql select query that takes a long time, i need a solution to stop the query. In 6i we made it with win_api_ut
-
Hi, I want to reduce the browser zoom level to a lower value so that i could see the whole of webpage through prefs.js as its for a test automation. I just wanted to see whole page on the browser. Can any help me with what this can be achieved?
-
MS Office CD won't install after system was restored to factory setting on T430s
I have inserted the Office 2013 CD, clicked that I want it to install the .exe file, and nothing happens after that. I went to my list of programs, clicked on office, and entered the product key, but nothing happens.