Codota Logo
KeyPairUtil.readPublicKey
Code IndexAdd Codota to your IDE (free)

How to use
readPublicKey
method
in
org.cryptacular.util.KeyPairUtil

Best Java code snippets using org.cryptacular.util.KeyPairUtil.readPublicKey (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: org.cryptacular/cryptacular

/**
 * Reads a DER or PEM-encoded public key from a file.
 *
 * @param  path  Path to DER or PEM-encoded public key file.
 *
 * @return  Public key.
 *
 * @throws  EncodingException  on key encoding errors.
 * @throws  StreamException  on IO errors.
 */
public static PublicKey readPublicKey(final String path) throws EncodingException, StreamException
{
 return readPublicKey(new File(path));
}
origin: net.shibboleth.ext/spring-extensions

/** {@inheritDoc} */
@Override public PublicKey getObject() throws Exception {
  if (key == null) {
    if (resource == null) {
      throw new BeanCreationException("Public key resource must be provided in order to use this factory.");
    }
    try (InputStream is = resource.getInputStream()) {
      key = KeyPairUtil.readPublicKey(is);
    }
  }
  return key;
}
origin: org.cryptacular/cryptacular

/**
 * Reads a DER or PEM-encoded public key from a file.
 *
 * @param  file  DER or PEM-encoded public key file.
 *
 * @return  Public key.
 *
 * @throws  EncodingException  on key encoding errors.
 * @throws  StreamException  on IO errors.
 */
public static PublicKey readPublicKey(final File file) throws EncodingException, StreamException
{
 try {
  return readPublicKey(new FileInputStream(file));
 } catch (FileNotFoundException e) {
  throw new StreamException("File not found: " + file);
 }
}
origin: org.cryptacular/cryptacular

 @Override
 public PublicKey newInstance() throws EncodingException, StreamException
 {
  try {
   return KeyPairUtil.readPublicKey(resource.getInputStream());
  } catch (IOException e) {
   throw new StreamException(e);
  }
 }
}
origin: net.shibboleth.idp/idp-profile-spring

/** {@inheritDoc} */
@Override @Nullable protected PublicKey getPublicKey() {
  if (null == getPublicKeyInfo()) {
    return null;
  }
  try (InputStream is = getPublicKeyInfo().getInputStream()) {
    return KeyPairUtil.readPublicKey(is);
  } catch (final IOException e) {
    log.error("{}: Could not decode public key", getConfigDescription(), e);
    throw new FatalBeanException("Could not decode public key", e);
  }
}
origin: net.shibboleth.idp/idp-profile-spring

/**
 * Get the configured certificates.
 * 
 * @return the certificates null
 */
@Nullable @NonnullElements protected List<Credential> getCredentials() {
  
  final List<Credential> credentials = new ArrayList<>(keyResources.size() + certificateResources.size());
  for (final Resource f : keyResources) {
    try(final InputStream is = f.getInputStream()) {
      credentials.add(new BasicCredential(KeyPairUtil.readPublicKey(is)));
    } catch (final EncodingException|StreamException|IOException e) {
      log.error("Could not decode public key from {}", f.getDescription(), e);
      throw new FatalBeanException("Could not decode public key from: " + f.getDescription(), e);
    }
  }
      
  for (final Resource f : certificateResources) {
    try(final InputStream is = f.getInputStream()) {
      final Collection<X509Certificate> raw = X509Support.decodeCertificates(is);
      for (final X509Certificate x : Collections2.filter(raw, Predicates.notNull())) {
        credentials.add(new BasicX509Credential(x));
      }
    } catch (final CertificateException | IOException e) {
      log.error("Could not decode certificate from {}", f.getDescription(), e);
      throw new FatalBeanException("Could not decode certificate from: " + f.getDescription(), e);
    }
  }
  return credentials;
}
origin: net.shibboleth.idp/idp-profile-spring

  credentials.add(new BasicCredential(KeyPairUtil.readPublicKey(is)));
} catch (final EncodingException|StreamException|IOException e) {
  log.error("Could not decode public key from {}", f.getDescription(), e);
org.cryptacular.utilKeyPairUtilreadPublicKey

Javadoc

Reads a DER or PEM-encoded public key from a file.

Popular methods of KeyPairUtil

  • decodePrivateKey
    Decodes an encrypted private key. The following formats are supported: * DER or PEM encoded PKCS#
  • decodePublicKey
    Decodes public keys formatted in an X.509 SubjectPublicKeyInfo structure in either PEM or DER encodi
  • readPrivateKey
    Reads an encrypted private key from a file at the given path. Both PKCS#8 and OpenSSL "traditional"
  • isKeyPair
    Determines whether the given RSA public and private keys form a proper key pair by computing and ver

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • ImageIO (javax.imageio)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now