GetSignatureName() static private method

static private GetSignatureName ( AlgorithmIdentifier sigAlgId ) : string
sigAlgId Org.BouncyCastle.Asn1.X509.AlgorithmIdentifier
return string
Example #1
0
        public X509Crl(
            CertificateList c)
        {
            this.c = c;

            try
            {
                this.sigAlgName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);

                if (c.SignatureAlgorithm.Parameters != null)
                {
                    this.sigAlgParams = ((Asn1Encodable)c.SignatureAlgorithm.Parameters).GetDerEncoded();
                }
                else
                {
                    this.sigAlgParams = null;
                }

                this.isIndirect = IsIndirectCrl;
            }
            catch (Exception e)
            {
                throw new CrlException("CRL contents invalid: " + e);
            }
        }
Example #2
0
        public virtual void Verify(AsymmetricKeyParameter key)
        {
            string  signatureName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);
            ISigner signer        = SignerUtilities.GetSigner(signatureName);

            CheckSignature(key, signer);
        }
        public X509Crl(
            CertificateList c)
        {
            this.c = c;

            try
            {
                this.sigAlgName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);

                Asn1Encodable parameters = c.SignatureAlgorithm.Parameters;
                this.sigAlgParams = (null == parameters) ? null : parameters.GetEncoded(Asn1Encodable.Der);

                this.isIndirect = IsIndirectCrl;
            }
            catch (Exception e)
            {
                throw new CrlException("CRL contents invalid: " + e);
            }
        }
Example #4
0
 public X509Crl(CertificateList c)
 {
     this.c = c;
     try
     {
         sigAlgName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);
         if (c.SignatureAlgorithm.Parameters != null)
         {
             sigAlgParams = c.SignatureAlgorithm.Parameters.GetDerEncoded();
         }
         else
         {
             sigAlgParams = null;
         }
         isIndirect = IsIndirectCrl;
     }
     catch (global::System.Exception ex)
     {
         throw new CrlException(string.Concat((object)"CRL contents invalid: ", (object)ex));
     }
 }
Example #5
0
 public X509Crl(CertificateList c)
 {
     this.c = c;
     try
     {
         sigAlgName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);
         if (c.SignatureAlgorithm.Parameters != null)
         {
             sigAlgParams = c.SignatureAlgorithm.Parameters.GetDerEncoded();
         }
         else
         {
             sigAlgParams = null;
         }
         isIndirect = IsIndirectCrl;
     }
     catch (Exception arg)
     {
         throw new CrlException("CRL contents invalid: " + arg);
         IL_0073 :;
     }
 }
Example #6
0
        public X509Certificate(
            X509CertificateStructure c)
        {
            this.c = c;

            try
            {
                this.sigAlgName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);

                Asn1Encodable parameters = c.SignatureAlgorithm.Parameters;
                this.sigAlgParams = (null == parameters) ? null : parameters.GetEncoded(Asn1Encodable.Der);
            }
            catch (Exception e)
            {
                throw new CrlException("Certificate contents invalid: " + e);
            }

            try
            {
                Asn1OctetString str = this.GetExtensionValue(new DerObjectIdentifier("2.5.29.19"));

                if (str != null)
                {
                    basicConstraints = BasicConstraints.GetInstance(
                        X509ExtensionUtilities.FromExtensionValue(str));
                }
            }
            catch (Exception e)
            {
                throw new CertificateParsingException("cannot construct BasicConstraints: " + e);
            }

            try
            {
                Asn1OctetString str = this.GetExtensionValue(new DerObjectIdentifier("2.5.29.15"));

                if (str != null)
                {
                    DerBitString bits = DerBitString.GetInstance(
                        X509ExtensionUtilities.FromExtensionValue(str));

                    byte[] bytes  = bits.GetBytes();
                    int    length = (bytes.Length * 8) - bits.PadBits;

                    keyUsage = new bool[(length < 9) ? 9 : length];

                    for (int i = 0; i != length; i++)
                    {
//						keyUsage[i] = (bytes[i / 8] & (0x80 >>> (i % 8))) != 0;
                        keyUsage[i] = (bytes[i / 8] & (0x80 >> (i % 8))) != 0;
                    }
                }
                else
                {
                    keyUsage = null;
                }
            }
            catch (Exception e)
            {
                throw new CertificateParsingException("cannot construct KeyUsage: " + e);
            }
        }