Java Code Examples for sun.security.util.ObjectIdentifier#toString()

The following examples show how to use sun.security.util.ObjectIdentifier#toString() . 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: ExtendedKeyUsageExtension.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 2
Source File: ExtendedKeyUsageExtension.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 3
Source File: ExtendedKeyUsageExtension.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 4
Source File: ExtendedKeyUsageExtension.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 5
Source File: ExtendedKeyUsageExtension.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 6
Source File: ExtendedKeyUsageExtension.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 7
Source File: ExtendedKeyUsageExtension.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 8
Source File: ExtendedKeyUsageExtension.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 9
Source File: ExtendedKeyUsageExtension.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the extension as user readable string.
 */
public String toString() {
    if (keyUsages == null) return "";
    String usage = "  ";
    boolean first = true;
    for (ObjectIdentifier oid: keyUsages) {
        if(!first) {
            usage += "\n  ";
        }

        String result = map.get(oid);
        if (result != null) {
            usage += result;
        } else {
            usage += oid.toString();
        }
        first = false;
    }
    return super.toString() + "ExtendedKeyUsages [\n"
           + usage + "\n]\n";
}
 
Example 10
Source File: PKCS12KeyStore.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 11
Source File: PKCS12KeyStore.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 12
Source File: PKCS12KeyStore.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 13
Source File: PKCS12KeyStore.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 14
Source File: PKCS12KeyStore.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 15
Source File: PKCS12KeyStore.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals(pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 16
Source File: OCSPNonceExtensionTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void verifyExtStructure(byte[] derData) throws IOException {
    debuglog("verifyASN1Extension() received " + derData.length + " bytes");
    DerInputStream dis = new DerInputStream(derData);

    // The sequenceItems array should be either two or three elements
    // long.  If three, then the criticality bit setting has been asserted.
    DerValue[] sequenceItems = dis.getSequence(3);
    debuglog("Found sequence containing " + sequenceItems.length +
            " elements");
    if (sequenceItems.length != 2 && sequenceItems.length != 3) {
        throw new RuntimeException("Incorrect number of items found in " +
                "the SEQUENCE (Got " + sequenceItems.length +
                ", expected 2 or 3 items)");
    }

    int seqIndex = 0;
    ObjectIdentifier extOid = sequenceItems[seqIndex++].getOID();
    debuglog("Found OID: " + extOid.toString());
    if (!extOid.equals((Object)PKIXExtensions.OCSPNonce_Id)) {
        throw new RuntimeException("Incorrect OID (Got " +
                extOid.toString() + ", expected " +
                PKIXExtensions.OCSPNonce_Id.toString() + ")");
    }

    if (sequenceItems.length == 3) {
        // Non-default criticality bit setting should be at index 1
        boolean isCrit = sequenceItems[seqIndex++].getBoolean();
        debuglog("Found BOOLEAN (critical): " + isCrit);
    }

    // The extnValue is an encapsulating OCTET STRING that contains the
    // extension's value.  For the OCSP Nonce, that value itself is also
    // an OCTET STRING consisting of the random bytes.
    DerValue extnValue =
            new DerValue(sequenceItems[seqIndex++].getOctetString());
    byte[] nonceData = extnValue.getOctetString();
    debuglog("Found " + nonceData.length + " bytes of nonce data");
}
 
Example 17
Source File: OidEquals.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void assertEquals(ObjectIdentifier oid, Object obj)
        throws Exception {
    if (!oid.equals(obj)) {
        throw new Exception("The ObjectIdentifier " + oid.toString() +
                " should be equal to the Object " + obj.toString());
    }
}
 
Example 18
Source File: OidEquals.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void assertNotEquals(ObjectIdentifier oid, Object obj)
        throws Exception {
    if (oid.equals(obj)) {
        throw new Exception("The ObjectIdentifier " + oid.toString() +
                " should not be equal to the Object " + obj.toString());
    }
}
 
Example 19
Source File: PKCS12KeyStore.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}
 
Example 20
Source File: PKCS12KeyStore.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
    AlgorithmParameters algParams) throws NoSuchAlgorithmException {
    // Check for PBES2 algorithms
    if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
        return algParams.toString();
    }
    return algorithm.toString();
}