Esempio n. 1
0
        /**
         * <pre>
         * RSASSA-PSS-params ::= SEQUENCE {
         *   hashAlgorithm      [0] OAEP-PSSDigestAlgorithms  DEFAULT sha1,
         *    maskGenAlgorithm   [1] PKCS1MGFAlgorithms  DEFAULT mgf1SHA1,
         *    saltLength         [2] INTEGER  DEFAULT 20,
         *    trailerField       [3] TrailerField  DEFAULT trailerFieldBC
         *  }
         *
         * OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
         *    { OID id-sha1 PARAMETERS NULL   }|
         *    { OID id-sha256 PARAMETERS NULL }|
         *    { OID id-sha384 PARAMETERS NULL }|
         *    { OID id-sha512 PARAMETERS NULL },
         *    ...  -- Allows for future expansion --
         * }
         *
         * PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
         *   { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
         *    ...  -- Allows for future expansion --
         * }
         *
         * TrailerField ::= INTEGER { trailerFieldBC(1) }
         * </pre>
         * @return the asn1 primitive representing the parameters.
         */
        public override Asn1Object ToAsn1Object()
        {
            Asn1EncodableVector v = new Asn1EncodableVector();

            if (!hashAlgorithm.Equals(DefaultHashAlgorithm))
            {
                v.Add(new DerTaggedObject(true, 0, hashAlgorithm));
            }

            if (!maskGenAlgorithm.Equals(DefaultMaskGenFunction))
            {
                v.Add(new DerTaggedObject(true, 1, maskGenAlgorithm));
            }

            if (!saltLength.Equals(DefaultSaltLength))
            {
                v.Add(new DerTaggedObject(true, 2, saltLength));
            }

            if (!trailerField.Equals(DefaultTrailerField))
            {
                v.Add(new DerTaggedObject(true, 3, trailerField));
            }

            return(new DerSequence(v));
        }
Esempio n. 2
0
        /**
         * <pre>
         * EssCertIDv2 ::=  SEQUENCE {
         *     hashAlgorithm     AlgorithmIdentifier
         *              DEFAULT {algorithm id-sha256},
         *     certHash          Hash,
         *     issuerSerial      IssuerSerial OPTIONAL
         * }
         *
         * Hash ::= OCTET STRING
         *
         * IssuerSerial ::= SEQUENCE {
         *     issuer         GeneralNames,
         *     serialNumber   CertificateSerialNumber
         * }
         * </pre>
         */
        public override Asn1Object ToAsn1Object()
        {
            Asn1EncodableVector v = new Asn1EncodableVector();

            if (!hashAlgorithm.Equals(DefaultAlgID))
            {
                v.Add(hashAlgorithm);
            }

            v.Add(new DerOctetString(certHash).ToAsn1Object());
            v.AddOptional(issuerSerial);
            return(new DerSequence(v));
        }
Esempio n. 3
0
        public override Asn1Object ToAsn1Object()
        {
            Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector();

            if (!hashAlgorithm.Equals(DefaultAlgID))
            {
                asn1EncodableVector.Add(hashAlgorithm);
            }
            asn1EncodableVector.Add(new DerOctetString(certHash).ToAsn1Object());
            if (issuerSerial != null)
            {
                asn1EncodableVector.Add(issuerSerial);
            }
            return(new DerSequence(asn1EncodableVector));
        }
    public override Asn1Object ToAsn1Object()
    {
        Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector();

        if (!hashAlgorithm.Equals(DefaultHashAlgorithm))
        {
            asn1EncodableVector.Add(new DerTaggedObject(explicitly: true, 0, hashAlgorithm));
        }
        if (!maskGenAlgorithm.Equals(DefaultMaskGenFunction))
        {
            asn1EncodableVector.Add(new DerTaggedObject(explicitly: true, 1, maskGenAlgorithm));
        }
        if (!pSourceAlgorithm.Equals(DefaultPSourceAlgorithm))
        {
            asn1EncodableVector.Add(new DerTaggedObject(explicitly: true, 2, pSourceAlgorithm));
        }
        return(new DerSequence(asn1EncodableVector));
    }