Class ProtectedPKIMessage


  • public class ProtectedPKIMessage
    extends java.lang.Object
    Wrapper for a PKIMessage with protection attached to it.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.bouncycastle.asn1.cmp.PKIBody getBody()
      Return the message body.
      X509CertificateHolder[] getCertificates()
      Return the extra certificates associated with this message.
      org.bouncycastle.asn1.cmp.PKIHeader getHeader()
      Return the message header.
      boolean hasPasswordBasedMacProtection()
      Determine whether the message is protected by a password based MAC.
      org.bouncycastle.asn1.cmp.PKIMessage toASN1Structure()
      Return the underlying ASN.1 structure contained in this object.
      boolean verify​(PKMACBuilder pkMacBuilder, char[] password)
      Verify a message with password based MAC protection.
      boolean verify​(ContentVerifierProvider verifierProvider)
      Verify a message with a public key based signature attached.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProtectedPKIMessage

        public ProtectedPKIMessage​(GeneralPKIMessage pkiMessage)
        Base constructor.
        Parameters:
        pkiMessage - a GeneralPKIMessage with
    • Method Detail

      • getHeader

        public org.bouncycastle.asn1.cmp.PKIHeader getHeader()
        Return the message header.
        Returns:
        the message's PKIHeader structure.
      • getBody

        public org.bouncycastle.asn1.cmp.PKIBody getBody()
        Return the message body.
        Returns:
        the message's PKIBody structure.
      • toASN1Structure

        public org.bouncycastle.asn1.cmp.PKIMessage toASN1Structure()
        Return the underlying ASN.1 structure contained in this object.
        Returns:
        a PKIMessage structure.
      • hasPasswordBasedMacProtection

        public boolean hasPasswordBasedMacProtection()
        Determine whether the message is protected by a password based MAC. Use verify(PKMACBuilder, char[]) to verify the message if this method returns true.
        Returns:
        true if protection MAC PBE based, false otherwise.
      • getCertificates

        public X509CertificateHolder[] getCertificates()
        Return the extra certificates associated with this message.
        Returns:
        an array of extra certificates, zero length if none present.
      • verify

        public boolean verify​(ContentVerifierProvider verifierProvider)
                       throws CMPException
        Verify a message with a public key based signature attached.
        Parameters:
        verifierProvider - a provider of signature verifiers.
        Returns:
        true if the provider is able to create a verifier that validates the signature, false otherwise.
        Throws:
        CMPException - if an exception is thrown trying to verify the signature.
      • verify

        public boolean verify​(PKMACBuilder pkMacBuilder,
                              char[] password)
                       throws CMPException
        Verify a message with password based MAC protection.
        Parameters:
        pkMacBuilder - MAC builder that can be used to construct the appropriate MacCalculator
        password - the MAC password
        Returns:
        true if the passed in password and MAC builder verify the message, false otherwise.
        Throws:
        CMPException - if algorithm not MAC based, or an exception is thrown verifying the MAC.