keyfactory.java
来自「kaffe是一个java虚拟机的源代码。里面包含了一些java例程和标准的jav」· Java 代码 · 共 99 行
JAVA
99 行
/* * KeyFactory.java * * Copyright (c) 2001 University of Utah and the Flux Group. * All rights reserved. * * This file is licensed under the terms of the GNU Public License. * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Contributed by the Flux Research Group, Department of Computer Science, * University of Utah, http://www.cs.utah.edu/flux/ */package java.security;import kaffe.security.Engine;import java.security.spec.KeySpec;import java.security.spec.InvalidKeySpecException;public class KeyFactory{ private static final String ENGINE_CLASS = "KeyFactory"; private KeyFactorySpi keyFacSpi; private Provider provider; private String algorithm; protected KeyFactory(KeyFactorySpi keyFacSpi, Provider provider, String algorithm) { this.keyFacSpi = keyFacSpi; this.provider = provider; this.algorithm = algorithm; } public final Provider getProvider() { return this.provider; } public final String getAlgorithm() { return this.algorithm; } public final PublicKey generatePublic(KeySpec keySpec) throws InvalidKeySpecException { return this.keyFacSpi.engineGeneratePublic(keySpec); } public final PrivateKey generatePrivate(KeySpec keySpec) throws InvalidKeySpecException { return this.keyFacSpi.engineGeneratePrivate(keySpec); } public final KeySpec getKeySpec(Key key, Class keySpec) throws InvalidKeySpecException { return this.keyFacSpi.engineGetKeySpec(key, keySpec); } public final Key translateKey(Key key) throws InvalidKeyException { return this.keyFacSpi.engineTranslateKey(key); } public static KeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException { return getInstance(Engine.getCryptInstance(ENGINE_CLASS, algorithm)); } public static KeyFactory getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException { return getInstance(Engine.getCryptInstance(ENGINE_CLASS, algorithm, provider)); } private static KeyFactory getInstance(Engine e) { KeyFactorySpi spi; KeyFactory retval; spi = (KeyFactorySpi)e.getEngine(); retval = new KeyFactory(spi, e.getProvider(), e.getAlgorithm()); return retval; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?