Click to See Complete Forum and Search --> : Need Java Guru
Dillinger4
May 2nd, 2001, 08:49 PM
Im doing an encryption project for school implementing numerous
encryption algorthms ie..... DES, DESede , Blowfish ect....
All of the encryption algorthms use symmetrical keys so i have
to try and implement a java.security.KeyStore; in my program
to hold the keys.
The encryption side of my project is completed but i cant decrypt
until i figure out a way to store these keys. The problem i am having is that i dont fully understand what some of the parameters are for some of the methods in the java.security.KeyStore;
for instance:
protected KeyStore(KeyStoreSpi keyStoreSpi, Provider provider,
String type);
What is KeyStoreSpi?
There is only one constructor for this class so i have to provide all of the arguments. But i have no clue what KeyStoreSpi is.
next:
setKeyEntry(String alias, byte[] key, java.security.cert.Certificate[] chain);
now, secret keys are stored like private keys except they do not have a certificate chain associated with them. so what do i pass in for java.security.cert.Certificate [] chain?
any help would be greatly appreciated
sweetsupra
May 3rd, 2001, 05:28 PM
Hey Dilenger4,
This what I got from the api documentation:
first part is bit confusing...
public abstract class KeyStoreSpi
extends Object
This class defines the Service Provider Interface (SPI) for the KeyStore class. All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a keystore for a particular keystore type.
I can't seem to fully understand this myself...
Second part..there is a clearer example in the API...
The certificate takes a string from what the API indicates...
public abstract class Certificate
extends Object
Abstract class for managing a variety of identity certificates. An identity certificate is a binding of a principal to a public key which is vouched for by another principal. (A principal represents an entity such as an individual user, a group, or a corporation.)
This class is an abstraction for certificates that have different formats but important common uses. For example, different types of certificates, such as X.509 and PGP, share general certificate functionality (like encoding and verifying) and some types of information (like a public key).
X.509, PGP, and SDSI certificates can all be implemented by subclassing the Certificate class, even though they contain different sets of information, and they store and retrieve the information in different ways.
well the certificate chain is taking string data types...I am not sure if this helps
I would like learn about java security
there is a book on java security..i think orielly publication...
suprising I don't have the book.:)
Manoj
Dillinger4
May 3rd, 2001, 06:59 PM
Confusing isnt it? {{{laughing}}} I didnt know keyStoreSpi
was an abstract class. Untill you said it was. Thank you.
I found it in a security book i have. It sums up to by basically saying "Application never need to use or subclass this class".
So i guess i can try passing in null for that arguement.
Well it's back to the books for now.
Thanks............
sweetsupra
May 3rd, 2001, 08:12 PM
Hey Dilenger4,
Do you have java api documentation? Sometimes it is hard to understand, but can point out few things...I use to find useful for basic stuff like objects and classes, etc.
Manoj
Dillinger4
May 3rd, 2001, 08:30 PM
I have probably close to about $1,000 in books. Some of the books are refrences and they only give you a little taste of the class and the methods it contains, so trying to figure out some of this stuff is confusing. I found some documentation at sun:
http://java.sun.com/j2se/1.3/docs/guide/security/CryptoSpec.html#KeystoreImplementation
but to simply try and obtian a key store object i get errors upon compilation.
for instance.........
class KeyStoreTest{
public static void main(String [] args){
keyStorage KS = new keyStorage();
KS.getKeyStore("JKS","SunJCE");
}
}
import java.security.KeyStore;
class keyStorage{ // non public class accesable only in it's package
keyStorage(){};
void getKeyStore(String type, String provider){
KeyStore keyStore = KeyStore.getInstance.(type,provider);
}
}
Dillinger4
May 3rd, 2001, 08:46 PM
:eek: Well i got it to work alittle.
void getKeyStore(String type, String provider){
try {
KeyStore keyStore = KeyStore.getInstance(type,provider);
}catch(Exception e){System.err.println(e);}
}
sweetsupra
May 3rd, 2001, 08:46 PM
dude,
too much info lite nite reading:)
Manoj
Dillinger4
May 3rd, 2001, 08:49 PM
I here yo bro......
Time for bed for me too. :o
later.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.