Java Code Examples for sun.security.x509.AlgorithmId#getOID()

The following examples show how to use sun.security.x509.AlgorithmId#getOID() . 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: RSASignature.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 2
Source File: RSASignature.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 3
Source File: RSASignature.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature)
        throws IOException {
    DerInputStream in = new DerInputStream(signature);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 4
Source File: RSASignature.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 5
Source File: RSASignature.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 6
Source File: RSASignature.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals(oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 7
Source File: RSASignature.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals(oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 8
Source File: RSASignature.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 9
Source File: RSASignature.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature)
        throws IOException {
    DerInputStream in = new DerInputStream(signature);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 10
Source File: RSASignature.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature)
        throws IOException {
    DerInputStream in = new DerInputStream(signature);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 11
Source File: RSASignature.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature)
        throws IOException {
    DerInputStream in = new DerInputStream(signature);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 12
Source File: RSASignature.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] sig)
        throws IOException {
    // Enforce strict DER checking for signatures
    DerInputStream in = new DerInputStream(sig, 0, sig.length, false);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 13
Source File: RSASignature.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature)
        throws IOException {
    DerInputStream in = new DerInputStream(signature);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}
 
Example 14
Source File: RSASignature.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Decode the signature data. Verify that the object identifier matches
 * and return the message digest.
 */
public static byte[] decodeSignature(ObjectIdentifier oid, byte[] signature)
        throws IOException {
    DerInputStream in = new DerInputStream(signature);
    DerValue[] values = in.getSequence(2);
    if ((values.length != 2) || (in.available() != 0)) {
        throw new IOException("SEQUENCE length error");
    }
    AlgorithmId algId = AlgorithmId.parse(values[0]);
    if (algId.getOID().equals((Object)oid) == false) {
        throw new IOException("ObjectIdentifier mismatch: "
            + algId.getOID());
    }
    if (algId.getEncodedParams() != null) {
        throw new IOException("Unexpected AlgorithmId parameters");
    }
    byte[] digest = values[1].getOctetString();
    return digest;
}