Package org.globus.gsi.util

# Class CertificateIOUtil

java.lang.Object
org.globus.gsi.util.CertificateIOUtil

public final class CertificateIOUtil extends Object
Fill Me

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CERT_FOOTER`
`static final String`
`CERT_HEADER`
`static final String`
`KEY_FOOTER`
`static final String`
`KEY_HEADER`
`static final int`
`LINE_LENGTH`
`static final String`
`LINE_SEP`

## Method Summary

Modifier and Type
Method
Description
`static String`
`certToPEMString(String base64Data)`
Creates PEM encoded cert string with line length, header and footer.
`static byte[]`
`encodePrincipal(X500Principal subject)`
`static byte[]`
`encodePrincipal(org.bouncycastle.asn1.x509.X509Name subject)`
`static String`
`nameHash(X500Principal subjectDN)`
Returns equivalent of: openssl x509 -in "cert-file" -hash -noout
`static String`
`nameHash(org.bouncycastle.asn1.x509.X509Name subjectDN)`
Returns equivalent of: openssl x509 -in "cert-file" -hash -noout
`static void`
`writeCertificate(OutputStream out, X509Certificate cert)`
Writes certificate to the specified output stream in PEM format.
`static void`
`writeCertificate(X509Certificate cert, File path)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### LINE_LENGTH

public static final int LINE_LENGTH

See Also:
  - Constant Field Values

### LINE_SEP

public static final String LINE_SEP

See Also:
  - Constant Field Values

### CERT_HEADER

public static final String CERT_HEADER

See Also:
  - Constant Field Values

### CERT_FOOTER

public static final String CERT_FOOTER

See Also:
  - Constant Field Values

### KEY_HEADER

public static final String KEY_HEADER

See Also:
  - Constant Field Values

### KEY_FOOTER

public static final String KEY_FOOTER

See Also:
  - Constant Field Values

## Method Details

### nameHash

public static String nameHash(X500Principal subjectDN)
Returns equivalent of: openssl x509 -in "cert-file" -hash -noout

Parameters:
  `subjectDN` -
Returns:
  hash for certificate names

### nameHash

public static String nameHash(org.bouncycastle.asn1.x509.X509Name subjectDN)
Returns equivalent of: openssl x509 -in "cert-file" -hash -noout

Parameters:
  `subjectDN` -
Returns:
  hash for certificate names

### encodePrincipal

public static byte[] encodePrincipal(X500Principal subject) throws IOException

Throws:
  `IOException`

### encodePrincipal

public static byte[] encodePrincipal(org.bouncycastle.asn1.x509.X509Name subject) throws IOException

Throws:
  `IOException`

### writeCertificate

public static void writeCertificate(X509Certificate cert, File path) throws CertificateEncodingException, IOException

Throws:
  `CertificateEncodingException`
  `IOException`

### certToPEMString

public static String certToPEMString(String base64Data)
Creates PEM encoded cert string with line length, header and footer.

Parameters:
  `base64Data` - already encoded into string
Returns:
  string

### writeCertificate

public static void writeCertificate(OutputStream out, X509Certificate cert) throws IOException, CertificateEncodingException
Writes certificate to the specified output stream in PEM format.

Throws:
  `IOException`
  `CertificateEncodingException`