参考地址:https://docs.microsoft.com/zh-cn/dotnet/api/system.security.cryptography.oid?redirectedfrom=MSDN&view=netframework-4.8

标题:Oid 类

表示加密对象标识符。 此类不能被继承。

using System;
using System.Security.Cryptography;
public class OidSample
{
public static void Main()
{
// Assign values to strings.
string Value1 = "1.2.840.113549.1.1.1";
string Name1 = "3DES";
string Value2 = "1.3.6.1.4.1.311.20.2";
string InvalidName = "This name is not a valid name";
string InvalidValue = "1.1.1.1.1.1.1.1"; // Create new Oid objects using the specified values.
// Note that the corresponding Value or Friendly Name property is automatically added to the object.
Oid o1 = new Oid(Value1);
Oid o2 = new Oid(Name1); // Create a new Oid object using the specified Value and Friendly Name properties.
// Note that the two are not compared to determine if the Value is associated
// with the Friendly Name.
Oid o3 = new Oid(Value2, InvalidName); //Create a new Oid object using the specified Value. Note that if the value
// is invalid or not known, no value is assigned to the Friendly Name property.
Oid o4 = new Oid(InvalidValue); //Write out the property information of the Oid objects.
Console.WriteLine("Oid1: Automatically assigned Friendly Name: {0}, {1}", o1.FriendlyName, o1.Value);
Console.WriteLine("Oid2: Automatically assigned Value: {0}, {1}", o2.FriendlyName, o2.Value);
Console.WriteLine("Oid3: Name and Value not compared: {0}, {1}", o3.FriendlyName, o3.Value);
Console.WriteLine("Oid4: Invalid Value used: {0}, {1} {2}", o4.FriendlyName, o4.Value, Environment.NewLine); //Create an Oid collection and add several Oid objects.
OidCollection oc = new OidCollection();
oc.Add(o1);
oc.Add(o2);
oc.Add(o3);
Console.WriteLine("Number of Oids in the collection: {0}", oc.Count);
Console.WriteLine("Is synchronized: {0} {1}", oc.IsSynchronized, Environment.NewLine); //Create an enumerator for moving through the collection.
OidEnumerator oe = oc.GetEnumerator();
//You must execute a MoveNext() to get to the first item in the collection.
oe.MoveNext();
// Write out Oids in the collection.
Console.WriteLine("First Oid in collection: {0},{1}", oe.Current.FriendlyName,oe.Current.Value);
oe.MoveNext();
Console.WriteLine("Second Oid in collection: {0},{1}", oe.Current.FriendlyName, oe.Current.Value);
//Return index in the collection to the beginning.
oe.Reset();
}
}

OID value:1.3.14.3.2.26     sha1

Oid 类的更多相关文章

  1. Java类的继承与多态特性-入门笔记

    相信对于继承和多态的概念性我就不在怎么解释啦!不管你是.Net还是Java面向对象编程都是比不缺少一堂课~~Net如此Java亦也有同样的思想成分包含其中. 继承,多态,封装是Java面向对象的3大特 ...

  2. 基于php的snmp管理端开发

    一.系统环境: 操作系统:CentOS 5.4                内核:Linux_2.6 编译环境:gcc 4.1.2                代码版本:php-5.2.8.tar ...

  3. MongoDB框架Jongo的使用介绍

    1.Jongo可以用来做什么?   Jongo框架的目的是使在MongoDB中可以直接使用的查询Shell可以直接在Java中使用.在官网首页有一个非常简洁的例子:   SHELL:这种查询方式是Mo ...

  4. Hibernate持久化类属性映射

    Hibernate充当应用程序和数据库之间的中间件,实现二者之间的交互操作,他对JDBC进行了封装,以完全面向对象的方式来操作数据. 适用于有多个数据源的情况下,不必去考虑不同数据源的操作差异. Hi ...

  5. Hibernate的持久化类状态

    Hibernate的持久化类状态 持久化类:就是一个实体类 与 数据库表建立了映射. Hibernate为了方便管理持久化类,将持久化类分成了三种状态. 瞬时态 transient (临时态):持久化 ...

  6. Json工具类,实现了反射将整个Object转换为Json对象的功能,支持Hibernate的延迟加

    package com.aherp.framework.util; import java.lang.reflect.Array;import java.lang.reflect.Method;imp ...

  7. OID,主键生成策略,PO VO DTO,get和load区别,脏检查,快照,java对象的三种状态

    主键生成策略 sequence 数据库端 native 数据库端 uuid  程序端 自动赋值 生成的是一个32位的16进制数  实体类需把ID改成String 类型 assigned  程序端 需手 ...

  8. 06.Hibernate实体类生命周期

        前言:Session接口是Hibernate向应用程序提供的操作数据库的主要接口,它提供了基本的增删查改方法,而且Session具有一个缓存它是Hibernate的一级缓存.站在持久化层的角度 ...

  9. 1.1Hibernate持久化类和Hibernate持久化对象状态

    一.持久化对象po类 1.po定义 PO,是Persistent Object的缩写,是持久化类.PO是由PO=POJO+hbm映射配置组成. 2.通俗理解 PO类即持久化类,其实就是一个普通的Jav ...

随机推荐

  1. Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) 解决办法

    1:我遇到的问题: 在开机运行apt install vim 命令的时候,如下报错: 2:参考博客: 在Ubuntu中,有时候运用sudo  apt-get install 安装软件时,会出现一下的情 ...

  2. 【python库】tqdm介绍及常用方法

    前言 Tqdm 是一个快速,可扩展的Python进度条,可以在 Python 长循环中添加一个进度提示信息,用户只需要封装任意的迭代器 tqdm(iterator).具体使用可以查看官网. 操作 fr ...

  3. IDEA 2018.3.5,修改js文件,html页面不及时更新

    问题描述 使用IDEA 开发时,修改js文件,前端页面不能及时更新. 解决方法: 1. IDEA settings--> Compiler --> Build project automa ...

  4. scala 样例类

    一.case class 的特征 package com.jason.qianfeng case class Message(sender: String, receiver: String, bod ...

  5. RSA非对称式加解密笔记

    1.服务器生成[公钥]和[私钥],成对生成: 2.客户端生成证书信息,使用[公钥]进行加密,前提是有公钥,并生成证书信息: 3.客户端发送自身的计算机名.MAC.用户名.证书内容给服务器: 4.服务器 ...

  6. [原创]K8Cscan for Python 2.0

    0x000 简介 K8Cscan扫描器Python版支持Windows和Linux系统 详情参考:https://www.cnblogs.com/k8gege/p/10519321.html 0x00 ...

  7. 构建C1000K的服务器(1) – 基础

    转自: http://www.ideawu.net/blog/archives/740.html 著名的 C10K 问题提出的时候, 正是 2001 年, 到如今 12 年后的 2013 年, C10 ...

  8. LeetCode 912. 排序数组(Sort an Array) 43

    912. 排序数组 912. Sort an Array 题目描述 每日一算法2019/6/15Day 43LeetCode912. Sort an Array

  9. [转帖]NSA武器库知识整理

    NSA武器库知识整理 https://www.cnblogs.com/FrostDeng/p/7120812.html 美国国家安全局(NSA)旗下的“方程式黑客组织”(shadow brokers) ...

  10. MOOC C#笔记(一):数据类型

    C#笔记 基础知识 一个C#程序主要包括以下部分: 命名空间声明(Namespace declaration) 一个 class Class 方法 Class 属性 一个 Main 方法 语句(Sta ...