List of usage examples for java.security KeyRep.Type toString
public String toString()
From source file:it.scoppelletti.programmerpower.security.spi.EncodedKeyFactory.java
@Override protected KeySpec getKeySpec(String alg, KeyRep.Type keyType, Properties props, String prefix) { String name, value;/*from w w w. jav a2 s.co m*/ byte[] data; KeySpec keySpec; name = Strings.concat(prefix, EncodedKeyFactory.PROP_DATA); value = props.getProperty(name); if (Strings.isNullOrEmpty(value)) { throw new ArgumentNullException(name); } data = Base64.decodeBase64(value); switch (keyType) { case PUBLIC: keySpec = new X509EncodedKeySpec(data); break; case PRIVATE: keySpec = new PKCS8EncodedKeySpec(data); break; default: throw new EnumConstantNotPresentException(KeyRep.Type.class, keyType.toString()); } return keySpec; }