Tabnine Logo
PemKey.set
Code IndexAdd Tabnine to your IDE (free)

How to use
set
method
in
de.mhus.lib.core.crypt.pem.PemKey

Best Java code snippets using de.mhus.lib.core.crypt.pem.PemKey.set (Showing top 11 results out of 315)

origin: de.mhus.lib/mhu-lib-core

  public static PemPriv cipherPrivFromString(String str) throws ParseException, NotSupportedException, IOException {
    
    if (MValidator.isUUID(str)) {
      MVault vault = MVaultUtil.loadDefault();
      VaultEntry entry = vault.getEntry(UUID.fromString(str));
      PemPriv key = MVaultUtil.adaptTo(entry, PemPriv.class);
      return key;
    }

    if (isPemBlock(str)) {
      PemBlockModel block = new PemBlockModel().parse(str);
//            return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock());
      return new PemKey(block);
    }

    String name = MString.beforeIndex(str, ':').toUpperCase().trim();
    String key = MString.afterIndex(str, ':').trim();
    return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, name).setBlock(key);
  }
  
origin: de.mhus.osgi/mhu-osgi-crypt-bc

    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, pub.getFormat())
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, priv.getFormat())
    .set(PemBlock.PUB_ID, pubId);
if (MString.isSet(passphrase))
  xpriv.set(PemBlock.ENCRYPTED, PemBlock.ENC_BLOWFISH);
origin: de.mhus.osgi/mhu-osgi-crypt-bc

    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, pub.getFormat())
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, priv.getFormat())
  xpriv.set(PemBlock.ENCRYPTED, PemBlock.ENC_BLOWFISH);
privBytes = null;
return new PemKeyPair(xpriv, xpub);
origin: de.mhus.osgi/mhu-osgi-crypt-bc

    .set(PemBlock.METHOD, getName())
    .set("StdName", stdName)
    .set(PemBlock.FORMAT, pub.getFormat())
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set("StdName", stdName)
    .set(PemBlock.FORMAT, priv.getFormat())
  xpriv.set(PemBlock.ENCRYPTED, PemBlock.ENC_BLOWFISH);
privBytes = null;
return new PemKeyPair(xpriv, xpub);
origin: de.mhus.osgi/mhu-osgi-crypt-bc

    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, pub.getFormat())
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, priv.getFormat())
  xpriv.set(PemBlock.ENCRYPTED, PemBlock.ENC_BLOWFISH);
privBytes = null;
return new PemKeyPair(xpriv, xpub);
origin: de.mhus.osgi/mhu-osgi-crypt-bc

    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, pub.getFormat())
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, priv.getFormat())
    .set(PemBlock.PUB_ID, pubId);
if (MString.isSet(passphrase))
  xpriv.set(PemBlock.ENCRYPTED, PemBlock.ENC_BLOWFISH);
origin: de.mhus.osgi/mhu-osgi-crypt-bc

    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, pub.getFormat())
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.FORMAT, priv.getFormat())
  xpriv.set(PemBlock.ENCRYPTED, PemBlock.ENC_BLOWFISH);
privBytes = null;
return new PemKeyPair(xpriv, xpub);
origin: de.mhus.osgi/mhu-osgi-crypt-bc

@Override
public PemPair createKeys(IProperties properties) throws MException {
  int length = properties.getInt(CryptApi.LENGTH, 256);
  length = length / 8 * 8;
  byte[] key = new byte[length/8];
  MRandom random = MApi.lookup(MRandom.class);
  for (int i = 0; i < key.length; i++)
    key[i] = random.getByte();
  
  UUID privId = UUID.randomUUID();
  PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, key, true )
      .set(PemBlock.METHOD, getName())
      .set(PemBlock.LENGTH, length)
      .set(PemBlock.IDENT, privId);
  return new PemKeyPair(xpriv, xpriv);
}
origin: de.mhus.lib/mhu-lib-core

  public static PemPriv signPrivFromString(String str) throws Exception, NotSupportedException, IOException {
    
    if (MValidator.isUUID(str)) {
      MVault vault = MVaultUtil.loadDefault();
      VaultEntry entry = vault.getEntry(UUID.fromString(str));
      PemPriv key = MVaultUtil.adaptTo(entry, PemPriv.class);
      return key;
    }

    if (isPemBlock(str)) {
      PemBlockModel block = new PemBlockModel().parse(str);
//            return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock());
      return new PemKey(block);
    }

    String name = MString.beforeIndex(str, ':');
    String key = MString.afterIndex(str, ':');
    return new PemKey(PemBlock.BLOCK_SIGN).set(PemBlock.METHOD, name).setBlock(key);
  }
  
origin: de.mhus.lib/mhu-lib-core

  public static PemPub signPubFromString(String str) throws NotSupportedException, IOException, ParseException {
    
    if (MValidator.isUUID(str)) {
      MVault vault = MVaultUtil.loadDefault();
      VaultEntry entry = vault.getEntry(UUID.fromString(str));
      PemPub key = MVaultUtil.adaptTo(entry, PemPub.class);
      return key;
    }

    if (isPemBlock(str)) {
      PemBlockModel block = new PemBlockModel().parse(str);
//            return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock());
      return new PemKey(block);
    }

    String name = MString.beforeIndex(str, ':');
    String key = MString.afterIndex(str, ':');
    return new PemKey(PemBlock.BLOCK_SIGN).set(PemBlock.METHOD, name).setBlock(key);
  }

origin: de.mhus.lib/mhu-lib-core

  public static PemPub cipherPubFromString(String str) throws ParseException, NotSupportedException, IOException {
    
    if (MValidator.isUUID(str)) {
      MVault vault = MVaultUtil.loadDefault();
      VaultEntry entry = vault.getEntry(UUID.fromString(str));
      PemPub key = MVaultUtil.adaptTo(entry, PemPub.class);
      return key;
    }

    if (isPemBlock(str)) {
      PemBlockModel block = new PemBlockModel().parse(str);
//            return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, block.getString(PemBlock.METHOD,"")).setBlock(block.getEncodedBlock());
      return new PemKey(block);
    }
    
    String name = MString.beforeIndex(str, ':');
    String key = MString.afterIndex(str, ':');
    return new PemKey(PemBlock.BLOCK_CIPHER).set(PemBlock.METHOD, name).setBlock(key);
  }

de.mhus.lib.core.crypt.pemPemKeyset

Popular methods of PemKey

  • <init>
  • entrySet
  • getBlock
  • getEncodedBlock
  • getName
  • getString
  • put

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Reference (javax.naming)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now