Codota Logo
PemKey.<init>
Code IndexAdd Codota to your IDE (free)

How to use
de.mhus.lib.core.crypt.pem.PemKey
constructor

Best Java code snippets using de.mhus.lib.core.crypt.pem.PemKey.<init> (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: de.mhus.osgi/mhu-osgi-crypt-api

@Override
public PemPriv getPrivateKey(String privId) throws MException {
  PemBlock key = keys.get(privId);
  if (key == null) return null;
  return new PemKey( key );
}
origin: de.mhus.osgi/mhu-osgi-crypt-api

@Override
public PemPub getPublicKey(String pubId) {
  PemBlock key = keys.get(pubId);
  if (key == null) return null;
  return new PemKey( key );
}
origin: de.mhus.lib/mhu-lib-core

public static PemKey toKey(String key) throws ParseException {
  return new PemKey(new PemBlockModel().parse(key));
}
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.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);
  }

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.osgi/mhu-osgi-crypt-bc

  privBytes = Blowfish.encrypt(privBytes, passphrase);
PemKey xpub  = new PemKey(PemBlock.BLOCK_PUB , pub.getEncoded(), false  )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.IDENT, pubId)
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
origin: de.mhus.osgi/mhu-osgi-crypt-bc

  privBytes = Blowfish.encrypt(privBytes, passphrase);
PemKey xpub  = new PemKey(PemBlock.BLOCK_PUB , pub.getEncoded(), false  )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.IDENT, pubId)
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
origin: de.mhus.osgi/mhu-osgi-crypt-bc

  privBytes = Blowfish.encrypt(privBytes, passphrase);
PemKey xpub  = new PemKey(PemBlock.BLOCK_PUB , pub.getEncoded(), false  )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.IDENT, pubId)
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
origin: de.mhus.osgi/mhu-osgi-crypt-bc

  privBytes = Blowfish.encrypt(privBytes, passphrase);
PemKey xpub  = new PemKey(PemBlock.BLOCK_PUB , pub.getEncoded(), false  )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.IDENT, pubId)
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
origin: de.mhus.osgi/mhu-osgi-crypt-bc

  privBytes = Blowfish.encrypt(privBytes, passphrase);
PemKey xpub  = new PemKey(PemBlock.BLOCK_PUB , pub.getEncoded(), false  )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set(PemBlock.LENGTH, len)
origin: de.mhus.osgi/mhu-osgi-crypt-bc

  privBytes = Blowfish.encrypt(privBytes, passphrase);
PemKey xpub  = new PemKey(PemBlock.BLOCK_PUB , pub.getEncoded(), false  )
    .set(PemBlock.METHOD, getName())
    .set("StdName", stdName)
    .set(PemBlock.IDENT, pubId)
    .set(PemBlock.PRIV_ID, privId);
PemKey xpriv = new PemKey(PemBlock.BLOCK_PRIV, privBytes, true )
    .set(PemBlock.METHOD, getName())
    .set("StdName", stdName)
de.mhus.lib.core.crypt.pemPemKey<init>

Popular methods of PemKey

  • set
  • entrySet
  • getBlock
  • getEncodedBlock
  • getName
  • getString
  • put

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • setContentView (Activity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ImageIO (javax.imageio)
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