code: @Override
      public CertStore getResponse(final byte[] content, final String mimeType)
              throws ContentException {
          if (mimeType != null && mimeType.startsWith(CA_CERT)) {
              // http://tools.ietf.org/html/draft-nourse-scep-20#section-4.1.1.1
              CertificateFactory factory;
              try {
                  factory = CertificateFactory.getInstance("X509");
              } catch (CertificateException e) {
                  throw new RuntimeException(e);
              }
              try {
                  X509Certificate ca = (X509Certificate) factory
                          .generateCertificate(new ByteArrayInputStream(content));
                  Collection<X509Certificate> caSet = Collections.singleton(ca);
                  CertStoreParameters storeParams = new CollectionCertStoreParameters(
                          caSet);
  
                  return CertStore.getInstance("Collection", storeParams);
              } catch (GeneralSecurityException e) {
                  throw new InvalidContentTypeException(e);
              }
          } else if (mimeType != null && mimeType.startsWith(RA_CERT)) {
              // If an RA is in use, a certificates-only PKCS#7 SignedData
              // with a certificate chain consisting of both RA and CA
              // certificates is
              // returned.
              // It should be in the order:
              // [0] RA
              // [1] CA
              if (content.length == 0) {
                  throw new InvalidContentException(
                          "Expected a SignedData object, but response was empty");
              }
              CMSSignedData sd;
              try {
                  sd = new CMSSignedData(content);
              } catch (CMSException e) {
                  throw new InvalidContentException(e);
              }
              return SignedDataUtils.fromSignedData(sd);
          } else {
              throw new InvalidContentTypeException(mimeType, CA_CERT, RA_CERT);
          }
      }
docs: {@inheritDoc}