use of sun.security.util.ObjectIdentifier in project Payara by payara.
the class GSSUtils method getOID.
/*
* Return the OID corresponding to an OID represented in DER format as follows: 0x06 -- Tag for
* OBJECT IDENTIFIER derOID.length -- length in octets of OID DER value of OID -- written as
* specified byte the DER representation for an ObjectIdentifier.
*/
public static ObjectIdentifier getOID(byte[] derOID) throws IOException {
DerInputStream dis = new DerInputStream(derOID);
ObjectIdentifier oid = dis.getOID();
/*
* Note: getOID() method call generates an IOException if derOID contains any malformed data
*/
return oid;
}
use of sun.security.util.ObjectIdentifier in project Payara by payara.
the class GSSUtils method verifyMechOID.
/* verify if exportedName is of object ObjectIdentifier. */
public static boolean verifyMechOID(ObjectIdentifier oid, byte[] externalName) throws IOException {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Attempting to verify mechanism independent name");
_logger.log(Level.FINE, dumpHex(externalName));
}
IOException e = new IOException("Invalid Name");
if (externalName[0] != 0x04)
throw e;
if (externalName[1] != 0x01)
throw e;
int mechoidlen = ((externalName[2]) << 8) + (externalName[3] & 0xff);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Mech OID length = " + mechoidlen);
}
if (externalName.length < (4 + mechoidlen + 4))
throw e;
/*
* get the mechanism OID and verify it is the same as oid passed as an argument.
*/
byte[] deroid = new byte[mechoidlen];
System.arraycopy(externalName, 4, deroid, 0, mechoidlen);
ObjectIdentifier oid1 = getOID(deroid);
if (!oid1.equals(oid))
return false;
else
return true;
}
Aggregations