private static PKIMessage parseBytes(byte[] encoding) throws IOException { try { return PKIMessage.getInstance(ASN1Primitive.fromByteArray(encoding)); } catch (ClassCastException e) { throw new CertIOException("malformed data: " + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new CertIOException("malformed data: " + e.getMessage(), e); } }
/** * Return true if this message has protection bits on it. A return value of true indicates the * message can be used to construct a ProtectedPKIMessage. * * @return true if message has protection, false otherwise. */ public boolean hasProtection() { return pkiMessage.getHeader().getProtectionAlg() != null; }
public PKIBody getBody() { return pkiMessage.getBody(); }
public PKIHeader getHeader() { return pkiMessage.getHeader(); }