|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.kth.pdc.grid.utility.X509Util
public class X509Util
| Constructor Summary | |
|---|---|
X509Util()
|
|
| Method Summary | |
|---|---|
static byte[] |
certChainToByte(X509Certificate[] x509Cert)
Convert array of x509certificates into byte format of PEMs |
static String |
certProxyResponse(String proxyCert)
Returns a proxy certificate in HTTP MIME type format |
static String |
certReqResponse(String certReq)
Returns a certificate request in HTTP MIME type format |
static boolean |
changeFileMode(String file,
int mode)
Change fime permission |
static boolean |
checkDName(String dName,
String commoName,
String realm)
|
static byte[] |
concatenate(byte[] a,
byte[] b)
|
static String |
digestFileName(String delegationid_in,
String DN_in)
Returns SHA1 hash digest of file name based on given delegationID and DER encoded DN in form of SHA1_HASH(DelegationID)+"-"+SHA1_HASH(DN) |
static String |
errorResponse(String errorMsg)
Returns an error message in case of fails |
static boolean |
fileExist(String file)
|
static String |
findPrivateKeyInCache(String strDirCache,
String delegationID,
String userDN)
Search for associated private key in cache |
static String |
findProxyInCache(String strDirCache,
String delegationID,
String userDN)
Search for a generated proxy in cache |
static String |
getDefaultCertFile()
Retrieves the location of the user cert file. |
static String |
getDefaultCertLocation()
Retrieves the location of the CA cert files. |
static String |
getDefaultKeyFile()
Retrieves the location of the user key file. |
static String |
getDefaultProxyFile()
Retrieves the location of the proxy file. |
static String |
getDlgeePropertyFile()
Retrieve the path to the delegatee property file |
static String |
getDlgorPropertyFile()
Retrieve the path to the delegator property file |
static byte[] |
getFilesBytes(File file)
Reading IO file in byte |
static String |
getOSEnvironment(String envName)
Retrieve the value of environment variable |
static Properties |
getProp(String filename)
|
static byte[] |
getSecretKeyFromkeyStore(String enteryPass,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
|
static String |
getSTSClientPropertyFile()
Retrieve the path to the STS Client property file |
static String |
getSTSPropertyFile()
Retrieve the path to the STS property file |
static X509Certificate |
loadCertificate(InputStream cert)
Load x509 certificate |
static X509Certificate[] |
loadCertificateChain(BufferedInputStream bisCerts)
Load a chain of certificates from BIS |
static X509Certificate[] |
loadCertificateChain(byte[] bCerts)
Load chain of certificates from byte |
static Vector |
loadCertificateVector(BufferedInputStream bisCerts)
Load a chain of certificates from BIS, returning a vector |
static org.bouncycastle.asn1.x509.X509Name |
makeGridCertDN(String DN)
Create an X509 Certificate DN |
static org.bouncycastle.asn1.x509.X509Name |
makeGridCertDN(String organization,
String orgUnit1,
String orgUnit2,
String country,
String email,
String commonName)
Create an X509 Certificate DN |
static void |
makeGSIProxy(X509Certificate[] certchain,
PrivateKey pk,
String fileLocation)
|
static Vector |
mergeVectors(Vector a,
Vector b)
|
static byte[] |
PEMtoDER(byte[] bytes,
String headfoot)
|
static byte[] |
readPEM(InputStream is,
String hdr,
String ftr)
Read a PEM encoded base64 stream and decode it |
static void |
saveCertificateTokeyStore(X509Certificate[] certChain,
PrivateKey pk,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
|
static void |
saveCertProxyTofile(String certProxy,
String fileLocation,
String delegationID,
String userDN,
boolean append)
save a proxy certificate in specific location |
static void |
saveCertProxyTofile(X509Certificate certProxy,
String fileLocation)
save a proxy certificate in specific location |
static void |
saveCertReqToFile(String certReq,
String fileLocation)
Save a certificate request in specific location |
static void |
savePrivateKey(PrivateKey pk,
String fileLocation,
String delegationID,
String userDN)
save a private key in specific location |
static void |
saveSecretKeyTokeyStore(SecretKey key,
String enteryPass,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
|
static boolean |
SecretKeyStoreExists(String enteryPass,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
|
static byte[] |
toBytes(Object object)
|
static Object |
toObject(byte[] bytes)
|
static void |
writeFileBytes(String filename,
byte[] toWrite)
Writing bytes to file |
static String |
writePEM(byte[] bytes,
String hdr,
String ftr)
Generate a PEM encoded string of certificate from a header and a footer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public X509Util()
| Method Detail |
|---|
public static String writePEM(byte[] bytes,
String hdr,
String ftr)
throws IOException
bytes - input streamhdr - Header delimeter of certificateftr - footer delimeter of certificate
IOException
public static byte[] readPEM(InputStream is,
String hdr,
String ftr)
throws IOException
is - Base64 PEM encoded streamhdr - Header delimeterftr - Footer delimeter
IOException - if a read error occurs
public static org.bouncycastle.asn1.x509.X509Name makeGridCertDN(String organization,
String orgUnit1,
String orgUnit2,
String country,
String email,
String commonName)
CommonName - X509 Common NameorgUnit, - Organization Unit
public static org.bouncycastle.asn1.x509.X509Name makeGridCertDN(String DN)
CommonName - X509 Common NameDN, - String of user DN
public static boolean checkDName(String dName,
String commoName,
String realm)
public static void saveCertReqToFile(String certReq,
String fileLocation)
throws IOException
certReq - given certificate request to savefileLocation - location of certificare request
IOException
public static void saveCertProxyTofile(X509Certificate certProxy,
String fileLocation)
certProxy - Given proxy certificate to savefileLocation - location of proxy certificate
public static void saveCertProxyTofile(String certProxy,
String fileLocation,
String delegationID,
String userDN,
boolean append)
certProxy - Given proxy certificate to savefileLocation - location of proxy certificatedelegationID - userDN -
public static void savePrivateKey(PrivateKey pk,
String fileLocation,
String delegationID,
String userDN)
pk - Given private key to savefileLocation - location of private keydelegationID - userDN -
public static void makeGSIProxy(X509Certificate[] certchain,
PrivateKey pk,
String fileLocation)
public static String findProxyInCache(String strDirCache,
String delegationID,
String userDN)
strDirCache - cache directorydelegationID - Delegation IDuserDN - UserDN
public static String findPrivateKeyInCache(String strDirCache,
String delegationID,
String userDN)
strDirCache - cache directorydelegationID - Delegation IDuserDN - UserDN
public static X509Certificate loadCertificate(InputStream cert)
throws IOException,
GeneralSecurityException
cert - certificate to load
IOException
GeneralSecurityException
public static X509Certificate[] loadCertificateChain(byte[] bCerts)
throws IOException,
GeneralSecurityException
bCerts -
IOException
GeneralSecurityException
public static X509Certificate[] loadCertificateChain(BufferedInputStream bisCerts)
throws IOException,
GeneralSecurityException
bisCerts -
IOException
GeneralSecurityException
public static Vector loadCertificateVector(BufferedInputStream bisCerts)
throws IOException,
GeneralSecurityException
bisCerts -
IOException
GeneralSecurityException
public static boolean changeFileMode(String file,
int mode)
file - File namemode - New Permission
public static String getDefaultCertFile()
public static String getDefaultKeyFile()
public static String getDefaultCertLocation()
public static String getDefaultProxyFile()
public static String digestFileName(String delegationid_in,
String DN_in)
delegationid_in - delegationID of proxy certificateDN_in - DER encoded DN
public static boolean fileExist(String file)
public static String certReqResponse(String certReq)
certReq - certificate request to response
Exceptionpublic static String certProxyResponse(String proxyCert)
proxyCert - proxy certificate to response
Exceptionpublic static String errorResponse(String errorMsg)
errorMsg - to send
Exception
public static byte[] getFilesBytes(File file)
throws IOException
file - File name
IOException
public static void writeFileBytes(String filename,
byte[] toWrite)
file - File namecontents - in byte
IOExceptionpublic static byte[] certChainToByte(X509Certificate[] x509Cert)
x509Cert -
public static String getDlgeePropertyFile()
public static String getDlgorPropertyFile()
public static String getSTSPropertyFile()
public static String getSTSClientPropertyFile()
public static String getOSEnvironment(String envName)
envName - Environment variable name
public static byte[] PEMtoDER(byte[] bytes,
String headfoot)
public static byte[] concatenate(byte[] a,
byte[] b)
public static void saveCertificateTokeyStore(X509Certificate[] certChain,
PrivateKey pk,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
public static void saveSecretKeyTokeyStore(SecretKey key,
String enteryPass,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
public static boolean SecretKeyStoreExists(String enteryPass,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
object -
public static byte[] getSecretKeyFromkeyStore(String enteryPass,
String ksPath,
String ksFilename,
String ksAlias,
String ksPass)
public static byte[] toBytes(Object object)
public static Object toObject(byte[] bytes)
public static Vector mergeVectors(Vector a,
Vector b)
public static Properties getProp(String filename)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||