|
Project JXTA | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.membership.pse.PSEUtils
Singleton class of static utility methods.
Properties: net.jxta.impl.membership.pse.PSEUtils.PBEParamsClass - if defined the name of the class which will be aliased to the OID 1.2.840.113549.1.5.3
Nested Class Summary | |
static class |
PSEUtils.IssuerInfo
Issuer Information |
static class |
PSEUtils.PSEProvider
A provider we construct. |
Field Summary | |
(package private) static String |
PKCS5_PBSE1_ALGO
We are trying to use : PBEWithMD5AndDES |
(package private) SecureRandom |
srng
A SecureRandom for generating keys. |
Method Summary | |
static byte[] |
base64Decode(Reader in)
Convert a BASE64 Encoded String into byte array. |
static String |
base64Encode(byte[] in)
Convert a byte array into a BASE64 encoded String. |
static byte[] |
computeSignature(String algorithm,
PrivateKey key,
InputStream stream)
Compute the signature of a stream. |
static String |
findObject(BufferedReader br,
String type)
|
static PSEUtils.IssuerInfo |
genCert(String cn,
PSEUtils.IssuerInfo issuerinfo)
Generate a Cert |
static PSEUtils.IssuerInfo |
genCert(X500Principal subject,
KeyPair keypair,
PSEUtils.IssuerInfo issuerinfo)
Generate a Cert given a keypair |
static String |
getCertSubjectCName(X509Certificate cert)
return the CN token from the provided cert's subjectDN |
static byte[] |
hash(String algorithm,
byte[] data)
returns a hash SHA-1 of the given byte array |
static String |
loadBase64Object(BufferedReader rdr,
String type)
WrappedObject.java Copyright (C) 1999, Claymore Systems, Inc. |
static byte[] |
loadObject(BufferedReader rdr,
String type)
|
static PrivateKey |
pkcs5_Decrypt_pbePrivateKey(char[] password,
String algorithm,
EncryptedPrivateKeyInfo encryptedPrivKey)
Given an encrypted private key and a password, decrypt the private key using the PBESE1 algorithm. |
static EncryptedPrivateKeyInfo |
pkcs5_Encrypt_pbePrivateKey(char[] password,
PrivateKey privkey,
int iterations)
Given a private key and a password, encrypt the private key using the PBESE1 algorithm. |
static String |
readBase64Object(BufferedReader br,
String type)
We read a block of n-lines (\n terminated) and return a String of n-lines concatenated together. |
static byte[] |
readObject(BufferedReader br,
String type)
Read an object |
static boolean |
verifySignature(String algorithm,
Certificate cert,
byte[] signature,
InputStream stream)
Verify a signature of a stream. |
static void |
writeBase64Object(BufferedWriter bw,
String type,
String object)
Write an ovject that is already base64 encoded. |
static void |
writeObject(BufferedWriter out,
String type,
byte[] object)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
final transient SecureRandom srng
static final String PKCS5_PBSE1_ALGO
Method Detail |
public static PSEUtils.IssuerInfo genCert(String cn, PSEUtils.IssuerInfo issuerinfo) throws SecurityException
cn
- subject cn for the certificateissuerinfo
- the cert issuer or null if self-signed root cert.
SecurityException
- if the cert could not be generated.public static PSEUtils.IssuerInfo genCert(X500Principal subject, KeyPair keypair, PSEUtils.IssuerInfo issuerinfo) throws SecurityException
subject
- subjectDN for the certificatekeypair
- the keypair to use.issuerinfo
- the cert issuer or null if self-signed root cert.
SecurityException
- if the cert could not be generated.public static String getCertSubjectCName(X509Certificate cert)
cert
- the certificate to examine
public static byte[] computeSignature(String algorithm, PrivateKey key, InputStream stream) throws InvalidKeyException, SignatureException, IOException
key
- the private key used to sign the streamstream
- the stream to sign.
InvalidKeyException
SignatureException
IOException
public static boolean verifySignature(String algorithm, Certificate cert, byte[] signature, InputStream stream) throws InvalidKeyException, SignatureException, IOException
cert
- The certificate containing the public key which will be used
to verify the signature.signature
- The signature to verify.stream
- The stream to verify.
InvalidKeyException
SignatureException
IOException
public static byte[] hash(String algorithm, byte[] data)
data
- the data to be hashed
public static EncryptedPrivateKeyInfo pkcs5_Encrypt_pbePrivateKey(char[] password, PrivateKey privkey, int iterations)
password
- The password which will be used.privkey
- The private key to be encrypted.iterations
- Number of iterations.
public static PrivateKey pkcs5_Decrypt_pbePrivateKey(char[] password, String algorithm, EncryptedPrivateKeyInfo encryptedPrivKey)
password
- The password which will be used.encryptedPrivKey
- The private key to be encrypted.
public static String loadBase64Object(BufferedReader rdr, String type) throws IOException
IOException
public static byte[] loadObject(BufferedReader rdr, String type) throws IOException
IOException
public static String findObject(BufferedReader br, String type) throws IOException
IOException
public static String readBase64Object(BufferedReader br, String type) throws IOException
IOException
public static byte[] readObject(BufferedReader br, String type) throws IOException
IOException
public static void writeBase64Object(BufferedWriter bw, String type, String object) throws IOException
IOException
public static void writeObject(BufferedWriter out, String type, byte[] object) throws IOException
IOException
public static String base64Encode(byte[] in) throws IOException
in
- the bytes to be converted
IOException
public static byte[] base64Decode(Reader in) throws IOException
IOException
|
JXTA J2SE | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |