参考地址: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. springboot踩坑记

    1. @ConditionalOnProperty 根据配置加载不同的 bean 场景:对 redis 配置进行封装,实现自动化配置,能兼容哨兵模式和集群模式.想到在 redis 配置中加一个 red ...

  2. php-resque 队列简单使用

    一.安装 php-resque 进入项目根目录,composer 安装 php-resque composer require chrisboulton/php-resque 二.常用方法 1.连接 ...

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

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

  4. linux安装jira

    JIRA配置本地MYSQL数据库 https://blog.csdn.net/coin_one/article/details/78376238 jira7.3.6 linux安装及破解 https: ...

  5. canal使用

    报错信息:com.alibaba.druid.pool.DruidDataSource - testWhileIdle is true, validationQuery not set 解决方法: 找 ...

  6. 错误: 找不到或无法加载主类 java操作hbase出错

    用java操作hbase 利用maven引入hbase包后发现无法启动程序,然后网上说是包的冲突. 我引入了下面三个包然后程序就不能运行了. <dependency> <groupI ...

  7. Java的集合类之Set接口

    Set最大的特性就是不允许在其中存放的元素是重复的.根据这个特点,我们就可以使用Set 这个接口来实现前面提到的关于商品种类的存储需求.Set 可以被用来过滤在其他集合中存放的元素,从而得到一个没有包 ...

  8. 【Codeforces627E】Orchestra(双指针_链表)

    题目 Codeforces627E 翻译 好久没做英语阅读了,来爽一爽吧 ~ 描述 保罗是管弦乐队的成员.弦乐组安排在一个 \(r\times c\) 的矩形方格区域中,其中有 \(n\) 个中提琴手 ...

  9. strlen()与sizeof()

    一.strlen() strlen()为计算字符串长度的函数,以‘\0’为字符串结束标志.注意:其传入参数必须是字符串指针(char*), 当传入的是数组名时,实际上数组退化成指针了. 二.sizeo ...

  10. arc079

    D. Decrease (Contestant ver.) 大意: 每次操作选一个最大数$-n$,其余数全$+1$. 要求构造一个序列$a$, 使得恰好$k$次操作后最大值不超过$n-1$. 只要让$ ...