Inheritance: Org.BouncyCastle.X509.Store.X509CertStoreSelector
Esempio n. 1
0
        public override bool Equals(
            object obj)
        {
            if (obj == this)
            {
                return(false);
            }

            OriginatorID id = obj as OriginatorID;

            if (id == null)
            {
                return(false);
            }

            return(Arrays.AreEqual(SubjectKeyIdentifier, id.SubjectKeyIdentifier) &&
                   Platform.Equals(SerialNumber, id.SerialNumber) &&
                   IssuersMatch(Issuer, id.Issuer));
        }
        private AsymmetricKeyParameter GetSenderPublicKey(AsymmetricKeyParameter receiverPrivateKey, OriginatorIdentifierOrKey originator)
        {
            OriginatorPublicKey originatorPublicKey = originator.OriginatorPublicKey;

            if (originatorPublicKey != null)
            {
                return(this.GetPublicKeyFromOriginatorPublicKey(receiverPrivateKey, originatorPublicKey));
            }
            OriginatorID originatorID = new OriginatorID();

            Org.BouncyCastle.Asn1.Cms.IssuerAndSerialNumber issuerAndSerialNumber = originator.IssuerAndSerialNumber;
            if (issuerAndSerialNumber != null)
            {
                originatorID.Issuer       = issuerAndSerialNumber.Name;
                originatorID.SerialNumber = issuerAndSerialNumber.SerialNumber.Value;
            }
            else
            {
                SubjectKeyIdentifier subjectKeyIdentifier = originator.SubjectKeyIdentifier;
                originatorID.SubjectKeyIdentifier = subjectKeyIdentifier.GetKeyIdentifier();
            }
            return(this.GetPublicKeyFromOriginatorID(originatorID));
        }
        private AsymmetricKeyParameter GetSenderPublicKey(
            AsymmetricKeyParameter		receiverPrivateKey,
            OriginatorIdentifierOrKey	originator)
        {
            OriginatorPublicKey opk = originator.OriginatorPublicKey;
            if (opk != null)
            {
                return GetPublicKeyFromOriginatorPublicKey(receiverPrivateKey, opk);
            }
            
            OriginatorID origID = new OriginatorID();
            
            Asn1.Cms.IssuerAndSerialNumber iAndSN = originator.IssuerAndSerialNumber;
            if (iAndSN != null)
            {
                origID.Issuer = iAndSN.Name;
                origID.SerialNumber = iAndSN.SerialNumber.Value;
            }
            else
            {
                SubjectKeyIdentifier ski = originator.SubjectKeyIdentifier;

                origID.SubjectKeyIdentifier = ski.GetKeyIdentifier();
            }

            return GetPublicKeyFromOriginatorID(origID);
        }
 private AsymmetricKeyParameter GetPublicKeyFromOriginatorID(
     OriginatorID origID)
 {
     // TODO Support all alternatives for OriginatorIdentifierOrKey
     // see RFC 3852 6.2.2
     throw new CmsException("No support for 'originator' as IssuerAndSerialNumber or SubjectKeyIdentifier");
 }
 private AsymmetricKeyParameter GetPublicKeyFromOriginatorID(OriginatorID origID)
 {
     throw new CmsException("No support for 'originator' as IssuerAndSerialNumber or SubjectKeyIdentifier");
 }