BestHTTP.SecureProtocol.Org.BouncyCastle.Security.DigestUtilities.GetObjectIdentifier C# (CSharp) Метод

GetObjectIdentifier() публичный статический Метод

Returns a ObjectIdentifier for a given digest mechanism.
public static GetObjectIdentifier ( string mechanism ) : DerObjectIdentifier
mechanism string A string representation of the digest meanism.
Результат DerObjectIdentifier
        public static DerObjectIdentifier GetObjectIdentifier(
            string mechanism)
        {
            if (mechanism == null)
                throw new System.ArgumentNullException("mechanism");

            mechanism = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.ToUpperInvariant(mechanism);
            string aliased = (string) algorithms[mechanism];

            if (aliased != null)
                mechanism = aliased;

            return (DerObjectIdentifier) oids[mechanism];
        }

Usage Example

Пример #1
0
        private static Asn1Encodable GetPssX509Parameters(
            string digestName)
        {
            AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier(
                DigestUtilities.GetObjectIdentifier(digestName), DerNull.Instance);

            // TODO Is it possible for the MGF hash alg to be different from the PSS one?
            AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier(
                PkcsObjectIdentifiers.IdMgf1, hashAlgorithm);

            int saltLen = DigestUtilities.GetDigest(digestName).GetDigestSize();

            return(new RsassaPssParameters(hashAlgorithm, maskGenAlgorithm,
                                           new DerInteger(saltLen), new DerInteger(1)));
        }