|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcgl.narada.service.security.securityprovider.CertificateUtil
public class CertificateUtil
Util Class to write Certificates and private keys from keystore to files
Created on Apr 15, 2005
Acknowledgement: Ideas borrowed from the jCertServices package
Constructor Summary | |
---|---|
CertificateUtil()
|
Method Summary | |
---|---|
static Certificate |
getCertificate(CertificateManager certMan,
String entity)
Returns the X.509 certificate of specified entity from the keystore |
static PrivateKey |
getPrivateKey(CertificateManager certMan,
String alias)
Generates a certificate for the specified entity. |
static PublicKey |
getPublicKey(CertificateManager certMan,
String entity)
Returns the public key of the entity |
static byte[] |
readPEM(InputStream is,
String hdr,
String ftr)
readPEM: Read a PEM encoded base64 stream and decode it |
static void |
saveCertsToFile(CertificateManager certMan,
String alias,
String outputCert,
String outputKey)
|
static void |
savePrivateKey(PrivateKey priv,
String outputFile)
|
static void |
saveX509Cert(X509Certificate cert,
String outputFile)
|
static void |
SignCertificate(CertificateManager certMan,
String csrFilePath,
String alias)
|
static boolean |
ValidateCertificate(Certificate creds,
PublicKey rootPubKey)
Verifies the supplied Certificate against a root public key |
static String |
writePEM(byte[] bytes,
String hdr,
String ftr)
Write certficate bytes into a PEM encoded string |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CertificateUtil()
Method Detail |
---|
public static boolean ValidateCertificate(Certificate creds, PublicKey rootPubKey)
creds
- -
Supplied CredentialsrootPubKey
- -
Root CA public key
public static void SignCertificate(CertificateManager certMan, String csrFilePath, String alias)
public static void saveCertsToFile(CertificateManager certMan, String alias, String outputCert, String outputKey)
public static PrivateKey getPrivateKey(CertificateManager certMan, String alias)
alias
- -
The entity for whom the certificate is to be createdD_NAME
- -
The comma seperated D_NAME of the entity
public static PublicKey getPublicKey(CertificateManager certMan, String entity)
entity
-
public static Certificate getCertificate(CertificateManager certMan, String entity)
entity
-
public static void saveX509Cert(X509Certificate cert, String outputFile) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public static void savePrivateKey(PrivateKey priv, String outputFile) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public static String writePEM(byte[] bytes, String hdr, String ftr) throws IOException
IOException
public static byte[] readPEM(InputStream is, String hdr, String ftr) throws IOException
is
- Base64 PEM encoded streamhdr
- Header delimeter (e.g. ----------CERTIFICATE---------)ftr
- Footer delimeter (e.g. ----------END CERTIFICATE---------)
IOException
- if a read error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |