List of usage examples for java.security.interfaces RSAPublicKey getFormat
public String getFormat();
From source file:com.kuzumeji.platform.standard.SecurityServiceTest.java
@Test public void testKeyPair() { // RSA???/* ww w . j av a 2 s . c o m*/ final KeyPair keyPair = testee.generateKeyPair(); final RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); final RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); LOG.debug("?->{}", dumpKeyPair(publicKey)); LOG.debug("?->{}", dumpKeyPair(privateKey)); // RSA???/ testee.saveKeyPair("testee", keyPair); final KeyPair keyPair2 = testee.loadKeyPair("testee"); assertThat(keyPair2.getPublic().getAlgorithm(), is(publicKey.getAlgorithm())); assertThat(keyPair2.getPublic().getFormat(), is(publicKey.getFormat())); assertThat(keyPair2.getPublic().getEncoded(), is(publicKey.getEncoded())); assertThat(keyPair2.getPrivate().getAlgorithm(), is(privateKey.getAlgorithm())); assertThat(keyPair2.getPrivate().getFormat(), is(privateKey.getFormat())); assertThat(keyPair2.getPrivate().getEncoded(), is(privateKey.getEncoded())); // ???(??) final File file = testee.savePublicKeyFile(publicKey); LOG.debug("? : {}", file.getPath()); }