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


Java KeyFactorySpi类代码示例

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


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

示例1: testKeyFactorySpi

import java.security.KeyFactorySpi; //导入依赖的package包/类
/**
 * Test for <code>KeyFactorySpi</code> constructor
 * Assertion: constructs KeyFactorySpi
 */
public void testKeyFactorySpi() {
    MyKeyFactorySpi keyFSpi = new MyKeyFactorySpi();
    assertTrue(keyFSpi instanceof KeyFactorySpi);

    KeySpec ks = new MyKeySpec();
    KeySpec kss = new MyKeySpec();
    try {
        keyFSpi.engineGeneratePrivate(ks);
        keyFSpi.engineGeneratePublic(ks);
        keyFSpi.engineGetKeySpec(null, java.lang.Class.class);
        keyFSpi.engineTranslateKey(null);
    } catch (Exception e) {
        fail("Unexpected exception");
    }
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:20,代码来源:KeyFactorySpiTest.java

示例2: test_constructor

import java.security.KeyFactorySpi; //导入依赖的package包/类
/**
 * @tests java.security.KeyFactory#KeyFactory(java.security.KeyFactorySpi,
 *        java.security.Provider, java.lang.String)
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "KeyFactory",
    args = {java.security.KeyFactorySpi.class, java.security.Provider.class, java.lang.String.class}
)
public void test_constructor() {
    KeyFactorySpi kfs = new KeyFactorySpiStub();

    try {
        new KeyFactoryStub(null, null, null);
    } catch (Exception e) {
        fail("Unexpected exception " + e.getMessage());
    }

    Provider[] providers = Security.getProviders("KeyFactory.DSA");
    if (providers != null) {
        for (int i = 0; i < providers.length; i++) {
            KeyFactoryStub kf = new KeyFactoryStub(kfs, providers[i],
                    "algorithm name");
            assertEquals("algorithm name", kf.getAlgorithm());
            assertEquals(providers[i], kf.getProvider());
        }
    } else {
        fail("No providers support KeyFactory.DSA");
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:32,代码来源:KeyFactory2Test.java

示例3: testKeyFactorySpi

import java.security.KeyFactorySpi; //导入依赖的package包/类
/**
 * Test for <code>KeyFactorySpi</code> constructor
 * Assertion: constructs KeyFactorySpi
 */
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "KeyFactorySpi",
        args = {}
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "engineGeneratePrivate",
        args = {java.security.spec.KeySpec.class}
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "engineGeneratePublic",
        args = {java.security.spec.KeySpec.class}
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "engineTranslateKey",
        args = {java.security.Key.class}
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "engineGetKeySpec",
        args = {java.security.Key.class, java.lang.Class.class}
    )
})
public void testKeyFactorySpi() {
    MyKeyFactorySpi keyFSpi = new MyKeyFactorySpi();
    assertTrue(keyFSpi instanceof KeyFactorySpi);

    KeySpec ks = new MyKeySpec();
    KeySpec kss = new MyKeySpec();
    try {
        keyFSpi.engineGeneratePrivate(ks);
        keyFSpi.engineGeneratePublic(ks);
        keyFSpi.engineGetKeySpec(null, java.lang.Class.class);
        keyFSpi.engineTranslateKey(null);
    } catch (Exception e) {
        fail("Unexpected exception");
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:52,代码来源:KeyFactorySpiTest.java

示例4: KeyFactoryStub

import java.security.KeyFactorySpi; //导入依赖的package包/类
public KeyFactoryStub(KeyFactorySpi keyFacSpi, Provider provider,
        String algorithm) {
    super(keyFacSpi, provider, algorithm);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:5,代码来源:KeyFactory2Test.java


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