C# Class Org.BouncyCastle.X509.X509V3CertificateGenerator

A class to Generate Version 3 X509Certificates.
Show file Open project: JamieMellway/iTextSharpLGPL-Monotouch Class Usage Examples

Public Methods

Method Description
AddExtension ( DerObjectIdentifier oid, bool critical, Asn1Encodable extensionValue ) : void

Add an extension to this certificate.

AddExtension ( DerObjectIdentifier oid, bool critical, byte extensionValue ) : void

Add an extension to this certificate.

AddExtension ( string oid, bool critical, Asn1Encodable extensionValue ) : void

Add a given extension field for the standard extensions tag (tag 3).

AddExtension ( string oid, bool critical, byte extensionValue ) : void

Add an extension using a string with a dotted decimal OID.

CopyAndAddExtension ( DerObjectIdentifier oid, bool critical, X509Certificate cert ) : void
CopyAndAddExtension ( string oid, bool critical, X509Certificate cert ) : void

Add a given extension field for the standard extensions tag (tag 3), copying the extension value from another certificate.

Generate ( AsymmetricKeyParameter privateKey ) : X509Certificate

Generate an X509Certificate.

Generate ( AsymmetricKeyParameter privateKey, SecureRandom random ) : X509Certificate

Generate an X509Certificate using your own SecureRandom.

Reset ( ) : void

Reset the Generator.

SetIssuerDN ( Org.BouncyCastle.Asn1.X509.X509Name issuer ) : void

Set the distinguished name of the issuer. The issuer is the entity which is signing the certificate.

SetIssuerUniqueID ( bool uniqueID ) : void

Set the issuer unique ID - note: it is very rare that it is correct to do this.

SetNotAfter ( System.DateTime date ) : void

Set the date after which this certificate will no longer be valid.

SetNotBefore ( System.DateTime date ) : void

Set the date that this certificate is to be valid from.

SetPublicKey ( AsymmetricKeyParameter publicKey ) : void

Set the public key that this certificate identifies.

SetSerialNumber ( BigInteger serialNumber ) : void

Set the certificate's serial number.

Make serial numbers long, if you have no serial number policy make sure the number is at least 16 bytes of secure random data. You will be surprised how ugly a serial number collision can Get.

SetSignatureAlgorithm ( string signatureAlgorithm ) : void

Set the signature algorithm that will be used to sign this certificate.

SetSubjectDN ( Org.BouncyCastle.Asn1.X509.X509Name subject ) : void

Set the DN of the entity that this certificate is about.

SetSubjectUniqueID ( bool uniqueID ) : void

Set the subject unique ID - note: it is very rare that it is correct to do this.

X509V3CertificateGenerator ( ) : System

Private Methods

Method Description
GenerateJcaObject ( TbsCertificateStructure tbsCert, byte signature ) : X509Certificate
GenerateTbsCert ( ) : TbsCertificateStructure
booleanToBitString ( bool id ) : DerBitString

Method Details

AddExtension() public method

Add an extension to this certificate.
public AddExtension ( DerObjectIdentifier oid, bool critical, Asn1Encodable extensionValue ) : void
oid Org.BouncyCastle.Asn1.DerObjectIdentifier Its Object Identifier.
critical bool Is it critical.
extensionValue Org.BouncyCastle.Asn1.Asn1Encodable The value.
return void

AddExtension() public method

Add an extension to this certificate.
public AddExtension ( DerObjectIdentifier oid, bool critical, byte extensionValue ) : void
oid Org.BouncyCastle.Asn1.DerObjectIdentifier Its Object Identifier.
critical bool Is it critical.
extensionValue byte byte[] containing the value of this extension.
return void

AddExtension() public method

Add a given extension field for the standard extensions tag (tag 3).
public AddExtension ( string oid, bool critical, Asn1Encodable extensionValue ) : void
oid string string containing a dotted decimal Object Identifier.
critical bool Is it critical.
extensionValue Org.BouncyCastle.Asn1.Asn1Encodable The value.
return void

AddExtension() public method

Add an extension using a string with a dotted decimal OID.
public AddExtension ( string oid, bool critical, byte extensionValue ) : void
oid string string containing a dotted decimal Object Identifier.
critical bool Is it critical.
extensionValue byte byte[] containing the value of this extension.
return void

CopyAndAddExtension() public method

public CopyAndAddExtension ( DerObjectIdentifier oid, bool critical, X509Certificate cert ) : void
oid Org.BouncyCastle.Asn1.DerObjectIdentifier
critical bool
cert X509Certificate
return void

CopyAndAddExtension() public method

Add a given extension field for the standard extensions tag (tag 3), copying the extension value from another certificate.
public CopyAndAddExtension ( string oid, bool critical, X509Certificate cert ) : void
oid string
critical bool
cert X509Certificate
return void

Generate() public method

Generate an X509Certificate.
public Generate ( AsymmetricKeyParameter privateKey ) : X509Certificate
privateKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter The private key of the issuer that is signing this certificate.
return X509Certificate

Generate() public method

Generate an X509Certificate using your own SecureRandom.
public Generate ( AsymmetricKeyParameter privateKey, SecureRandom random ) : X509Certificate
privateKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter The private key of the issuer that is signing this certificate.
random Org.BouncyCastle.Security.SecureRandom You Secure Random instance.
return X509Certificate

Reset() public method

Reset the Generator.
public Reset ( ) : void
return void

SetIssuerDN() public method

Set the distinguished name of the issuer. The issuer is the entity which is signing the certificate.
public SetIssuerDN ( Org.BouncyCastle.Asn1.X509.X509Name issuer ) : void
issuer Org.BouncyCastle.Asn1.X509.X509Name The issuer's DN.
return void

SetIssuerUniqueID() public method

Set the issuer unique ID - note: it is very rare that it is correct to do this.
public SetIssuerUniqueID ( bool uniqueID ) : void
uniqueID bool
return void

SetNotAfter() public method

Set the date after which this certificate will no longer be valid.
public SetNotAfter ( System.DateTime date ) : void
date System.DateTime
return void

SetNotBefore() public method

Set the date that this certificate is to be valid from.
public SetNotBefore ( System.DateTime date ) : void
date System.DateTime
return void

SetPublicKey() public method

Set the public key that this certificate identifies.
public SetPublicKey ( AsymmetricKeyParameter publicKey ) : void
publicKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter
return void

SetSerialNumber() public method

Set the certificate's serial number.
Make serial numbers long, if you have no serial number policy make sure the number is at least 16 bytes of secure random data. You will be surprised how ugly a serial number collision can Get.
public SetSerialNumber ( BigInteger serialNumber ) : void
serialNumber Org.BouncyCastle.Math.BigInteger The serial number.
return void

SetSignatureAlgorithm() public method

Set the signature algorithm that will be used to sign this certificate.
public SetSignatureAlgorithm ( string signatureAlgorithm ) : void
signatureAlgorithm string
return void

SetSubjectDN() public method

Set the DN of the entity that this certificate is about.
public SetSubjectDN ( Org.BouncyCastle.Asn1.X509.X509Name subject ) : void
subject Org.BouncyCastle.Asn1.X509.X509Name
return void

SetSubjectUniqueID() public method

Set the subject unique ID - note: it is very rare that it is correct to do this.
public SetSubjectUniqueID ( bool uniqueID ) : void
uniqueID bool
return void

X509V3CertificateGenerator() public method

public X509V3CertificateGenerator ( ) : System
return System