Converts a X509-encoded EC key to a PublicKey.
(String stored)
| 411 | * Converts a X509-encoded EC key to a PublicKey. |
| 412 | */ |
| 413 | public static PublicKey toPublicKeyFromX509(String stored) |
| 414 | throws GeneralSecurityException { |
| 415 | KeyFactory factory = KeyFactory.getInstance("EC"); |
| 416 | byte[] data = Base64.decodeBase64(stored); |
| 417 | X509EncodedKeySpec spec = new X509EncodedKeySpec(data); |
| 418 | return factory.generatePublic(spec); |
| 419 | |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Converts an EC PublicKey to an X509-encoded string. |