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

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

Best Java code snippets using org.cryptacular.util.KeyPairUtil.readPrivateKey (Showing top 6 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 an encoded private key from a file at the given path. Both PKCS#8 and OpenSSL "traditional" formats are
 * supported in DER or PEM encoding. See {@link #decodePrivateKey(byte[])} for supported asymmetric algorithms.
 *
 * @param  path  Path to private key file.
 *
 * @return  Private key.
 *
 * @throws  EncodingException  on key encoding errors.
 * @throws  StreamException  on IO errors reading data from file.
 */
public static PrivateKey readPrivateKey(final String path) throws EncodingException, StreamException
{
 return readPrivateKey(new File(path));
}
origin: net.shibboleth.ext/spring-extensions

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

/**
 * Reads an encrypted private key from a file at the given path. Both PKCS#8 and OpenSSL "traditional" formats are
 * supported in DER or PEM encoding. See {@link #decodePrivateKey(byte[])} for supported asymmetric algorithms.
 *
 * @param  path  Path to private key file.
 * @param  password  Password used to encrypt private key.
 *
 * @return  Private key.
 *
 * @throws  EncodingException  on key encoding errors.
 * @throws  StreamException  on IO errors.
 */
public static PrivateKey readPrivateKey(final String path, final char[] password)
  throws EncodingException, StreamException
{
 return readPrivateKey(new File(path), password);
}
origin: org.cryptacular/cryptacular

/**
 * Reads an encoded private key from a file. Both PKCS#8 and OpenSSL "traditional" formats are supported in DER or PEM
 * encoding. See {@link #decodePrivateKey(byte[])} for supported asymmetric algorithms.
 *
 * @param  file  Private key file.
 *
 * @return  Private key.
 *
 * @throws  EncodingException  on key encoding errors.
 * @throws  StreamException  on IO errors reading data from file.
 */
public static PrivateKey readPrivateKey(final File file) throws EncodingException, StreamException
{
 try {
  return readPrivateKey(new FileInputStream(file));
 } catch (FileNotFoundException e) {
  throw new StreamException("File not found: " + file);
 }
}
origin: org.cryptacular/cryptacular

 @Override
 public PrivateKey newInstance() throws EncodingException, StreamException
 {
  try {
   if (password != null) {
    return KeyPairUtil.readPrivateKey(resource.getInputStream(), password.toCharArray());
   }
   return KeyPairUtil.readPrivateKey(resource.getInputStream());
  } catch (IOException e) {
   throw new StreamException(e);
  }
 }
}
origin: org.cryptacular/cryptacular

/**
 * Reads an encrypted private key from a file. Both PKCS#8 and OpenSSL "traditional" formats are supported in DER or
 * PEM encoding. See {@link #decodePrivateKey(byte[])} for supported asymmetric algorithms.
 *
 * @param  file  Private key file.
 * @param  password  Password used to encrypt private key.
 *
 * @return  Private key.
 *
 * @throws  EncodingException  on key encoding errors.
 * @throws  StreamException  on IO errors.
 */
public static PrivateKey readPrivateKey(final File file, final char[] password)
 throws EncodingException, StreamException
{
 try {
  return readPrivateKey(new FileInputStream(file), password);
 } catch (FileNotFoundException e) {
  throw new StreamException("File not found: " + file);
 }
}
org.cryptacular.utilKeyPairUtilreadPrivateKey

Javadoc

Reads an encoded private key from a file. Both PKCS#8 and OpenSSL "traditional" formats are supported in DER or PEM encoding. See #decodePrivateKey(byte[]) for supported asymmetric algorithms.

Popular methods of KeyPairUtil

  • readPublicKey
    Reads a DER or PEM-encoded public key from a file.
  • 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
  • isKeyPair
    Determines whether the given RSA public and private keys form a proper key pair by computing and ver

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSharedPreferences (Context)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Collectors (java.util.stream)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JTable (javax.swing)
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