Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dstc.security.pki
Class CertUtil

    java.lang.Object
      |
      +--com.dstc.security.pki.CertUtil

public class CertUtil
extends Object

Method Summary
`static byte[]` | `base64Decode(byte[] in)` Decodes a base-64 encoded byte array.
`static byte[]` | `base64Encode(byte[] in)` Encodes a byte array into base-64.
`static byte[]` | `encode(X509Certificate[] certs)` Returns the raw DER encoding of an array of `X509Certificate` objects in pkcs#7 format.
`static byte[]` | `encode(X509CRL[] crls)` Returns the raw DER encoding of an array of `X509CRL` objects in pkcs#7 format.
`static byte[]` | `toPEMEncoding(PKCS10CertificationRequest req)` Returns the PEM encoding of a PKCS10CertificationRequest.
`static byte[]` | `toPEMEncoding(X509Certificate cert)` Returns the PEM encoding of an X.509 certificate.
`static byte[]` | `toPEMEncoding(X509Certificate[] certs)` Returns the PEM encoding of an array of `X509Certificate` objects in pkcs#7 format.
`static byte[]` | `toPEMEncoding(X509CRL[] crls)` Returns the PEM encoding of an array of `X509CRL` objects in pkcs#7 format.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### base64Encode

    public static byte[] base64Encode(byte[] in)
                               throws IOException

  Encodes a byte array into base-64.
  Parameters:
    `in` - the byte array to be encoded.
  Returns:
    the base-64 encoded bytes as a byte array.
  Throws:
    IOException - on encoding errors.

### base64Decode

    public static byte[] base64Decode(byte[] in)
                               throws IOException

  Decodes a base-64 encoded byte array.
  Parameters:
    `in` - the byte array to be decoded.
  Returns:
    the base-64 decoded bytes as a byte array.
  Throws:
    IOException - on decoding errors.

### toPEMEncoding

    public static byte[] toPEMEncoding(X509Certificate cert)
                                throws PKIException

  Returns the PEM encoding of an X.509 certificate.

  i.e. the base-64 encoded certificate bounded by a header and footer of the form

        -----BEGIN CERTIFICATE-----

        -----END CERTIFICATE-----

  Parameters:
    `cert` - the `X509Certificate` to be encoded.
  Returns:
    the encoded bytes as a byte array.
  Throws:
    PKIException - on encoding errors.

### toPEMEncoding

    public static byte[] toPEMEncoding(PKCS10CertificationRequest req)
                                throws PKIException

  Returns the PEM encoding of a PKCS10CertificationRequest.

  i.e. the base-64 encoded pkcs#10 certification request bounded by a header and footer of the form

        -----BEGIN NEW CERTIFICATE REQUEST-----

        -----END NEW CERTIFICATE REQUEST-----

  Parameters:
    `req` - the `PKCS10CertificationRequest` to be encoded.
  Returns:
    the encoded bytes as a byte array.
  Throws:
    PKIException - on encoding errors.

### encode

    public static byte[] encode(X509Certificate[] certs)
                         throws PKIException

  Returns the raw DER encoding of an array of `X509Certificate` objects in pkcs#7 format.

  Parameters:
    `certs` - the array of `X509Certificate` objects to be encoded.
  Returns:
    the DER encoding in pkcs#7 format.
  Throws:
    PKIException - on encoding errors.

### encode

    public static byte[] encode(X509CRL[] crls)
                         throws PKIException

  Returns the raw DER encoding of an array of `X509CRL` objects in pkcs#7 format.

  Parameters:
    `crls` - the array of `X509CRL` objects to be encoded.
  Returns:
    the DER encoding in pkcs#7 format.
  Throws:
    PKIException - on encoding errors.

### toPEMEncoding

    public static byte[] toPEMEncoding(X509Certificate[] certs)
                                throws PKIException

  Returns the PEM encoding of an array of `X509Certificate` objects in pkcs#7 format.

  i.e. the base-64 encoded pkcs#7 encoding bounded by a header and footer of the form

        -----BEGIN PKCS7-----

        -----END PKCS7-----

  Parameters:
    `certs` - the `X509Certificate` objects to be encoded.
  Returns:
    the encoded bytes as a byte array.
  Throws:
    PKIException - on encoding errors.

### toPEMEncoding

    public static byte[] toPEMEncoding(X509CRL[] crls)
                                throws PKIException

  Returns the PEM encoding of an array of `X509CRL` objects in pkcs#7 format.

  i.e. the base-64 encoded pkcs#7 encoding bounded by a header and footer of the form

        -----BEGIN PKCS7-----

        -----END PKCS7-----

  Parameters:
    `certs` - the `X509CRL` objects to be encoded.
  Returns:
    the encoded bytes as a byte array.
  Throws:
    PKIException - on encoding errors.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD