summary refs log tree commit diff
path: root/crypto/src/crmf/CertificateRequestMessage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/crmf/CertificateRequestMessage.cs')
-rw-r--r--crypto/src/crmf/CertificateRequestMessage.cs63
1 files changed, 56 insertions, 7 deletions
diff --git a/crypto/src/crmf/CertificateRequestMessage.cs b/crypto/src/crmf/CertificateRequestMessage.cs
index 818facade..087e8a933 100644
--- a/crypto/src/crmf/CertificateRequestMessage.cs
+++ b/crypto/src/crmf/CertificateRequestMessage.cs
@@ -1,7 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Text;
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Crmf;
 using Org.BouncyCastle.Crypto;
@@ -19,39 +16,68 @@ namespace Org.BouncyCastle.Crmf
         private readonly CertReqMsg certReqMsg;
         private readonly Controls controls;
 
-        private static CertReqMsg ParseBytes(byte[] encoding)
-       
+        private static CertReqMsg ParseBytes(byte[] encoding)       
         {        
                 return CertReqMsg.GetInstance(encoding);
         }
 
+        /// <summary>
+        /// Create a CertificateRequestMessage from the passed in bytes.
+        /// </summary>
+        /// <param name="encoded">BER/DER encoding of the CertReqMsg structure.</param>
+        public CertificateRequestMessage(byte[] encoded):this(CertReqMsg.GetInstance(encoded))
+        {
+
+        }
+
         public CertificateRequestMessage(CertReqMsg certReqMsg)
         {
             this.certReqMsg = certReqMsg;
             this.controls = certReqMsg.CertReq.Controls;
         }
 
+        /// <summary>
+        /// Return the underlying ASN.1 object defining this CertificateRequestMessage object.
+        /// </summary>
+        /// <returns>A CertReqMsg</returns>
         public CertReqMsg ToAsn1Structure()
         {
             return certReqMsg; 
         }
 
+        /// <summary>
+        /// Return the certificate template contained in this message.
+        /// </summary>
+        /// <returns>a CertTemplate structure.</returns>
         public CertTemplate GetCertTemplate()
         {
             return this.certReqMsg.CertReq.CertTemplate;
         }
 
+        /// <summary>
+        /// Return whether or not this request has control values associated with it.
+        /// </summary>
+        /// <returns>true if there are control values present, false otherwise.</returns>
         public bool HasControls
         {
             get { return controls != null; }
         }
 
-
+        /// <summary>
+        /// Return whether or not this request has a specific type of control value.
+        /// </summary>
+        /// <param name="objectIdentifier">the type OID for the control value we are checking for.</param>
+        /// <returns>true if a control value of type is present, false otherwise.</returns>
         public bool HasControl(DerObjectIdentifier objectIdentifier)
         {
             return findControl(objectIdentifier) != null;
         }
 
+        /// <summary>
+        /// Return a control value of the specified type.
+        /// </summary>
+        /// <param name="type">the type OID for the control value we are checking for.</param>
+        /// <returns>the control value if present, null otherwise.</returns>
         public IControl GetControl(DerObjectIdentifier type)
         {
             AttributeTypeAndValue found = findControl(type);
@@ -100,16 +126,29 @@ namespace Org.BouncyCastle.Crmf
             return found;
         }
 
+        /// <summary>
+        /// Return whether or not this request message has a proof-of-possession field in it.
+        /// </summary>
+        /// <returns>true if proof-of-possession is present, false otherwise.</returns>
         public bool HasProofOfPossession
         {
             get { return certReqMsg.Popo != null; }
         }
 
+        /// <summary>
+        /// Return the type of the proof-of-possession this request message provides.
+        /// </summary>
+        /// <returns>one of: popRaVerified, popSigningKey, popKeyEncipherment, popKeyAgreement</returns>
         public int ProofOfPossession
         {
             get { return certReqMsg.Popo.Type; }
         }
 
+        /// <summary>
+        /// Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
+        /// it has a public key MAC associated with it.
+        /// </summary>
+        /// <returns>true if POP is popSigningKey and a PKMAC is present, false otherwise.</returns>
         public bool HasSigningKeyProofOfPossessionWithPkMac
         {
             get
@@ -127,7 +166,13 @@ namespace Org.BouncyCastle.Crmf
 
             }
         }
-   
+        /// <summary>
+        /// Return whether or not a signing key proof-of-possession (POP) is valid.
+        /// </summary>
+        /// <param name="verifierProvider">a provider that can produce content verifiers for the signature contained in this POP.</param>
+        /// <returns>true if the POP is valid, false otherwise.</returns>
+        /// <exception cref="InvalidOperationException">if there is a problem in verification or content verifier creation.</exception>
+        /// <exception cref="InvalidOperationException">if POP not appropriate.</exception>
         public bool IsValidSigningKeyPop(IVerifierFactoryProvider verifierProvider)
         {
             ProofOfPossession pop = certReqMsg.Popo;
@@ -176,6 +221,10 @@ namespace Org.BouncyCastle.Crmf
             return result.IsVerified(signKey.Signature.GetBytes());
         }
 
+        /// <summary>
+        /// Return the ASN.1 encoding of the certReqMsg we wrap.
+        /// </summary>
+        /// <returns>a byte array containing the binary encoding of the certReqMsg.</returns>
         public byte[] GetEncoded()
         {
             return certReqMsg.GetEncoded();