Package net.suberic.crypto

Examples of net.suberic.crypto.EncryptionKeyManager


 
  /**
   * Adds the private key to the store.
   */
  public void addPrivateKey(String alias, Key privateKey, char[] passphrase, String type) throws GeneralSecurityException {
    EncryptionKeyManager currentMgr = getKeyMgr(type);
    if (currentMgr != null) {
      currentMgr.setPrivateKeyEntry(alias, privateKey, passphrase);
    } else {
      throw new KeyStoreException(type + " KeyStore not initialized.");
    }
  }
View Full Code Here


   * Adds the public key to the store.
   */
  public void addPublicKey(String alias, Key publicKey, String type)
  throws GeneralSecurityException {
   
    EncryptionKeyManager currentMgr = getKeyMgr(type);
    if (currentMgr != null) {
      currentMgr.setPublicKeyEntry(alias, publicKey);
    } else {
      throw new KeyStoreException(type + " KeyStore not initialized.");
    }
  }
View Full Code Here

  public Key getPublicKey(String alias, String type)
  throws java.security.KeyStoreException,
         java.security.NoSuchAlgorithmException,
         java.security.UnrecoverableKeyException
  {
    EncryptionKeyManager keymanager;
    if(EncryptionManager.PGP.equalsIgnoreCase(type)){
     keymanager = pgpKeyMgr;
    } else if(EncryptionManager.SMIME.equalsIgnoreCase(type)){
     keymanager = smimeKeyMgr;
    } else{
      return null;
    }
   
      try {
       return keymanager.getPublicKey(alias);
      } catch (KeyStoreException kse) {
        return null;
      }
  }
View Full Code Here

TOP

Related Classes of net.suberic.crypto.EncryptionKeyManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.