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


Java OpenSSLKey.writeTo方法代码示例

本文整理汇总了Java中org.globus.gsi.OpenSSLKey.writeTo方法的典型用法代码示例。如果您正苦于以下问题:Java OpenSSLKey.writeTo方法的具体用法?Java OpenSSLKey.writeTo怎么用?Java OpenSSLKey.writeTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.globus.gsi.OpenSSLKey的用法示例。


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

示例1: writeKey

import org.globus.gsi.OpenSSLKey; //导入方法依赖的package包/类
private void writeKey(OpenSSLKey key, File f) throws GeneralSecurityException {
    try {
        OutputStream keyStream = openStream(f);
        if (!SHARED_PROXIES) {
            f.deleteOnExit();
        }
        try {
            key.writeTo(keyStream);
        }
        finally {
            keyStream.close();
        }
    }
    catch (Exception e) {
        throw new GeneralSecurityException("Failed to save CA private key", e);
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:18,代码来源:AutoCA.java

示例2: writePrivateKey

import org.globus.gsi.OpenSSLKey; //导入方法依赖的package包/类
public static String writePrivateKey(PrivateKey key, String password)
		throws Exception {
	OpenSSLKey ssl = new BouncyCastleOpenSSLKey(key);
	if (password != null) {
		ssl.encrypt(password);
	}
	StringWriter sw = new StringWriter();
	ssl.writeTo(sw);
	sw.close();
	StringBuffer buf = sw.getBuffer();
	// strip out any windows-specific carriage return chars
	int winNlChar = -1;
	while ((winNlChar = buf.indexOf("\r")) != -1) {
	    buf.deleteCharAt(winNlChar);
	}
	String s = buf.toString();
	return s;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:KeyUtil.java

示例3: toString

import org.globus.gsi.OpenSSLKey; //导入方法依赖的package包/类
private String toString(OpenSSLKey key) throws Exception {
    StringWriter writer = new StringWriter();
    key.writeTo(writer);
    writer.close();
    String s = writer.toString();
    System.out.println(s);
    return s;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:9,代码来源:BouncyCastleOpenSSLKeyTest.java

示例4: testEncryptAES

import org.globus.gsi.OpenSSLKey; //导入方法依赖的package包/类
public void testEncryptAES() throws Exception {
       KeyPair keyPair = getKeyPair();

OpenSSLKey key = new BouncyCastleOpenSSLKey(keyPair.getPrivate());

assertTrue(!key.isEncrypted());

       key.setEncryptionAlgorithm("AES-128-CBC");

key.encrypt(pwd);

assertTrue(key.isEncrypted());

       key.writeTo(System.out);
   }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:16,代码来源:BouncyCastleOpenSSLKeyTest.java


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