 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- String ManipulationAlternatively, if you have the ability to change the XML, put them as
two separate fields in the XML. After all, the use of a comma is a
means of overloading the field.
On Jul 13, 8:57 am, "email***@***.com" <email***@***.com> wrote:
> Hey everyone, I have a string that is returned from an xml file as two
> coordinates for example 23.424242,42.13131 exactly like that with no
> spaces, what is a way to break it into two seperate integers?
- 1
- java based cell phone capabilitysPlease bear with me, am old and somewhat out of touch with
technology....
Is there a cell phone that can access an web page with an mp3 playing
applet and play mp3's downloaded from the web site.
Robert
- 1
- Bind to a specific interface
Hello:
One of my peers just asked if there is a way to
bind a socket to a specific interface on a dual
homed machine in a Java Application. I believe there
is but I cannot find this documented. Could someone
forward me a pointer to where this is described?
Thanks,Steve
- 1
- Problem understanding a java statement!Please could somebody help me understand what this statement is doing,
k = (k1 > s0) ? k1 : s0;
what is this statement doing?
what will k be equal to if
k1 = 3 and s0 = 2 ?
- 1
- help needed @ Taskbar dimensions (screen size- taskbar size)Hi All,
I'm bulding a stand-alone-java GUI application.
This application is expected to run both on Windows & Linux
The content of GUI window is self configration at run time with csv
file.
Now my problem is " how to set size of GUI application window"
java.awt.Toolkit.getDefaultToolkit() can get me user's full screen-size
but u never know about user's taskbar dimensions. it can be
vertical/horizontal/auto-hide.
How could I get the actual working area for my applciation
i.e. DIMENSIONS_OF_SCREEN_SIZE - DIMENSIONS_OF_TASKBAR
- 1
- variable "retriever" might not have been initialized - confused[CODE]
String message = "", send = "", quit = "", errorMsg = "", cookie =
"";
boolean hasSubmittedMessage;
HTMLRetriever retriever;
// SEND MESSAGE TO SERVLET
if (hasSubmittedMessage && send.length() > 0) {
try { // USING NEW VERSION OF URLEncoder.encode() THAT REQUIRES
try{} BLOCK DUE TO NEW 2ND PARAMETER OF ENC-TYPE
retriever = new HTMLRetriever(ChatGlobals.SERVLET_SELF +
"/ppowell.ChatServlet?message=" +
URLEncoder.encode(message, "UTF-8") +
"&nickname=" +
URLEncoder.encode(cookie, "UTF-8")
); // SEND MESSAGE
} catch (UnsupportedEncodingException uee) {
errorMsg = "Error involving message submittal: " + uee.toString();
} catch (Exception e) {
errorMsg += "Unknown error: " + e.toString();
}
} else if (hasSubmittedMessage && quit.length() > 0) {
try { // USING NEW VERSION OF URLEncoder.encode() THAT REQUIRES
try{} BLOCK DUE TO NEW 2ND PARAMETER OF ENC-TYPE
retriever = new HTMLRetriever(ChatGlobals.SERVLET_SELF +
"/ppowell.ChatServlet?message=" +
URLEncoder.encode("/q", "UTF-8") +
"&nickname=" +
URLEncoder.encode(cookie, "UTF-8")
); // SEND "QUIT" COMMAND
} catch (UnsupportedEncodingException uee) {
errorMsg += "Error involving message submittal: " + uee.toString();
} catch (Exception e) {
errorMsg += "Unknown error: " + e.toString();
}
}
try {
if (retriever.getHTML() != null && quit.length() > 0)
out.println("<script type=\"text/javascript\">\n<!--
self.parent.close();\n//-->\n</script>\n");
} catch (Exception e) {} // DO NOTHING
// STUFF
[/CODE]
Produces this error:
[ERROR]
/~ppowell/includes/chat_submit_message.jsp:63: variable retriever might
not have been initialized
if (retriever.getHTML() != null && quit.length() > 0)
[/ERROR]
I can't figure out why since I'm capturing all errors because
"retriever" might not be initialized, which is the case if
hasSubmittedMessage = false. You see, if the user hasn't yet submitted
a message, nothing can be sent to the servlet, thus, the HTMLRetriever
variable "retriever" will not be initialized into a class object
because it can't unless it receives a value, which it can only do so
upon the right conditions, otherwise, no value can be passed into
"retriever".
Anyone know what I can do about this? I'm sorry but once again in PHP
this is not a problem, and I'm sorry but I have no choice but to
"translate" PHP scripts into JSP due to client dropping PHP support.
Thanx
Phil
- 1
- Spring and hibernate: all these jars?All,
just downloaded the latest spring RC. I've set up a super simple test, and
had to work through a lot of classpath issues, starting with just the
spring, logging, and hibernate jars and then adding jars to the classpath
until the errors went away. here's what i finally ended up with. Does this
look correct?
I'm not so much concerned about it if it's really what's needed, but I don't
want to run into conflicts and such down the road. So mostly i'm worried i
might have screwed something up. Here's what I have (from eclipse):
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="lib/c3p0-0.9.1-pre6.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/ehcache-1.2.jar"/>
<classpathentry kind="lib" path="lib/hibernate3.jar"/>
<classpathentry kind="lib" path="lib/cglib-nodep-2.1_3.jar"/>
<classpathentry kind="lib" path="lib/jta.jar"/>
<classpathentry kind="lib" path="lib/jtds-1.2.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.13.jar"/>
<classpathentry kind="lib" path="lib/spring.jar"/>
- 3
- JTable model's issueHi:
I have got a JTable and its cells are JPanel's (to make Java2D inside)
displaying numbers.
The problem is that I want the cells to be editable, so when you click on
the cell, you could write some number, and the new one be redisplayed.
I wrote a method called setValue() on the AbstractTableModel class which
updates the selected JPanel numerical value, but there is a little problem:
when you click a cell, you get a line full of info about the JPanel, so if
you want to enter a number, you have to clear the cell to avoid getting an
error.
so the question is, is there a way to avoid the info to get displayed? note
that my AbstractTableModel getValue() method needs to return a JPanel..
Thanks !!
--
PGR
- 6
- modificare un modello della libreria jgraphAvete mai usato la libreria jgraph per i vostri progetti?
Devo graficare lo schema di un datawarehouse che ho in XML, e modificarlo
attraverso l'interazione dell'utente (per la modifica e la visualizzazione
sto cercando di usare jgraph).
Una volta modificato il grafico, devo salvare i dati nel file XML.
Il mio problema ?che riesco a visualizzare i dati XML nel grafico Jgraph, e
modificare quest'ultimo, ma a causa delle classi utilizzate
(DefaultGraphCell) non riesco a salvare queste trasformazioni in termini di
nodi del file XML.
Dalla documentazione in rete ho capito che devo estendere e modificare la
classe GraphModel e la classe DEfaultGraphCell, ma senza un esempio o
documentazione precisa non riesco a capire quali metodi devo sovrascrivere
e cosa devo modificare per ottenere il risultato voluto.
Per questo motivo sono bloccato da giorni nella mia tesi, e ci sto perdendo
un
po' la testa, vi prego di darmi una mano (anche dirmi dove devo leggere).
Grazie in anticipo!
- 8
- Using Java To Implement RSA AlgorithmHi I'm looking for SOME advice on how to simulate the following:
http://i71.photobucket.com/albums/i140/carpinate/RSA.jpg
http://i71.photobucket.com/albums/i140/carpinate/RSA2.jpg
Ive done this so far:
package RSAalgorithm;
public class SecurityAlgorithm {
public static char[] StartSymbolic =
{'A','B','C','D','E','F','G','H','I','J',
'K','L','M','N','O','P','Q','R','S','T',
'U','V','W','X','Y','Z'};
public static int[] numeric =
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26};
public static void main(String[] args) {
long P3 = 0;
long P3mod33=0;
long C7=0;
long C7mod33=0;
for(int counter = 0; counter < numeric.length; counter++){
for(int i = 0; i < StartSymbolic.length; i++) {
int temp = numeric[counter];
P3 = (long) (temp*temp*temp);
P3mod33 = P3%33;
C7 = (long)
(P3mod33*P3mod33*P3mod33*P3mod33*P3mod33*P3mod33*P3mod33);
int tp = numeric[counter];
C7mod33 = C7%33;
}
System.out.println("*******************************************");
//System.out.println(StartSymbolic[i]);
System.out.println("Numeric: " +
numeric[counter]);
System.out.println("P3: " +P3);
System.out.println("P3mod33: " + P3mod33);
System.out.println("C7: " +C7);
System.out.println("C7mod33:" + C7mod33);
// System.out.println(StartSymbolic[i]);
System.out.println("*******************************************");
}
}
}
Output:
*******************************************
Numeric: 1
P3: 1
P3mod33: 1
C7: 1
C7mod33:1
*******************************************
*******************************************
Numeric: 2
P3: 8
P3mod33: 8
C7: 2097152
C7mod33:2
*******************************************
*******************************************
Numeric: 3
P3: 27
P3mod33: 27
C7: 10460353203
C7mod33:3
*******************************************
*******************************************
Numeric: 4
P3: 64
P3mod33: 31
C7: 27512614111
C7mod33:4
*******************************************
*******************************************
Numeric: 5
P3: 125
P3mod33: 26
C7: 8031810176
C7mod33:5
*******************************************
*******************************************
Numeric: 6
P3: 216
P3mod33: 18
C7: 612220032
C7mod33:6
*******************************************
*******************************************
Numeric: 7
P3: 343
P3mod33: 13
C7: 62748517
C7mod33:7
*******************************************
*******************************************
Numeric: 8
P3: 512
P3mod33: 17
C7: 410338673
C7mod33:8
*******************************************
*******************************************
Numeric: 9
P3: 729
P3mod33: 3
C7: 2187
C7mod33:9
*******************************************
*******************************************
Numeric: 10
P3: 1000
P3mod33: 10
C7: 10000000
C7mod33:10
*******************************************
*******************************************
Numeric: 11
P3: 1331
P3mod33: 11
C7: 19487171
C7mod33:11
*******************************************
*******************************************
Numeric: 12
P3: 1728
P3mod33: 12
C7: 35831808
C7mod33:12
*******************************************
*******************************************
Numeric: 13
P3: 2197
P3mod33: 19
C7: 893871739
C7mod33:13
*******************************************
*******************************************
Numeric: 14
P3: 2744
P3mod33: 5
C7: 78125
C7mod33:14
*******************************************
*******************************************
Numeric: 15
P3: 3375
P3mod33: 9
C7: 4782969
C7mod33:15
*******************************************
*******************************************
Numeric: 16
P3: 4096
P3mod33: 4
C7: 16384
C7mod33:16
*******************************************
*******************************************
Numeric: 17
P3: 4913
P3mod33: 29
C7: 17249876309
C7mod33:17
*******************************************
*******************************************
Numeric: 18
P3: 5832
P3mod33: 24
C7: 4586471424
C7mod33:18
*******************************************
*******************************************
Numeric: 19
P3: 6859
P3mod33: 28
C7: 13492928512
C7mod33:19
*******************************************
*******************************************
Numeric: 20
P3: 8000
P3mod33: 14
C7: 105413504
C7mod33:20
*******************************************
*******************************************
Numeric: 21
P3: 9261
P3mod33: 21
C7: 1801088541
C7mod33:21
*******************************************
*******************************************
Numeric: 22
P3: 10648
P3mod33: 22
C7: 2494357888
C7mod33:22
*******************************************
*******************************************
Numeric: 23
P3: 12167
P3mod33: 23
C7: 3404825447
C7mod33:23
*******************************************
*******************************************
Numeric: 24
P3: 13824
P3mod33: 30
C7: 21870000000
C7mod33:24
*******************************************
*******************************************
Numeric: 25
P3: 15625
P3mod33: 16
C7: 268435456
C7mod33:25
*******************************************
*******************************************
Numeric: 26
P3: 17576
P3mod33: 20
C7: 1280000000
C7mod33:26
*******************************************
I was looking to achieve what is shown in the 1st image.
I can get the numeric, P3, P3mod33, C7, C7mod33 to print out but not
the symbolic information for some reason?
I want to be able to allow the user to enter in a string then the
plaintext and ciphertext can be displayed.
Like this:
String input: SUZANNE
Output:
Plaintext: S U Z A N N E
Ciphertext: 28 21 20 1 5 5 26
Thanks.
- 10
- 1.5 ignoring networkaddress.cache property?I've noticed that 1.5 seems to be ignoring the value set for
networkaddress.cache.negative.ttl in
$JAVA_HOME/jre/lib/security/java.policy when a DNS request times out.
In one of my forms I validate user-provided URLs by trying to fetch them
and ensuring I get a reasonable response (e.g., not 404, 403, 500, etc).
If the DNS request for the hostname in the URL times out once, the JRE
never tries a lookup again. I've verified that it isn't asking by
snooping DNS traffic on my loopback with tcpdump.
Positive lookups do cache properly. Negative lookups that *don't* time
out (ie, they get an NXDOMAIN response) also seem to obey the
networkaddress.cache.negative.ttl property.
So the behaviour seems to be that a DNS timeout is cached forever, whereas
postive or negative responses are cached according to
networkaddress.cache.*.
Nick
--
"Courage isn't just a matter of not being frightened, you know. It's being
afraid and doing what you have to do anyway."
Doctor Who - Planet of the Daleks
This message has been brought to you by Nick Johnson 2.3b1 and the number 6.
http://healerNick.com/ http://morons.org/ http://spatula.net/
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 11
- looking for a Java decompilerHello!
Is there a good byte-code de-compiler in the ports? It does not
need to be fancy/GUI -- just a straghtforward .class->.java utility.
Thanks for any pointers. Thanks!
-mi
- 14
- How to separate interface from implementation when using JARs?Hi,
In an engineering world where I used to be working with C++ I am now
shiftnig to Java. In C++ I would publishe my interfaces in header
files. In Java I can use the interface concept.
However this is not sufficient for me. I want to be able to full
separate the implementation from the interface of e.g. a class method.
Example:
public interface MyMath {
- 14
- [Quantian-general] Weka Machine Learning Environment
Bob,
[ BTW I had to manually approve your post as you're not (yet ?) subscribed
here -- please consider subscribing to that you can post directly. ]
On 5 November 2005 at 12:09, email***@***.com wrote:
| I would be very interested in seeing the Weka machine learning environment
| added to a live-DVD, such as Quantian. Weka is a powerful, open-source
| data mining package with many artificial intelligence algrorithms, created
| at the University of Waikato in New Zealand. It is written in Java, and so
Sure, I'm aware of Weka and their book, but have never installed it as I find
Java so tedious to work with.
I also have limited time and bandwidth for figuring out suggested packages.
If you could help with Weka, for example by installing Knoppix 4.0.2
(possibly the cdrom version) to disk and then documenting what you to do to
install Weka, and make it work well, I'd be helped quite a bit. Ideally, of
course, would be a Debian package encapsulating all this. It may be
worthwhile mentioning this to the good folks over at debian-java -- cc'ed. [
Debian-java'ers, please CC us back directly on follow-ups. ]
| is platform independent. There is also a version that can be set up in a
| cluster configuration, called Cluster Weka.
I didn't know that. What messaging toolkit do they use? Something like PVM or
LAM, or something homegrown?
| If you are interested, the website is:
|
| http://www.cs.waikato.ac.nz/ml/weka/
|
| Your work on the Quantian project is marvelous, and I applaud your efforts,
| and your contribution to the open-source community.
Thanks for your interest in Quantian, and the kind words.
Cheers, Dirk
| Bob McPherson
|
|
| _______________________________________________
| Quantian-general mailing list
| email***@***.com
| http://lists.alioth.debian.org/mailman/listinfo/quantian-general
--
Statistics: The (futile) attempt to offer certainty about uncertainty.
-- Roger Koenker, 'Dictionary of Received Ideas of Statistics'
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 16
- Initialization order brain-damageHi y'all,
So after spending a particularly frustrating afternoon debugging
through constructors and browsing the Java Language Specification 3.0
in some detail, I have come to the conclusion that I actually know
nothing and need to ask a question:
What is the standard order of evaluation of expressions during object
construction w/rt constructors, super-constructors, and instance
variable initializers? Specifically with the code:
class A
{
AType a1 = new AType();
A() { aDoesSomething(); }
}
class B extends A
{
AnotherType b1 = new AnotherType();
B() { bDoesSomethingElse(); }
}
B bongo = new B();
when do all of the various bits get executed? If there's a section of
the language spec that tells me this, I would really appreciate the
pointer, as well...
david rush
|
| Author |
Message |
ian_desouza

|
Posted: 2003-7-10 5:43:00 |
Top |
java-programmer, Encryption
Simple question... sorry..
I'm trying to encrypt a string with a private key (retrieved from
KeyStore - that I created using keytool). So that I can send the
public key to the client to decrypt the string.
The problem I'm having is (partially from the Java's Developer's
Almanac).
java.security.InvalidKeyException
at com.sun.crypto.provider.DESCipher.engineGetKeySize(DashoA6275)
at javax.crypto.Cipher.init(DashoA6275)
at DesEncrypter.<init>(DesEncrypter.java:24)
DesEncrypter(Key key)
throws InvalidAlgorithmParameterException, NoSuchPaddingException,
NoSuchAlgorithmException, InvalidKeyException
{
// 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);
ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
// CBC requires an initialization vector
24: ecipher.init(Cipher.ENCRYPT_MODE, key); //, paramSpec);
The "key" problem I'm having is that the code actually uses the
"SecretKey" to the class, but I'm retrieving a "Key" private key from
the store.
I know I'm missing something..
Ian
|
| |
|
| |
 |
JK

|
Posted: 2003-7-10 17:13:00 |
Top |
java-programmer >> Encryption
You are missing, that in JCE keys are typed to match the requirements of
the cipher. In a key store, you can store private keys for RSA or DSA,
but not for a symmetric cipher such as DES.
As asymmetric encrytion/decryption is a lot more computationally
intensive, you usually use a symmetric cipher for the bulk encryption of
data using a random key, and append (or prepend) the symmetric key
encrypted with an asymmetric cipher (RSA or DSA) using your private key.
For decryption, your public key is used to recover the secret symetric
key and having that key, the actually data can be decrypted.
Regards
JK.
Ian deSouza wrote:
> Simple question... sorry..
>
> I'm trying to encrypt a string with a private key (retrieved from
> KeyStore - that I created using keytool). So that I can send the
> public key to the client to decrypt the string.
>
> The problem I'm having is (partially from the Java's Developer's
> Almanac).
>
> java.security.InvalidKeyException
> at com.sun.crypto.provider.DESCipher.engineGetKeySize(DashoA6275)
> at javax.crypto.Cipher.init(DashoA6275)
> at DesEncrypter.<init>(DesEncrypter.java:24)
>
> DesEncrypter(Key key)
> throws InvalidAlgorithmParameterException, NoSuchPaddingException,
> NoSuchAlgorithmException, InvalidKeyException
> {
> // 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);
> ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
> dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
>
> // CBC requires an initialization vector
> 24: ecipher.init(Cipher.ENCRYPT_MODE, key); //, paramSpec);
>
> The "key" problem I'm having is that the code actually uses the
> "SecretKey" to the class, but I'm retrieving a "Key" private key from
> the store.
>
> I know I'm missing something..
>
> Ian
|
| |
|
| |
 |
ian_desouza

|
Posted: 2003-7-10 23:35:00 |
Top |
java-programmer >> Encryption
Thank you JK!
I think I understood that. The concern is that large amounts of data
would be better encripted using the less time consuming symmetric key.
But I only have a small amount of data I wish to decrypt. e.g.
I have a properties file with small string values that I wish to
decrypt with my public key that I ship with the product. I encrypt the
small values with my private key at home base and put them in my
properties file.
So if this is the case, what algorithym should I set up my cipher for
(at home) using my "keytool -genkey" generated key? i.e.
Sun DSA Private Key
parameters:DSA
p: fd7f5381 1d751229 52df4a9c 2eece4e7 f611b752 3cef4400 c31e3f80
b6512669
455d4022 51fb593d 8d58fabf c5f5ba30 f6cb9b55 6cd7813b 801d346f
f26660b7
6b9950a5 a49f9fe8 047b1022 c24fbba9 d7feb7c6 1bf83b57 e7c6a8a6
150f04fb
83f6d3c5 1ec30235 54135a16 9132f675 f3ae2b61 d72aeff2 2203199d
d14801c7
q: 9760508f 15230bcc b292b982 a2eb840b f0581cf5
g: f7e1a085 d69b3dde cbbcab5c 36b857b9 7994afbb fa3aea82 f9574c0b
3d078267
5159578e bad4594f e6710710 8180b449 167123e8 4c281613 b7cf0932
8cc8a6e1
3c167a8b 547c8d28 e0a3ae1e 2bb3a675 916ea37f 0bfa2135 62f1fb62
7a01243b
cca4f1be a8519089 a883dfe1 5ae59f06 928b665e 807b5525 64014c3b
fecf492a
x: 72433d46 3e452130 bcf4db29 4b30f3cf 5e17ea81
Don't worry, I'm only using this for testing...
And if I have a public key as follows:
Sun DSA Public Key
Parameters:DSA
p: fd7f5381 1d751229 52df4a9c 2eece4e7 f611b752 3cef4400 c31e3f80
b6512669
455d4022 51fb593d 8d58fabf c5f5ba30 f6cb9b55 6cd7813b 801d346f
f26660b7
6b9950a5 a49f9fe8 047b1022 c24fbba9 d7feb7c6 1bf83b57 e7c6a8a6
150f04fb
83f6d3c5 1ec30235 54135a16 9132f675 f3ae2b61 d72aeff2 2203199d
d14801c7
q: 9760508f 15230bcc b292b982 a2eb840b f0581cf5
g: f7e1a085 d69b3dde cbbcab5c 36b857b9 7994afbb fa3aea82 f9574c0b
3d078267
5159578e bad4594f e6710710 8180b449 167123e8 4c281613 b7cf0932
8cc8a6e1
3c167a8b 547c8d28 e0a3ae1e 2bb3a675 916ea37f 0bfa2135 62f1fb62
7a01243b
cca4f1be a8519089 a883dfe1 5ae59f06 928b665e 807b5525 64014c3b
fecf492a
y:
2a1c4ccd 0752ead3 d9100774 95efb3b3 06a35a6a c9ac583c 93c8c647
58fe8fe7
de862e36 b70e2f30 5e9ae836 37aca933 dadb16c1 6dae9cf7 47b442e4
a63539e1
ded87dcf 2299900c 3895729c bf6d06d3 6dfcfe60 c256bdd4 701313ff
758c8b6f
f3a5ce4d 8410ac3c 73d9c2ac 4645b605 c1cd7da8 be2ff818 0babc883
65d3f057
What algorithm would I use to init the Cipher to decrypt the small
string?
Thanks again for any help! Ian
JK <email***@***.com> wrote in message news:<bej9uk$14e$email***@***.com>...
> You are missing, that in JCE keys are typed to match the requirements of
> the cipher. In a key store, you can store private keys for RSA or DSA,
> but not for a symmetric cipher such as DES.
>
> As asymmetric encrytion/decryption is a lot more computationally
> intensive, you usually use a symmetric cipher for the bulk encryption of
> data using a random key, and append (or prepend) the symmetric key
> encrypted with an asymmetric cipher (RSA or DSA) using your private key.
> For decryption, your public key is used to recover the secret symetric
> key and having that key, the actually data can be decrypted.
>
> Regards
> JK.
>
>
>
> Ian deSouza wrote:
> > Simple question... sorry..
> >
> > I'm trying to encrypt a string with a private key (retrieved from
> > KeyStore - that I created using keytool). So that I can send the
> > public key to the client to decrypt the string.
> >
> > The problem I'm having is (partially from the Java's Developer's
> > Almanac).
> >
> > java.security.InvalidKeyException
> > at com.sun.crypto.provider.DESCipher.engineGetKeySize(DashoA6275)
> > at javax.crypto.Cipher.init(DashoA6275)
> > at DesEncrypter.<init>(DesEncrypter.java:24)
> >
> > DesEncrypter(Key key)
> > throws InvalidAlgorithmParameterException, NoSuchPaddingException,
> > NoSuchAlgorithmException, InvalidKeyException
> > {
> > // 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);
> > ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
> > dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
> >
> > // CBC requires an initialization vector
> > 24: ecipher.init(Cipher.ENCRYPT_MODE, key); //, paramSpec);
> >
> > The "key" problem I'm having is that the code actually uses the
> > "SecretKey" to the class, but I'm retrieving a "Key" private key from
> > the store.
> >
> > I know I'm missing something..
> >
> > Ian
|
| |
|
| |
 |
JK

|
Posted: 2003-7-11 16:56:00 |
Top |
java-programmer >> Encryption
You can't use DSA for encryption because it is an algorithm for signing
only.
Sun's JCE does not support RSA encryption (just signing). Get the
bouncycastle JCE (www.bouncycastle.org).
You have to generate an RSA key pair instead (keytool) and use RSA e.g.
with OAEP padding
Cipher cipher = Cipher.getInstance("RSA/OAEP", "BC");
I'd recommend to read a good book about cryptography to get things
clearer, e.g. "Applied Cryptography" by Bruce Schneier.
Regards
JK.
Ian deSouza wrote:
> Thank you JK!
>
> I think I understood that. The concern is that large amounts of data
> would be better encripted using the less time consuming symmetric key.
> But I only have a small amount of data I wish to decrypt. e.g.
>
> I have a properties file with small string values that I wish to
> decrypt with my public key that I ship with the product. I encrypt the
> small values with my private key at home base and put them in my
> properties file.
>
> So if this is the case, what algorithym should I set up my cipher for
> (at home) using my "keytool -genkey" generated key? i.e.
>
> Sun DSA Private Key
> parameters:DSA
> p: fd7f5381 1d751229 52df4a9c 2eece4e7 f611b752 3cef4400 c31e3f80
> b6512669
> 455d4022 51fb593d 8d58fabf c5f5ba30 f6cb9b55 6cd7813b 801d346f
> f26660b7
> 6b9950a5 a49f9fe8 047b1022 c24fbba9 d7feb7c6 1bf83b57 e7c6a8a6
> 150f04fb
> 83f6d3c5 1ec30235 54135a16 9132f675 f3ae2b61 d72aeff2 2203199d
> d14801c7
> q: 9760508f 15230bcc b292b982 a2eb840b f0581cf5
> g: f7e1a085 d69b3dde cbbcab5c 36b857b9 7994afbb fa3aea82 f9574c0b
> 3d078267
> 5159578e bad4594f e6710710 8180b449 167123e8 4c281613 b7cf0932
> 8cc8a6e1
> 3c167a8b 547c8d28 e0a3ae1e 2bb3a675 916ea37f 0bfa2135 62f1fb62
> 7a01243b
> cca4f1be a8519089 a883dfe1 5ae59f06 928b665e 807b5525 64014c3b
> fecf492a
>
> x: 72433d46 3e452130 bcf4db29 4b30f3cf 5e17ea81
>
> Don't worry, I'm only using this for testing...
>
> And if I have a public key as follows:
>
> Sun DSA Public Key
> Parameters:DSA
> p: fd7f5381 1d751229 52df4a9c 2eece4e7 f611b752 3cef4400 c31e3f80
> b6512669
> 455d4022 51fb593d 8d58fabf c5f5ba30 f6cb9b55 6cd7813b 801d346f
> f26660b7
> 6b9950a5 a49f9fe8 047b1022 c24fbba9 d7feb7c6 1bf83b57 e7c6a8a6
> 150f04fb
> 83f6d3c5 1ec30235 54135a16 9132f675 f3ae2b61 d72aeff2 2203199d
> d14801c7
> q: 9760508f 15230bcc b292b982 a2eb840b f0581cf5
> g: f7e1a085 d69b3dde cbbcab5c 36b857b9 7994afbb fa3aea82 f9574c0b
> 3d078267
> 5159578e bad4594f e6710710 8180b449 167123e8 4c281613 b7cf0932
> 8cc8a6e1
> 3c167a8b 547c8d28 e0a3ae1e 2bb3a675 916ea37f 0bfa2135 62f1fb62
> 7a01243b
> cca4f1be a8519089 a883dfe1 5ae59f06 928b665e 807b5525 64014c3b
> fecf492a
>
> y:
> 2a1c4ccd 0752ead3 d9100774 95efb3b3 06a35a6a c9ac583c 93c8c647
> 58fe8fe7
> de862e36 b70e2f30 5e9ae836 37aca933 dadb16c1 6dae9cf7 47b442e4
> a63539e1
> ded87dcf 2299900c 3895729c bf6d06d3 6dfcfe60 c256bdd4 701313ff
> 758c8b6f
> f3a5ce4d 8410ac3c 73d9c2ac 4645b605 c1cd7da8 be2ff818 0babc883
> 65d3f057
>
> What algorithm would I use to init the Cipher to decrypt the small
> string?
>
> Thanks again for any help! Ian
>
>
> JK <email***@***.com> wrote in message news:<bej9uk$14e$email***@***.com>...
>
>>You are missing, that in JCE keys are typed to match the requirements of
>>the cipher. In a key store, you can store private keys for RSA or DSA,
>>but not for a symmetric cipher such as DES.
>>
>>As asymmetric encrytion/decryption is a lot more computationally
>>intensive, you usually use a symmetric cipher for the bulk encryption of
>>data using a random key, and append (or prepend) the symmetric key
>>encrypted with an asymmetric cipher (RSA or DSA) using your private key.
>>For decryption, your public key is used to recover the secret symetric
>>key and having that key, the actually data can be decrypted.
>>
>>Regards
>>JK.
>>
>>
>>
>>Ian deSouza wrote:
>>
>>>Simple question... sorry..
>>>
>>>I'm trying to encrypt a string with a private key (retrieved from
>>>KeyStore - that I created using keytool). So that I can send the
>>>public key to the client to decrypt the string.
>>>
>>>The problem I'm having is (partially from the Java's Developer's
>>>Almanac).
>>>
>>>java.security.InvalidKeyException
>>> at com.sun.crypto.provider.DESCipher.engineGetKeySize(DashoA6275)
>>> at javax.crypto.Cipher.init(DashoA6275)
>>> at DesEncrypter.<init>(DesEncrypter.java:24)
>>>
>>> DesEncrypter(Key key)
>>> throws InvalidAlgorithmParameterException, NoSuchPaddingException,
>>>NoSuchAlgorithmException, InvalidKeyException
>>> {
>>> // 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);
>>> ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
>>> dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
>>>
>>> // CBC requires an initialization vector
>>>24: ecipher.init(Cipher.ENCRYPT_MODE, key); //, paramSpec);
>>>
>>>The "key" problem I'm having is that the code actually uses the
>>>"SecretKey" to the class, but I'm retrieving a "Key" private key from
>>>the store.
>>>
>>>I know I'm missing something..
>>>
>>>Ian
|
| |
|
| |
 |
ian_desouza

|
Posted: 2003-7-11 22:43:00 |
Top |
java-programmer >> Encryption
Thank you JK (again). I'm going to get the book. Also will look into
the boucycastle JCE.
Thanks again!, Ian
JK <email***@***.com> wrote in message news:<beltan$a82$email***@***.com>...
> You can't use DSA for encryption because it is an algorithm for signing
> only.
>
> Sun's JCE does not support RSA encryption (just signing). Get the
> bouncycastle JCE (www.bouncycastle.org).
>
> You have to generate an RSA key pair instead (keytool) and use RSA e.g.
> with OAEP padding
>
> Cipher cipher = Cipher.getInstance("RSA/OAEP", "BC");
>
> I'd recommend to read a good book about cryptography to get things
> clearer, e.g. "Applied Cryptography" by Bruce Schneier.
>
> Regards
> JK.
>
>
>
> Ian deSouza wrote:
> > Thank you JK!
> >
> > I think I understood that. The concern is that large amounts of data
> > would be better encripted using the less time consuming symmetric key.
> > But I only have a small amount of data I wish to decrypt. e.g.
> >
> > I have a properties file with small string values that I wish to
> > decrypt with my public key that I ship with the product. I encrypt the
> > small values with my private key at home base and put them in my
> > properties file.
> >
> > So if this is the case, what algorithym should I set up my cipher for
> > (at home) using my "keytool -genkey" generated key? i.e.
> >
> > Sun DSA Private Key
> > parameters:DSA
> > p: fd7f5381 1d751229 52df4a9c 2eece4e7 f611b752 3cef4400 c31e3f80
> > b6512669
> > 455d4022 51fb593d 8d58fabf c5f5ba30 f6cb9b55 6cd7813b 801d346f
> > f26660b7
> > 6b9950a5 a49f9fe8 047b1022 c24fbba9 d7feb7c6 1bf83b57 e7c6a8a6
> > 150f04fb
> > 83f6d3c5 1ec30235 54135a16 9132f675 f3ae2b61 d72aeff2 2203199d
> > d14801c7
> > q: 9760508f 15230bcc b292b982 a2eb840b f0581cf5
> > g: f7e1a085 d69b3dde cbbcab5c 36b857b9 7994afbb fa3aea82 f9574c0b
> > 3d078267
> > 5159578e bad4594f e6710710 8180b449 167123e8 4c281613 b7cf0932
> > 8cc8a6e1
> > 3c167a8b 547c8d28 e0a3ae1e 2bb3a675 916ea37f 0bfa2135 62f1fb62
> > 7a01243b
> > cca4f1be a8519089 a883dfe1 5ae59f06 928b665e 807b5525 64014c3b
> > fecf492a
> >
> > x: 72433d46 3e452130 bcf4db29 4b30f3cf 5e17ea81
> >
> > Don't worry, I'm only using this for testing...
> >
> > And if I have a public key as follows:
> >
> > Sun DSA Public Key
> > Parameters:DSA
> > p: fd7f5381 1d751229 52df4a9c 2eece4e7 f611b752 3cef4400 c31e3f80
> > b6512669
> > 455d4022 51fb593d 8d58fabf c5f5ba30 f6cb9b55 6cd7813b 801d346f
> > f26660b7
> > 6b9950a5 a49f9fe8 047b1022 c24fbba9 d7feb7c6 1bf83b57 e7c6a8a6
> > 150f04fb
> > 83f6d3c5 1ec30235 54135a16 9132f675 f3ae2b61 d72aeff2 2203199d
> > d14801c7
> > q: 9760508f 15230bcc b292b982 a2eb840b f0581cf5
> > g: f7e1a085 d69b3dde cbbcab5c 36b857b9 7994afbb fa3aea82 f9574c0b
> > 3d078267
> > 5159578e bad4594f e6710710 8180b449 167123e8 4c281613 b7cf0932
> > 8cc8a6e1
> > 3c167a8b 547c8d28 e0a3ae1e 2bb3a675 916ea37f 0bfa2135 62f1fb62
> > 7a01243b
> > cca4f1be a8519089 a883dfe1 5ae59f06 928b665e 807b5525 64014c3b
> > fecf492a
> >
> > y:
> > 2a1c4ccd 0752ead3 d9100774 95efb3b3 06a35a6a c9ac583c 93c8c647
> > 58fe8fe7
> > de862e36 b70e2f30 5e9ae836 37aca933 dadb16c1 6dae9cf7 47b442e4
> > a63539e1
> > ded87dcf 2299900c 3895729c bf6d06d3 6dfcfe60 c256bdd4 701313ff
> > 758c8b6f
> > f3a5ce4d 8410ac3c 73d9c2ac 4645b605 c1cd7da8 be2ff818 0babc883
> > 65d3f057
> >
> > What algorithm would I use to init the Cipher to decrypt the small
> > string?
> >
> > Thanks again for any help! Ian
> >
> >
> > JK <email***@***.com> wrote in message news:<bej9uk$14e$email***@***.com>...
> >
> >>You are missing, that in JCE keys are typed to match the requirements of
> >>the cipher. In a key store, you can store private keys for RSA or DSA,
> >>but not for a symmetric cipher such as DES.
> >>
> >>As asymmetric encrytion/decryption is a lot more computationally
> >>intensive, you usually use a symmetric cipher for the bulk encryption of
> >>data using a random key, and append (or prepend) the symmetric key
> >>encrypted with an asymmetric cipher (RSA or DSA) using your private key.
> >>For decryption, your public key is used to recover the secret symetric
> >>key and having that key, the actually data can be decrypted.
> >>
> >>Regards
> >>JK.
> >>
> >>
> >>
> >>Ian deSouza wrote:
> >>
> >>>Simple question... sorry..
> >>>
> >>>I'm trying to encrypt a string with a private key (retrieved from
> >>>KeyStore - that I created using keytool). So that I can send the
> >>>public key to the client to decrypt the string.
> >>>
> >>>The problem I'm having is (partially from the Java's Developer's
> >>>Almanac).
> >>>
> >>>java.security.InvalidKeyException
> >>> at com.sun.crypto.provider.DESCipher.engineGetKeySize(DashoA6275)
> >>> at javax.crypto.Cipher.init(DashoA6275)
> >>> at DesEncrypter.<init>(DesEncrypter.java:24)
> >>>
> >>> DesEncrypter(Key key)
> >>> throws InvalidAlgorithmParameterException, NoSuchPaddingException,
> >>>NoSuchAlgorithmException, InvalidKeyException
> >>> {
> >>> // 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);
> >>> ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
> >>> dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
> >>>
> >>> // CBC requires an initialization vector
> >>>24: ecipher.init(Cipher.ENCRYPT_MODE, key); //, paramSpec);
> >>>
> >>>The "key" problem I'm having is that the code actually uses the
> >>>"SecretKey" to the class, but I'm retrieving a "Key" private key from
> >>>the store.
> >>>
> >>>I know I'm missing something..
> >>>
> >>>Ian
|
| |
|
| |
 |
VK

|
Posted: 2003-10-20 6:23:00 |
Top |
java-programmer >> Encryption
The law prosecute actions, not consequences.
Someone is going on electric chair because he killed a man, not because
that man died.
The same way export restrictions apply on inscription tools and
technology, and not consequences (encrypted data).
So if you decide to go to a Taliban-controlled area of Afganistan (I
would NOT suggest :-) , you are legally OK to take any encrypted data
you like.
But it's not OK to bring with you any software to decode this data or to
produce another encoded data.
Roedy Green <email***@***.com> wrote in message
news:email***@***.com...
> Do the US restrictions on good encryption refer only to electronic
> communications, or do they also refer to how you encrypt your files
> for your own use. Would they apply for example if someone visited the
> country with their files encrypted on a lap top? Do they apply only
> to electronic communication, or to CD's shipped my mail as well?
>
> --
> Canadian Mind Products, Roedy Green.
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
Michael Amling

|
Posted: 2003-10-20 11:33:00 |
Top |
java-programmer >> Encryption
Roedy Green wrote:
> Do the US restrictions on good encryption refer only to electronic
> communications, or do they also refer to how you encrypt your files
> for your own use. Would they apply for example if someone visited the
> country with their files encrypted on a lap top? Do they apply only
> to electronic communication, or to CD's shipped my mail as well?
There's an exemption for software you take with you for personal use;
if nothing else, most laptops have a 128-bit SSL implementation in a
browser. The regulations apply to all exports, although they apply
different rules to different media. E.g. AFAIK, nothing in book form is
restricted.
You seem like the kind of person who could just wade through the regs
yourself, starting at http://www.bxa.doc.gov/Encryption/Default.htm. But
don't expect to get your answers in one sitting.
For a definitive answer, there are lawyers with expertise in this area.
--Mike Amling
|
| |
|
| |
 |
Michael Amling

|
Posted: 2003-10-20 21:18:00 |
Top |
java-programmer >> Encryption
Roedy Green wrote:
> On Mon, 20 Oct 2003 03:33:06 GMT, Michael Amling <email***@***.com>
> wrote or quoted :
>
>> You seem like the kind of person who could just wade through the regs
>>yourself, starting at http://www.bxa.doc.gov/Encryption/Default.htm. But
>>don't expect to get your answers in one sitting.
>> For a definitive answer, there are lawyers with expertise in this area.
>
> The question I am getting at is, would I get in trouble if I invented
> a one-time pad XOR scheme for both sending secret messages and
> encrypting personal files that used random FM noise to create the
> keys.
Well, OTP has its pitfalls. Cheap but effective cryptographic random
number generating hardware would also be nice for other uses.
Other than distinguishing hardware from software and key lengths
equivalent to >56 bits symmetric from key lengths <=56 bits, the regs
don't much care what the encryption technique is.
> I am a Canadian and live in Canada. The people most likely
> might use such a thing are Americans who travel a lot.
US export regulations don't apply to you if you're not exporting any
crypto from the USA. If your customers tell you credibly that it's for
their own use and not for reexport, you're as much off the hook as
distributors of 128-bit browsers are.
>
> I am not trying to shave the law. I want to understand the spirit of
> it.
We would all like to see a concise cogent version of the regulations,
a summary, a generalization, a spirit.
--Mike Amling
|
| |
|
| |
 |
David Goulet

|
Posted: 2004-1-31 5:11:00 |
Top |
java-programmer >> Encryption
Hi,
I want to encrypt a big String with a password entered by the user.
How can I create a Blowfish key with that password??
I try by the PBEfactory but Blowfish doesn't appear in this class.
thanks
David
|
| |
|
| |
 |
jPro9102

|
Posted: 2004-4-29 20:33:00 |
Top |
java-programmer >> Encryption
heres a program that incrypts files. comlpeate with 'regestration',
I/O file writing, and a help menu with a scroll pane. try it out and
tell me how u like it in a posting! no e-mail please!
-Ben
|
| |
|
| |
 |
Christophe Vanfleteren

|
Posted: 2004-4-29 20:37:00 |
Top |
java-programmer >> Encryption
Ben Aroia wrote:
> heres a program that incrypts files. comlpeate with 'regestration',
> I/O file writing, and a help menu with a scroll pane. try it out and
> tell me how u like it in a posting! no e-mail please!
> -Ben
I tried it. It is very cool. I really like the fact that it used I/O file
writing to encrypt my files.
--
Kind regards,
Christophe Vanfleteren
|
| |
|
| |
 |
RotterdamStudents

|
Posted: 2004-5-4 15:33:00 |
Top |
java-programmer >> Encryption
Hello group,
to give access to some of my pages I use a loginscript. When people register
the password is encrypted with the md5 function: $passw=md5("$inv_passw");
Now I want to have the user to ask for his password when he lost it by mail.
So the encrypted password needs to be decrypted. I thought to use the next
command:
$uncrypted = decrypt_md5($assw);
but this gives a fault:
Fatal error: Call to undefined function: decrypt_md5()
Can somebody tell me what I do wrong.
Thnx in advance.
RotterdamStudents
|
| |
|
| |
 |
Jeppe Uhd

|
Posted: 2004-5-4 16:11:00 |
Top |
java-programmer >> Encryption
RotterdamStudents wrote:
> Hello group,
>
> to give access to some of my pages I use a loginscript. When people
> register the password is encrypted with the md5 function:
> $passw=md5("$inv_passw");
>
> Now I want to have the user to ask for his password when he lost it
> by mail. So the encrypted password needs to be decrypted. I thought
> to use the next command:
> $uncrypted = decrypt_md5($assw);
>
> but this gives a fault:
> Fatal error: Call to undefined function: decrypt_md5()
>
> Can somebody tell me what I do wrong.
md5 -can't- be decrypted... It's a one-way hash function
--
MVH Jeppe Uhd - NX http://nx.dk
Webhosting for né´•der og andet godtfolk
|
| |
|
| |
 |
Chris Hope

|
Posted: 2004-5-4 16:16:00 |
Top |
java-programmer >> Encryption
Jeppe Uhd wrote:
>> to give access to some of my pages I use a loginscript. When people
>> register the password is encrypted with the md5 function:
>> $passw=md5("$inv_passw");
>>
>> Now I want to have the user to ask for his password when he lost it
>> by mail. So the encrypted password needs to be decrypted. I thought
>> to use the next command:
>> $uncrypted = decrypt_md5($assw);
>>
>> but this gives a fault:
>> Fatal error: Call to undefined function: decrypt_md5()
>>
>> Can somebody tell me what I do wrong.
>
> md5 -can't- be decrypted... It's a one-way hash function
And there's no such function as decrypt_md5(), hence the error message :)
If you want to check a function go to www.php.net/function_name where
function_name is the name of the function you want more info on. If the
function exists you'll be taken directly to the manual page. If it doesn't
then you'll be given a list of functions with similar names.
|
| |
|
| |
 |
Berislav Lopac

|
Posted: 2004-5-4 16:47:00 |
Top |
java-programmer >> Encryption
RotterdamStudents wrote:
> Hello group,
>
> to give access to some of my pages I use a loginscript. When people
> register the password is encrypted with the md5 function:
> $passw=md5("$inv_passw");
>
> Now I want to have the user to ask for his password when he lost it
> by mail. So the encrypted password needs to be decrypted. I thought
> to use the next command:
> $uncrypted = decrypt_md5($assw);
>
> but this gives a fault:
> Fatal error: Call to undefined function: decrypt_md5()
>
> Can somebody tell me what I do wrong.
Most of all, you're trying to decrypt.
Instead of this, when someone loses the password you should create a new one
and send it, and write that new one into database, encrypted.
Berislav
|
| |
|
| |
 |
Kevin

|
Posted: 2004-12-22 1:46:00 |
Top |
java-programmer >> Encryption
I am trying to re-write a Perl program in Java (don't ask why ;-)
I am having problems finding Java equivalents for the Perl encode_base64,
used for encoding files for transmission, and crypt, used for encrypting
passwords, functions.
Can anyone help me?
There does seem to be some encryption support in Java but it isn't clear how
to use it in place of the Perl functions mentioned.
Cheers,
K
|
| |
|
| |
 |
Juha Laiho

|
Posted: 2004-12-22 2:48:00 |
Top |
java-programmer >> Encryption
"Kevin" <email***@***.com> said:
>I am having problems finding Java equivalents for the Perl encode_base64,
>used for encoding files for transmission, and crypt, used for encrypting
>passwords, functions.
For base64-encoding, it looks like Jakarta Commons Codec is the library
you're looking for. See http://jakarta.apache.org/commons/codec/ .
Other implementations also exist.
For the other; see what you get with
http://www.google.com/search?q=java+%22unix+crypt%22
For the "unix crypt" support, if you're after something that fills the
same functionality (one-way password hashing), but do not require
compatibility with the Unix crypt() -hashes, I'd recommend hashing
the passwords with either MD5 os SHA1 instead of the old DES-based
crypt().
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
|
| |
|
| |
 |
Sudsy

|
Posted: 2004-12-22 3:47:00 |
Top |
java-programmer >> Encryption
Kevin wrote:
> I am trying to re-write a Perl program in Java (don't ask why ;-)
>
> I am having problems finding Java equivalents for the Perl encode_base64,
> used for encoding files for transmission, and crypt, used for encrypting
> passwords, functions.
>
> Can anyone help me?
>
> There does seem to be some encryption support in Java but it isn't clear how
> to use it in place of the Perl functions mentioned.
Been there, done that, wrote an article which you can find here:
<http://www.sudsy.net/technology/pcrypto.html>
|
| |
|
| |
 |
PaulRosovsky

|
Posted: 2005-1-15 3:32:00 |
Top |
java-programmer >> Encryption
Has anyone used any encryption products to secure data assets in a Flash-based
application?
We are running a Flash interface that uses ActionScript to call a third party
program (Northcode's SWF Studio) to access data assets stored on a CD-ROM or
DVD-ROM. We need the data assets stored on the CD/DVD-ROM to be encrypted.
We need the encrytion/decryption application to initially launch and then be
totally transparent to the end-use, who will access the assets through the
Flash interface.
Any help would be appreciated.
Thanks!
|
| |
|
| |
 |
PaulRosovsky

|
Posted: 2005-1-15 3:34:00 |
Top |
java-programmer >> Encryption
Has anyone used any encryption products to secure data assets in a Flash-based
application?
We are running a Flash interface that uses ActionScript to call a third party
program (Northcode's SWF Studio) to access data assets stored on a CD-ROM or
DVD-ROM. We need the data assets stored on the CD/DVD-ROM to be encrypted.
We need the encrytion/decryption application to initially launch and then be
totally transparent to the end-use, who will access the assets through the
Flash interface.
Any help would be appreciated.
Thanks!
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Bad performance of HTTPServletResponse at TomcatHi ,
I have a serious bad performance problem when under the load.
When I make a load test of 20 users, I see a bottleneck on the writing
of the response.
The lenght of the message up to 50K , but writting to outputstream
takes about 40 seconds.
Thanks in advance, Sasha
- 2
- Question about JInternalFrame and MouseMotionListenerHi,
I've got a JInternalFrame containing several swing components : 2
JTabbedPane, a JToolBar and a panel with a ButtonGroup.
I've added a MouseMotionListener to the JInternalFrame.
The mouse moved is not detected when the mouse cursor stay inside one
of the component (for example in the JTabbedPane).
How can I make it work ? Is there another solution than to add a
MouseMotionListener to each component of the JInternalFrame ?
Thanks
Annie
- 3
- Deploying java web services on TOMCATHi
I have build a web service using the tutorial given on sun's site
(http://docs.sun.com/source/817-2151-10/wsgjaxrpc.html). Web service is
deployed on J2EE application server and every thing is working fine.
Now i want to deploy the same web service on TOMCAT. First of all i
would like to explore about the possibility of doing the same. Is it
possible to deploy web service on java without using Soap admin tool
and AXIS.
Regards
Rohit
- 4
- @see tag"Adone Borione" <email***@***.com> writes:
> /**
> * @see java.lang.String
> */
You need to tell JavaDoc where the standard API docs are: By default,
JavaDoc doesn't include references to system classes because it
doesn't know where you may want to reference it.
- 5
- Appletee, Servletee kind of newbie question!Hi everyone,
I am having real problems working out whats going on w/ my applet. I want to
be able to send an object from an applet to a servlet, here is the code for
the listener method causing the trouble:
private void addClientListener(java.awt.event.MouseEvent evt) {
System.out.println("Got this far, addClientListener.");
try {
URL fileURL = new URL(getDocumentBase(),
"servlet/MaintSchedServ");
URLConnection conn = fileURL.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestProperty("addClient", "true");
ObjectOutputStream out = new ObjectOutputStream(new
BufferedOutputStream(
conn.getOutputStream()));
out.writeObject(textField1.getText());
out.close();
} catch( Exception exc ) {
exc.printStackTrace();
}
}
I apologise if my usage of setRequestProperty is incorrect, i need to pass
several different objects to servlet and thought that by using this method
of URLConnection, i could evaluate this at servlet and handle each case
seperately. If there is a better way i would love to know how!
Here is the java console output, it is saying that i need to set doOutput =
true, well i am aren't I?
Thankyou in advance for any direction you can give me!!
Andrew.
Java(TM) Plug-in: Version 1.4.1_02
Using JRE version 1.4.1_02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Andrew Tucker
/*
options
*/
Stopping applet ...
Unregistered modality listener
Joining applet thread ...
Destroying applet ...
Disposing applet ...
Joined applet thread ...
Quiting applet ...
Finding information ...
Releasing classloader: sun.plugin.ClassLoaderInfo@4865ce, refcount=0
Caching classloader: sun.plugin.ClassLoaderInfo@4865ce
Current classloader cache size: 1
Done ...
Registered modality listener
Referencing classloader: sun.plugin.ClassLoaderInfo@4865ce, refcount=1
Loading applet ...
Initializing applet ...
Starting applet ...
Got this far, addClientListener.
java.net.ProtocolException: cannot write to a URLConnection if
doOutput=false - call setDoOutput(true)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown
Source)
at AWTMaintSchedGUI.addClientListener(AWTMaintSchedGUI.java:114)
at AWTMaintSchedGUI.access$000(AWTMaintSchedGUI.java:17)
at AWTMaintSchedGUI$1.mouseClicked(AWTMaintSchedGUI.java:51)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
- 6
- OT:News readers..so many to choose fromWell I've abandoned google groups for the time being and have switched
over to PAN on Linux and Gravity on Windows. What I am wondering is,
how hard would it be to write a news reader client in Java? I know it's
way beyond me, but there must be people reading this ng who have had
some degree of sucess at it. What was the process you went through to
design and build the program? How much practical experience would one
need to be able to sucessfully code such a program? If you know that
you need say, a class that will send a request to a news server, how do
you go about finding it in the API documentation? And if you don't find
one, do you write your own or simply extend one that is already there,
and is close to what you need? I have a book on OO Design coming, but
it would be interesting to know what others think. I know this is
pseudo-off topic, which is why I put the OT in the subject line. This
is my first post using Gravity so it may not work, but if it does, I
hope we can have a good discussion about this topic, if it hasn't
already been hash(tabled) before.
Cheers
- 7
- J2ME - loading big JPG files
"ab" <email***@***.com> wrote in message news:fppem0$u4c$email***@***.com...
>
>
> Hi,
> can anybody know how can I load and display large JPG files in J2ME?
>
> best regards ab
problem is with that is the memory capacity is quite low - so big jpgs with
throw errors - depends on how advanced the hardware is
- 8
- 9
- Your 2 cents: Java Generics, love it, hate it, or waiting?email***@***.com opalinski from opalpaweb <email***@***.com> wrote:
> I was of something else: If you have sources that were written before
> 5.0 you can write new classes which use generics and have data flow
> between instances of previously written classes and generics using
> classes.
It would, of course, be possible to do this without type erasure as
well, in exactly that set of circumstances where it's safe, by giving an
appropriate definition of raw types. When it's not safe, you could
provide trivial wrappers (much like the current Collections.checkedList,
except without its stupid Class<E> parameter; see earlier post) that
would fit the necessary API and cast at run-time. The result would be
better than what we have now.
> If you have classes B,C,D which use class A internally, where class A
> is a container. You then modify A to be a generic, paramterizable on
> Classes. The change to A does not break B,C,D. B,C,D can stay excalty
> as they were even though the container they use internally has changed
> to be a generic.
Assuming the result only has to run on Java 1.5, this doesn't require
type erasure. And since Java 1.5 produces a new class file version
number, even the current implementation doesn't save you from that,
anyway.
So you just define the raw type, as used in the old source and binary
code, as being equivalent to what we now call the type erasure of the
type, and voila! Everything works.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
- 10
- Consuming Web Services inside J2EE/ JbossHi,
I have search the web , and by know I hava an good ideia on how to publish may Stateless EJB has a
webservice (using JBoss 3.2.x). My problem is now consume web services inside a Stateless EJB (or
any other , for that matter). I've searched, but with no luck. Having a WSDL file for a web service
how do I comsume it inside my beans ? (i.e. use the web service as an extension of my server
funcionality) How to I access that service from inside EJB using JBoss?
Any ideias ?
- 11
- jdk-1.4.1 plugin & Yahoo ChatWell, now that the plugin is working w/ 1.4.1 (w/ p4) I decided to give it
a whirl. I upgraded the plugin Mozilla Firebird uses by changing the
symbolic link /usr/X11R6/lib/browser_plugins/libjavaplugin_oji to link to
/usr/local/jdk1.4.1/jre/plugin/i386/ns610/libjavaplugin_oji.so instead.
Sure enough, about:plugins showed 1.4.1 now instead of 1.3.1. So the first
place I decided to try was Yahoo Chat since I had the most quirks with it
and 1.3.1.
Right away, I start noticing new problems. I tried clicking on the black
box to choose a font color, and Firebird crashed. Then I tried
double-clicking on a name to get more info, and Firebird crashed again.
Both these actions normally pop up a new small window on top of the chat
session, so it seems like anything on Yahoo Chat that opens a new java box
crashes Firebird.
My other problem is, I can't seem to switch back to 1.3.1! I renamed
libjavaplugin_oji.so to libjavaplugin_oji.so.14 and created a new
libjavaplugin_oji.so link to point back to 131's ns600/libjavaplugin_oji
but even closing and restarting Firebird, about:plugins still shows 1.4.1.
Epiphany does the same thing. How to I switch back?
Glad to see the progress though. :)
- 12
- Performance Q: java hotspot vs. native codeIn each of these two cases, would optimized C run substantially faster
than Java (hotspot or other JIT VM)?
* A number-crunching algorithm with a tight loop and a large number of
iterations (from
thousands potentially up to millions, or more) using doubles.
* Ditto, but with the C code using arrays of uints and carries to
effect a high precision
fixed-point math, and the Java code using BigDecimals.
* Ditto, but with roll-your-own Java BigDecimal-alikes using arrays and
math.
If there's an even higher performance option (short of compile-to-FPGA
:)) for the high-precision cases, please let me know about that as
well. (I know when it gets up into the 500+ digits it can be faster to
use FFT for the multiplies -- O(n log n) vs O(n^2). I'll cross that one
when I come to it.)
- 13
- Notification ServiceHi all,
I'm using openORB.
How can I test if the properties EventReliability and PersistentRealiability
work? I have made my own channel, admin and proxy with these properties
but I don't understand how I can try them.
Thanks,
ReX
- 14
- webpages on TomcatHi,
I am a JSP newbie. I installed apache tomcat on my PC. I can view all
the example JSP pages at http://localhost:8080/jsp-examples/. The files
themselves reside at C:\Program Files\Apache Software Foundation\Tomcat
5.0\webapps\jsp-examples.
So I created a html and a JSP page in C:\Program Files\Apache Software
Foundation\Tomcat 5.0\webapps\. but i can't seem to view them via http.
Am I missing something really fundamental here?
Any help will be greatly appreciated!
Eddy
- 15
- Detect XP themeDear NG,
One simple question: How can I detect
whether a windows user uses xp theme
or windows classic?
TIA,
Jens
|
|
|