Aracılığıyla paylaş


X509Certificate Class

Definition

Abstract class for X.

[Android.Runtime.Register("java/security/cert/X509Certificate", DoNotGenerateAcw=true)]
public abstract class X509Certificate : Java.Security.Cert.Certificate, IDisposable, Java.Interop.IJavaPeerable, Java.Security.Cert.IX509Extension
[<Android.Runtime.Register("java/security/cert/X509Certificate", DoNotGenerateAcw=true)>]
type X509Certificate = class
    inherit Certificate
    interface IX509Extension
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
X509Certificate
Attributes
Implements

Remarks

Abstract class for X.509 certificates. This provides a standard way to access all the attributes of an X.509 certificate.

In June of 1996, the basic X.509 v3 format was completed by ISO/IEC and ANSI X9, which is described below in ASN.1:

Certificate  ::=  SEQUENCE  {
                tbsCertificate       TBSCertificate,
                signatureAlgorithm   AlgorithmIdentifier,
                signature            BIT STRING  }

These certificates are widely used to support authentication and other functionality in Internet security systems. Common applications include Privacy Enhanced Mail (PEM), Transport Layer Security (SSL), code signing for trusted software distribution, and Secure Electronic Transactions (SET).

These certificates are managed and vouched for by <em>Certificate Authorities</em> (CAs). CAs are services which create certificates by placing data in the X.509 standard format and then digitally signing that data. CAs act as trusted third parties, making introductions between principals who have no direct knowledge of each other. CA certificates are either signed by themselves, or by some other CA such as a "root" CA.

More information can be found in RFC 3280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile.

The ASN.1 definition of tbsCertificate is:

TBSCertificate  ::=  SEQUENCE  {
                version         [0]  EXPLICIT Version DEFAULT v1,
                serialNumber         CertificateSerialNumber,
                signature            AlgorithmIdentifier,
                issuer               Name,
                validity             Validity,
                subject              Name,
                subjectPublicKeyInfo SubjectPublicKeyInfo,
                issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
                                     -- If present, version must be v2 or v3
                subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
                                     -- If present, version must be v2 or v3
                extensions      [3]  EXPLICIT Extensions OPTIONAL
                                     -- If present, version must be v3
                }

Certificates are instantiated using a certificate factory. The following is an example of how to instantiate an X.509 certificate:

try (InputStream inStream = new FileInputStream("fileName-of-cert")) {
                CertificateFactory cf = CertificateFactory.getInstance("X.509");
                X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
            }

Java documentation for java.security.cert.X509Certificate.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

X509Certificate()

Constructor for X.

X509Certificate(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

BasicConstraints

Returns the path length of the certificate constraints from the BasicContraints extension.

Class

Returns the runtime class of this Object.

(Inherited from Object)
CriticalExtensionOIDs
ExtendedKeyUsage

Gets an unmodifiable list of Strings representing the OBJECT IDENTIFIERs of the ExtKeyUsageSyntax field of the extended key usage extension, (OID = 2.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasUnsupportedCriticalExtension
IssuerAlternativeNames

Gets an immutable collection of issuer alternative names from the IssuerAltName extension, (OID = 2.

IssuerDN

Returns the issuer (issuer distinguished name) as an implementation specific Principal object.

IssuerX500Principal

Returns the issuer (issuer distinguished name) value from the certificate as an X500Principal.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
NonCriticalExtensionOIDs
NotAfter

Returns the notAfter date of the validity period of the certificate.

NotBefore

Returns the notBefore date from the validity period of the certificate.

PeerReference (Inherited from Object)
PublicKey

Returns the public key corresponding to this certificate.

(Inherited from Certificate)
SerialNumber

Returns the serialNumber of the certificate.

SigAlgName

Returns the name of the algorithm for the certificate signature.

SigAlgOID

Returns the OID of the signature algorithm from the certificate.

SubjectAlternativeNames

Gets an immutable collection of subject alternative names from the SubjectAltName extension, (OID = 2.

SubjectDN

Returns the subject (subject distinguished name) as an implementation specific Principal object.

SubjectX500Principal

Returns the subject (subject distinguished name) value from the certificate as an X500Principal.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Type

Returns the type of this certificate.

(Inherited from Certificate)
Version

Returns the certificates version (version number).

Methods

CheckValidity()

Checks that the certificate is currently valid.

CheckValidity(Date)

Checks that the given date is within the certificate's validity period.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetEncoded()

Returns the encoded form of this certificate.

(Inherited from Certificate)
GetExtensionValue(String)

Gets the DER-encoded OCTET string for the extension value (<em>extnValue</em>) identified by the passed-in oid String.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetIssuerUniqueID()

Gets the issuerUniqueID value from the certificate.

GetKeyUsage()

Gets a boolean array representing bits of the KeyUsage extension, (OID = 2.

GetSigAlgParams()

Gets the DER-encoded signature algorithm parameters from this certificate's signature algorithm.

GetSignature()

Gets the signature value (the raw signature bits) from the certificate.

GetSubjectUniqueID()

Gets the subjectUniqueID value from the certificate.

GetTBSCertificate()

Gets the DER-encoded certificate information, the tbsCertificate from this certificate.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of this certificate.

(Inherited from Certificate)
UnregisterFromRuntime() (Inherited from Object)
Verify(IPublicKey, Provider)

Verifies that this certificate was signed using the private key that corresponds to the specified public key.

Verify(IPublicKey, String)

Verifies that this certificate was signed using the private key that corresponds to the specified public key.

(Inherited from Certificate)
Verify(IPublicKey)

Verifies that this certificate was signed using the private key that corresponds to the specified public key.

(Inherited from Certificate)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteReplace()

Replace the Certificate to be serialized.

(Inherited from Certificate)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to