Java Code Examples for sun.security.x509.X509CertImpl#getEncodedInternal()

The following examples show how to use sun.security.x509.X509CertImpl#getEncodedInternal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Certificate.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 2
Source File: Certificate.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        // J2ObjC changed: arrays should be compared with Arrays.equals
        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 3
Source File: Certificate.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 4
Source File: Certificate.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the <code>other</code> object is an
 * <code>instanceof</code> <code>Certificate</code>, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 5
Source File: Certificate.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 6
Source File: Certificate.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 7
Source File: Certificate.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 8
Source File: Certificate.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 9
Source File: Certificate.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 10
Source File: Certificate.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 11
Source File: Certificate.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 12
Source File: Certificate.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 13
Source File: Certificate.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 14
Source File: Certificate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 15
Source File: Certificate.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 16
Source File: Certificate.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 17
Source File: Certificate.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 18
Source File: Certificate.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 19
Source File: Certificate.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Compares this certificate for equality with the specified
 * object. If the {@code other} object is an
 * {@code instanceof} {@code Certificate}, then
 * its encoded form is retrieved and compared with the
 * encoded form of this certificate.
 *
 * @param other the object to test for equality with this certificate.
 * @return true iff the encoded forms of the two certificates
 * match, false otherwise.
 */
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }
    if (!(other instanceof Certificate)) {
        return false;
    }
    try {
        byte[] thisCert = X509CertImpl.getEncodedInternal(this);
        byte[] otherCert = X509CertImpl.getEncodedInternal((Certificate)other);

        return Arrays.equals(thisCert, otherCert);
    } catch (CertificateException e) {
        return false;
    }
}
 
Example 20
Source File: Certificate.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a hashcode value for this certificate from its
 * encoded form.
 *
 * @return the hashcode value.
 */
public int hashCode() {
    int retval = 0;
    try {
        byte[] certData = X509CertImpl.getEncodedInternal(this);
        for (int i = 1; i < certData.length; i++) {
             retval += certData[i] * i;
        }
        return retval;
    } catch (CertificateException e) {
        return retval;
    }
}