本文整理汇总了Java中sun.security.util.ObjectIdentifier.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectIdentifier.toString方法的具体用法?Java ObjectIdentifier.toString怎么用?Java ObjectIdentifier.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.util.ObjectIdentifier
的用法示例。
在下文中一共展示了ObjectIdentifier.toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import sun.security.util.ObjectIdentifier; //导入方法依赖的package包/类
/**
* 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";
}
示例2: mapPBEParamsToAlgorithm
import sun.security.util.ObjectIdentifier; //导入方法依赖的package包/类
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();
}
示例3: mapPBEParamsToAlgorithm
import sun.security.util.ObjectIdentifier; //导入方法依赖的package包/类
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();
}
示例4: verifyExtStructure
import sun.security.util.ObjectIdentifier; //导入方法依赖的package包/类
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");
}
示例5: assertEquals
import sun.security.util.ObjectIdentifier; //导入方法依赖的package包/类
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());
}
}
示例6: assertNotEquals
import sun.security.util.ObjectIdentifier; //导入方法依赖的package包/类
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());
}
}