org.bouncycastle.mail.smime

## Class SMIMEUtil

- java.lang.Object
- - org.bouncycastle.mail.smime.SMIMEUtil

    public class SMIMEUtil
    extends java.lang.Object

### Constructor Summary

Constructors
Constructor and Description
`SMIMEUtil()`

### Method Summary

Methods
`static org.bouncycastle.asn1.cms.IssuerAndSerialNumber` `createIssuerAndSerialNumberFor(java.security.cert.X509Certificate cert)` Return a CMS IssuerAndSerialNumber structure for the passed in X.509 certificate.
`static java.security.Provider` `getProvider(java.lang.String providerName)`
`static MimeBodyPart` `toMimeBodyPart(byte[] content)` return the MimeBodyPart described in the raw bytes provided in content
`static FileBackedMimeBodyPart` `toMimeBodyPart(CMSTypedStream content)` return a file backed MimeBodyPart described in `CMSTypedStream` content.
`static FileBackedMimeBodyPart` `toMimeBodyPart(CMSTypedStream content, java.io.File file)` Return a file based MimeBodyPart represented by content and backed by the file represented by file.
`static MimeBodyPart` `toMimeBodyPart(java.io.InputStream content)` return the MimeBodyPart described in the input stream content

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

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

### Constructor Detail

#### SMIMEUtil

    public SMIMEUtil()

### Method Detail

#### getProvider

    public static java.security.Provider getProvider(java.lang.String providerName)
                                              throws java.security.NoSuchProviderException

Throws:
  `java.security.NoSuchProviderException`

#### toMimeBodyPart

    public static MimeBodyPart toMimeBodyPart(byte[] content)
                                       throws SMIMEException

return the MimeBodyPart described in the raw bytes provided in content

Throws:
  `SMIMEException`

#### toMimeBodyPart

    public static MimeBodyPart toMimeBodyPart(java.io.InputStream content)
                                       throws SMIMEException

return the MimeBodyPart described in the input stream content

Throws:
  `SMIMEException`

#### toMimeBodyPart

    public static FileBackedMimeBodyPart toMimeBodyPart(CMSTypedStream content)
                                                 throws SMIMEException

return a file backed MimeBodyPart described in `CMSTypedStream` content.

Throws:
  `SMIMEException`

#### toMimeBodyPart

    public static FileBackedMimeBodyPart toMimeBodyPart(CMSTypedStream content,
                                        java.io.File file)
                                                 throws SMIMEException

Return a file based MimeBodyPart represented by content and backed by the file represented by file.

Parameters:
  `content` - content stream containing body part.
  `file` - file to store the decoded body part in.
Returns:
  the decoded body part.
Throws:
  `SMIMEException`

#### createIssuerAndSerialNumberFor

    public static org.bouncycastle.asn1.cms.IssuerAndSerialNumber createIssuerAndSerialNumberFor(java.security.cert.X509Certificate cert)
                                                                                          throws java.security.cert.CertificateParsingException

Return a CMS IssuerAndSerialNumber structure for the passed in X.509 certificate.

Parameters:
  `cert` - the X.509 certificate to get the issuer and serial number for.
Returns:
  an IssuerAndSerialNumber structure representing the certificate.
Throws:
  `java.security.cert.CertificateParsingException`