当前位置: 首页>>代码示例>>Java>>正文


Java CryptoPrimitive类代码示例

本文整理汇总了Java中java.security.CryptoPrimitive的典型用法代码示例。如果您正苦于以下问题:Java CryptoPrimitive类的具体用法?Java CryptoPrimitive怎么用?Java CryptoPrimitive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CryptoPrimitive类属于java.security包,在下文中一共展示了CryptoPrimitive类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: permits

import java.security.CryptoPrimitive; //导入依赖的package包/类
@Override
public boolean permits(Set<CryptoPrimitive> primitives, Key key) {

    boolean permitted = true;

    if (peerAlgConstraints != null) {
        permitted = peerAlgConstraints.permits(primitives, key);
    }

    if (permitted && userAlgConstraints != null) {
        permitted = userAlgConstraints.permits(primitives, key);
    }

    if (permitted) {
        permitted = tlsDisabledAlgConstraints.permits(primitives, key);
    }

    if (permitted && enabledX509DisabledAlgConstraints) {
        permitted = x509DisabledAlgConstraints.permits(primitives, key);
    }

    return permitted;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SSLAlgorithmConstraints.java

示例2: createExtension

import java.security.CryptoPrimitive; //导入依赖的package包/类
static SupportedEllipticCurvesExtension createExtension(
            AlgorithmConstraints constraints) {

    ArrayList<Integer> idList = new ArrayList<>(supportedCurveIds.length);
    for (int curveId : supportedCurveIds) {
        if (constraints.permits(
                EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                            "EC", idToParams.get(curveId))) {
            idList.add(curveId);
        }
    }

    if (!idList.isEmpty()) {
        int[] ids = new int[idList.size()];
        int i = 0;
        for (Integer id : idList) {
            ids[i++] = id;
        }

        return new SupportedEllipticCurvesExtension(ids);
    }

    return null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:SupportedEllipticCurvesExtension.java

示例3: checkConstraints

import java.security.CryptoPrimitive; //导入依赖的package包/类
private boolean checkConstraints(Set<CryptoPrimitive> primitives,
        String algorithm, Key key, AlgorithmParameters parameters) {

    // check the key parameter, it cannot be null.
    if (key == null) {
        throw new IllegalArgumentException("The key cannot be null");
    }

    // check the signature algorithm
    if (algorithm != null && algorithm.length() != 0) {
        if (!permits(primitives, algorithm, parameters)) {
            return false;
        }
    }

    // check the key algorithm
    if (!permits(primitives, key.getAlgorithm(), null)) {
        return false;
    }

    // check the key constraints
    return algorithmConstraints.permits(key);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:DisabledAlgorithmConstraints.java

示例4: getPreferredGroup

import java.security.CryptoPrimitive; //导入依赖的package包/类
NamedGroup getPreferredGroup(
        AlgorithmConstraints constraints, NamedGroupType type) {

    for (int groupId : requestedNamedGroupIds) {
        NamedGroup namedGroup = NamedGroup.valueOf(groupId);
        if ((namedGroup != null) && (namedGroup.type == type) &&
            SupportedGroupsExtension.supports(namedGroup) &&
            constraints.permits(EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                namedGroup.algorithm, namedGroupParams.get(namedGroup))) {

            return namedGroup;
        }
    }

    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:SupportedGroupsExtension.java

示例5: checkConstraints

import java.security.CryptoPrimitive; //导入依赖的package包/类
private boolean checkConstraints(Set<CryptoPrimitive> primitives,
        String algorithm, Key key, AlgorithmParameters parameters) {

    // check the key parameter, it cannot be null.
    if (key == null) {
        throw new IllegalArgumentException("The key cannot be null");
    }

    // check the signature algorithm with parameters
    if (algorithm != null && algorithm.length() != 0) {
        if (!permits(primitives, algorithm, parameters)) {
            return false;
        }
    }

    // check the key algorithm
    if (!permits(primitives, key.getAlgorithm(), null)) {
        return false;
    }

    // check the key constraints
    return algorithmConstraints.permits(key);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:DisabledAlgorithmConstraints.java

示例6: permits

import java.security.CryptoPrimitive; //导入依赖的package包/类
public boolean permits(Set<CryptoPrimitive> primitives, Key key) {

        boolean permitted = true;

        if (peerAlgConstraints != null) {
            permitted = peerAlgConstraints.permits(primitives, key);
        }

        if (permitted && userAlgConstraints != null) {
            permitted = userAlgConstraints.permits(primitives, key);
        }

        if (permitted) {
            permitted = tlsDisabledAlgConstraints.permits(primitives, key);
        }

        if (permitted && enabledX509DisabledAlgConstraints) {
            permitted = x509DisabledAlgConstraints.permits(primitives, key);
        }

        return permitted;
    }
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:23,代码来源:SSLAlgorithmConstraints.java

示例7: permits

import java.security.CryptoPrimitive; //导入依赖的package包/类
@Override
final public boolean permits(Set<CryptoPrimitive> primitives,
        String algorithm, AlgorithmParameters parameters) {

    if (algorithm == null || algorithm.length() == 0) {
        throw new IllegalArgumentException("No algorithm name specified");
    }

    if (primitives == null || primitives.isEmpty()) {
        throw new IllegalArgumentException(
                    "No cryptographic primitive specified");
    }

    Set<String> elements = null;
    for (String disabled : disabledAlgorithms) {
        if (disabled == null || disabled.isEmpty()) {
            continue;
        }

        // check the full name
        if (disabled.equalsIgnoreCase(algorithm)) {
            return false;
        }

        // decompose the algorithm into sub-elements
        if (elements == null) {
            elements = decomposes(algorithm);
        }

        // check the items of the algorithm
        for (String element : elements) {
            if (disabled.equalsIgnoreCase(element)) {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:DisabledAlgorithmConstraints.java

示例8: checkConstraints

import java.security.CryptoPrimitive; //导入依赖的package包/类
private boolean checkConstraints(Set<CryptoPrimitive> primitives,
        String algorithm, Key key, AlgorithmParameters parameters) {

    // check the key parameter, it cannot be null.
    if (key == null) {
        throw new IllegalArgumentException("The key cannot be null");
    }

    // check the target algorithm
    if (algorithm != null && algorithm.length() != 0) {
        if (!permits(primitives, algorithm, parameters)) {
            return false;
        }
    }

    // check the key algorithm
    if (!permits(primitives, key.getAlgorithm(), null)) {
        return false;
    }

    // check the key constraints
    if (keySizeConstraints.disables(key)) {
        return false;
    }

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DisabledAlgorithmConstraints.java

示例9: getPreferredCurve

import java.security.CryptoPrimitive; //导入依赖的package包/类
private static int getPreferredCurve(int[] curves,
            AlgorithmConstraints constraints) {
    for (int curveId : curves) {
        if (isSupported(curveId) && constraints.permits(
                EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                            "EC", idToParams.get(curveId))) {
            return curveId;
        }
    }

    return -1;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:SupportedEllipticCurvesExtension.java

示例10: permits

import java.security.CryptoPrimitive; //导入依赖的package包/类
@Override
final public boolean permits(Set<CryptoPrimitive> primitives,
        String algorithm, AlgorithmParameters parameters) {

    if (primitives == null || primitives.isEmpty()) {
        throw new IllegalArgumentException(
                    "No cryptographic primitive specified");
    }

    return checkAlgorithm(disabledAlgorithms, algorithm, decomposer);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:DisabledAlgorithmConstraints.java

示例11: getPreferredECGroup

import java.security.CryptoPrimitive; //导入依赖的package包/类
static NamedGroup getPreferredECGroup(AlgorithmConstraints constraints) {
    for (NamedGroup namedGroup : supportedNamedGroups) {
        if ((namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) &&
            constraints.permits(EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                namedGroup.algorithm, namedGroupParams.get(namedGroup))) {

            return namedGroup;
        }
    }

    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:SupportedGroupsExtension.java

示例12: isActivatable

import java.security.CryptoPrimitive; //导入依赖的package包/类
static boolean isActivatable(
        AlgorithmConstraints constraints, NamedGroupType type) {

    boolean hasFFDHEGroups = false;
    for (NamedGroup namedGroup : supportedNamedGroups) {
        if (namedGroup.type == type) {
            if (constraints.permits(
                    EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                    namedGroup.algorithm,
                    namedGroupParams.get(namedGroup))) {

                return true;
            }

            if (!hasFFDHEGroups &&
                    (type == NamedGroupType.NAMED_GROUP_FFDHE)) {

                hasFFDHEGroups = true;
            }
        }
    }

    // For compatibility, if no FFDHE groups are defined, the non-FFDHE
    // compatible mode (using DHE cipher suite without FFDHE extension)
    // is allowed.
    //
    // Note that the constraints checking on DHE parameters will be
    // performed during key exchanging in a handshake.
    if (!hasFFDHEGroups && (type == NamedGroupType.NAMED_GROUP_FFDHE)) {
        return true;
    }

    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:SupportedGroupsExtension.java


注:本文中的java.security.CryptoPrimitive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。