本文整理汇总了C#中Org.BouncyCastle.Asn1.X509.GeneralName类的典型用法代码示例。如果您正苦于以下问题:C# GeneralName类的具体用法?C# GeneralName怎么用?C# GeneralName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeneralName类属于Org.BouncyCastle.Asn1.X509命名空间,在下文中一共展示了GeneralName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneralSubtree
private GeneralSubtree(
Asn1Sequence seq)
{
baseName = GeneralName.GetInstance(seq[0]);
switch (seq.Count)
{
case 1:
break;
case 2:
{
Asn1TaggedObject o = Asn1TaggedObject.GetInstance(seq[1]);
switch (o.TagNo)
{
case 0:
minimum = DerInteger.GetInstance(o, false);
break;
case 1:
maximum = DerInteger.GetInstance(o, false);
break;
default:
throw new ArgumentException("Bad tag number: " + o.TagNo);
}
break;
}
case 3:
{
minimum = DerInteger.GetInstance(Asn1TaggedObject.GetInstance(seq[1]));
maximum = DerInteger.GetInstance(Asn1TaggedObject.GetInstance(seq[2]));
break;
}
default:
throw new ArgumentException("Bad sequence size: " + seq.Count);
}
}
示例2: FromCertificate
private static Asn1Sequence FromCertificate(
X509Certificate certificate)
{
try
{
GeneralName genName = new GeneralName(
PrincipalUtilities.GetIssuerX509Principal(certificate));
if (certificate.Version == 3)
{
Asn1OctetString ext = certificate.GetExtensionValue(X509Extensions.SubjectKeyIdentifier);
if (ext != null)
{
Asn1OctetString str = (Asn1OctetString) X509ExtensionUtilities.FromExtensionValue(ext);
return (Asn1Sequence) new AuthorityKeyIdentifier(
str.GetOctets(), new GeneralNames(genName), certificate.SerialNumber).ToAsn1Object();
}
}
SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(
certificate.GetPublicKey());
return (Asn1Sequence) new AuthorityKeyIdentifier(
info, new GeneralNames(genName), certificate.SerialNumber).ToAsn1Object();
}
catch (Exception e)
{
throw new CertificateParsingException("Exception extracting certificate details", e);
}
}
示例3: PopoSigningKeyInput
/** Creates a new PopoSigningKeyInput with sender name as authInfo. */
public PopoSigningKeyInput(
GeneralName sender,
SubjectPublicKeyInfo spki)
{
this.sender = sender;
this.publicKey = spki;
}
示例4: PkiHeaderBuilder
public PkiHeaderBuilder(
int pvno,
GeneralName sender,
GeneralName recipient)
: this(new DerInteger(pvno), sender, recipient)
{
}
示例5: AccessDescription
/**
* create an AccessDescription with the oid and location provided.
*/
public AccessDescription(
DerObjectIdentifier oid,
GeneralName location)
{
accessMethod = oid;
accessLocation = location;
}
示例6: SemanticsInformation
public SemanticsInformation(
DerObjectIdentifier semanticsIdentifier,
GeneralName[] generalNames)
{
this.semanticsIdentifier = semanticsIdentifier;
this.nameRegistrationAuthorities = generalNames;
}
示例7: checkExcluded
// throws PkixNameConstraintValidatorException
/**
* Check if the given GeneralName is contained in the excluded ISet.
*
* @param name The GeneralName.
* @throws PkixNameConstraintValidatorException
* If the <code>name</code> is
* excluded.
*/
public void checkExcluded(GeneralName name)
{
switch (name.TagNo)
{
case 1:
CheckExcludedEmail(excludedSubtreesEmail, ExtractNameAsString(name));
break;
case 2:
checkExcludedDNS(excludedSubtreesDNS, DerIA5String.GetInstance(
name.Name).GetString());
break;
case 4:
CheckExcludedDN(Asn1Sequence.GetInstance(name.Name.ToAsn1Object()));
break;
case 6:
checkExcludedURI(excludedSubtreesURI, DerIA5String.GetInstance(
name.Name).GetString());
break;
case 7:
byte[] ip = Asn1OctetString.GetInstance(name.Name).GetOctets();
checkExcludedIP(excludedSubtreesIP, ip);
break;
}
}
示例8: PerformTest
public override void PerformTest()
{
GeneralName name = new GeneralName(new X509Name("CN=hello world"));
NamingAuthority auth = new NamingAuthority(new DerObjectIdentifier("1.2.3"), "url", new DirectoryString("fred"));
Admissions admissions = new Admissions(name, auth, new ProfessionInfo[0]);
checkConstruction(admissions, name, auth);
admissions = Admissions.GetInstance(null);
if (admissions != null)
{
Fail("null GetInstance() failed.");
}
try
{
Admissions.GetInstance(new Object());
Fail("GetInstance() failed to detect bad object.");
}
catch (ArgumentException)
{
// expected
}
}
示例9: AuthorityInformationAccess
/**
* create an AuthorityInformationAccess with the oid and location provided.
*/
public AuthorityInformationAccess(
DerObjectIdentifier oid,
GeneralName location)
{
accessMethod = oid;
accessLocation = location;
}
示例10: checkValues
private void checkValues(
Admissions admissions,
GeneralName name,
NamingAuthority auth)
{
checkMandatoryField("admissionAuthority", name, admissions.AdmissionAuthority);
checkMandatoryField("namingAuthority", auth, admissions.NamingAuthority);
}
示例11: SinglePubInfo
private SinglePubInfo(Asn1Sequence seq)
{
pubMethod = DerInteger.GetInstance(seq[0]);
if (seq.Count == 2)
{
pubLocation = GeneralName.GetInstance(seq[1]);
}
}
示例12: Admissions
/**
* Constructor from a given details.
* <p/>
* Parameter <code>professionInfos</code> is mandatory.
*
* @param admissionAuthority The admission authority.
* @param namingAuthority The naming authority.
* @param professionInfos The profession infos.
*/
public Admissions(
GeneralName admissionAuthority,
NamingAuthority namingAuthority,
ProfessionInfo[] professionInfos)
{
this.admissionAuthority = admissionAuthority;
this.namingAuthority = namingAuthority;
this.professionInfos = new DerSequence(professionInfos);
}
示例13: TbsRequest
public TbsRequest(
GeneralName requestorName,
Asn1Sequence requestList,
X509Extensions requestExtensions)
{
this.version = V1;
this.requestorName = requestorName;
this.requestList = requestList;
this.requestExtensions = requestExtensions;
}
示例14: GetNames
public GeneralName[] GetNames()
{
GeneralName[] names = new GeneralName[seq.Count];
for (int i = 0; i != seq.Count; i++)
{
names[i] = GeneralName.GetInstance(seq[i]);
}
return names;
}
示例15: Procuration
/**
* Constructor from a given details.
* <p/>
* <p/>
* Either <code>generalName</code> or <code>certRef</code> MUST be
* <code>null</code>.
*
* @param country The country code whose laws apply.
* @param typeOfSubstitution The type of procuration.
* @param thirdPerson The GeneralName of the person who is represented.
* @param certRef Reference to certificate of the person who is represented.
*/
public Procuration(
string country,
DirectoryString typeOfSubstitution,
GeneralName thirdPerson,
IssuerSerial certRef)
{
this.country = new DerPrintableString(country, true);
this.typeOfSubstitution = typeOfSubstitution;
this.thirdPerson = thirdPerson;
this.certRef = certRef;
}