EU.Europa.EC.Markt.Dss.DigestAlgorithm.GetAlgorithmIdentifier C# (CSharp) Method

GetAlgorithmIdentifier() public method

Gets the ASN.1 algorithm identifier structure corresponding to this digest algorithm
public GetAlgorithmIdentifier ( ) : AlgorithmIdentifier
return Org.BouncyCastle.Asn1.X509.AlgorithmIdentifier
        public AlgorithmIdentifier GetAlgorithmIdentifier()
        {
            return new AlgorithmIdentifier(new DerObjectIdentifier(this.GetOid()), DerNull.Instance);
        }

Usage Example

Beispiel #1
0
        // Returns the signed digest
        byte[] IBlockResult.Collect()
        {
            // The collected array contains the document digest and parameters
            // to be signed but it needs to be further digested by the indended
            // hashing algorithm
            byte[]  toDigest = m_stream.ToArray();
            IDigest digester = DigestUtilities.GetDigest(m_digestAlgorithm.GetName());

            digester.BlockUpdate(toDigest, 0, toDigest.Length);
            byte[] digestValue = DigestUtilities.DoFinal(digester);
            // Wrap digest value in DER encoding (should be RFC3770 compliant)
            DigestInfo digestInfo = new DigestInfo(m_digestAlgorithm.GetAlgorithmIdentifier(), digestValue);

            byte[] wrapped = digestInfo.GetDerEncoded();
            return(signer(wrapped));
        }