コード例 #1
0
 public CertReqMsg(CertRequest certReq, ProofOfPossession popo, AttributeTypeAndValue[] regInfo)
 {
     if (certReq == null)
     {
         throw new ArgumentNullException("certReq");
     }
     this.certReq = certReq;
     this.popo    = popo;
     if (regInfo != null)
     {
         this.regInfo = new DerSequence(regInfo);
     }
 }
コード例 #2
0
        /// <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;

            if (pop.Type == popSigningKey)
            {
                PopoSigningKey popoSign = PopoSigningKey.GetInstance(pop.Object);
                if (popoSign.PoposkInput != null && popoSign.PoposkInput.PublicKeyMac != null)
                {
                    throw new InvalidOperationException("verification requires password check");
                }
                return(verifySignature(verifierProvider, popoSign));
            }

            throw new InvalidOperationException("not Signing Key type of proof of possession");
        }
コード例 #3
0
 private CertReqMsg(Asn1Sequence seq)
 {
     certReq = CertRequest.GetInstance(seq[0]);
     for (int i = 1; i < seq.Count; i++)
     {
         object obj = seq[i];
         if (obj is Asn1TaggedObject || obj is ProofOfPossession)
         {
             popo = ProofOfPossession.GetInstance(obj);
         }
         else
         {
             regInfo = Asn1Sequence.GetInstance(obj);
         }
     }
 }