Examples of X509Certificate

  • java.security.cert.X509Certificate
    etf.org/rfc/rfc2459.txt"> http://www.ietf.org/rfc/rfc2459.txt .

    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:

      InputStream inStream = new FileInputStream("fileName-of-cert"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); inStream.close(); 
    @author Hemma Prafullchandra @version 1.40 @see Certificate @see CertificateFactory @see X509Extension
  • javax.security.cert.X509Certificate
    Abstract class for X.509 v1 certificates. This provides a standard way to access all the version 1 attributes of an X.509 certificate. Attributes that are specific to X.509 v2 or v3 are not available through this interface. Future API evolution will provide full access to complete X.509 v3 attributes.

    The basic X.509 format was defined by ISO/IEC and ANSI X9 and 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 Certificate Authorities (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.

    The ASN.1 definition of {@code tbsCertificate} is:

     TBSCertificate  ::=  SEQUENCE  { version         [0]  EXPLICIT Version DEFAULT v1, serialNumber         CertificateSerialNumber, signature            AlgorithmIdentifier, issuer               Name, validity             Validity, subject              Name, subjectPublicKeyInfo SubjectPublicKeyInfo, } 

    Here is sample code to instantiate an X.509 certificate:

     InputStream inStream = new FileInputStream("fileName-of-cert"); X509Certificate cert = X509Certificate.getInstance(inStream); inStream.close(); 
    OR
     byte[] certData = <certificate read from a file, say> X509Certificate cert = X509Certificate.getInstance(certData); 

    In either case, the code that instantiates an X.509 certificate consults the value of the {@code cert.provider.x509v1} security propertyto locate the actual implementation or instantiates a default implementation.

    The {@code cert.provider.x509v1} property is set to a defaultimplementation for X.509 such as:

     cert.provider.x509v1=com.sun.security.cert.internal.x509.X509V1CertImpl 

    The value of this {@code cert.provider.x509v1} property has to bechanged to instantiate another implementation. If this security property is not set, a default implementation will be used. Currently, due to possible security restrictions on access to Security properties, this value is looked up and cached at class initialization time and will fallback on a default implementation if the Security property is not accessible.

    Note: The classes in the package {@code javax.security.cert}exist for compatibility with earlier versions of the Java Secure Sockets Extension (JSSE). New applications should instead use the standard Java SE certificate classes located in {@code java.security.cert}.

    @author Hemma Prafullchandra @since 1.4 @see Certificate @see java.security.cert.X509Extension @see java.security.Security security properties
  • net.rim.device.api.crypto.certificate.x509.X509Certificate
    Implements a X.509v3 certificate according to the following ASN.1 data structure:

     Certificate  ::=  SEQUENCE  { tbsCertificate			TBSCertificate, signatureAlgorithm		AlgorithmIdentifier, signatureValue      	BIT STRING } 
    If you want to create a certificate, follow these steps:
  • create a {@link X509TBSCertificate X509TBSCertificate} object and fillit with sensible data
  • call the {@link #X509Certificate(X509TBSCertificate)} constructor andpass the tbsCertificate as an argument
  • call {@link #setSignature(byte[]) setSignature} with a pre-computedsignature of the tbsCertificate
  • {@link #getEncoded() getEncoded()} will return the DER-encodedcertificate as a Byte array.

    Example:

     PrivateKey CASigningKey = ...; X509Certificate CASignatureCert = ...; PublicKey subjectPublicKey = ...; Name issuerDN = new Name("cn=My CA, c=DE"); Name subjectDN = new Name("cn=Myself, c=DE"); Calendar validFrom = ...; Calendar validUntil = ...; X509TBSCertificate tbs = new X509TBSCertificate(); tbs.setSerialNumber(new BigInteger("1")); tbs.setSubjectPublicKey(subjectPublicKey); tbs.setSubjectDN(subjectDN); tbs.setIssuerDN(issuerDN); tbs.setNotBefore(validFrom); tbs.setNotAfter(validUntil); X509Certificate theCert = new X509Certificate(tbs); Signature mySig = Signature.getInstance(...); mySig.initSign(CASigningKey); theCert.sign(mySig, CASignatureCert); 
    @author Markus Tak
  • org.opensaml.xml.signature.X509Certificate
    XMLObject representing XML Digital Signature, version 20020212, X509Certificate element.

  • Examples of java.security.cert.X509Certificate

        throws java.security.cert.CertificateException
      {
        TempBuffer tb = TempBuffer.allocate();
        byte []buffer = tb.getBuffer();
        int len = getClientCertificate(_fd, buffer, 0, buffer.length);
        X509Certificate cert = null;

        if (len > 0 && len < buffer.length) {
          try {
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            InputStream is = new ByteArrayInputStream(buffer, 0, len);
    View Full Code Here

    Examples of java.security.cert.X509Certificate

          keypair.generate(keysize);

          PrivateKey privKey = keypair.getPrivateKey();
          X500Name x500name = new X500Name("CN=" + name);
         
          X509Certificate cert
            = keypair.getSelfCertificate(x500name, days * 24 * 3600);

          return new SelfSignedCert(cert, privKey);
        } catch (Exception e) {
          log.log(Level.FINE, e.toString(), e);
    View Full Code Here

    Examples of javax.security.cert.X509Certificate

         * @throws Exception if the certificate chain cannot be verified
         */
        protected void verify(String host, SSLSession session) throws Exception {

            X509Certificate[] chain;
            X509Certificate   certificate;
            Principal         principal;
            PublicKey         publicKey;
            String            DN;
            String            CN;
            int               start;
            int               end;
            String            emsg;

            chain       = session.getPeerCertificateChain();
            certificate = chain[0];
            principal   = certificate.getSubjectDN();
            DN          = String.valueOf(principal);
            start       = DN.indexOf("CN=");

            if (start < 0) {
                throw new UnknownHostException(
    View Full Code Here

    Examples of net.rim.device.api.crypto.certificate.x509.X509Certificate

                // For this sample we use a hard coded certificate contained below.
                // This encoding would be extracted from the card using a series of
                // APDU commands.
                Certificate certificate = null;
                try {
                    certificate = new X509Certificate(CERTIFICATE_ENCODING);
                } catch (final CertificateParsingException e) {
                    // Should not happen.
                }

                stepProgressDialog(1);
    View Full Code Here

    Examples of org.opensaml.xml.signature.X509Certificate

                processCertKeyNameOptions(keyInfo, javaCert);
               
                // The cert chain includes the entity cert, so don't add a duplicate
                if (options.emitEntityCertificate && ! options.emitEntityCertificateChain) {
                    try {
                        X509Certificate xmlCert = KeyInfoHelper.buildX509Certificate(javaCert);
                        x509Data.getX509Certificates().add(xmlCert);
                    } catch (CertificateEncodingException e) {
                        throw new SecurityException("Error generating X509Certificate element "
                                + "from credential's end-entity certificate", e);
                    }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.