public void storeDeviceTypeCertificate(String path,String secret,String deviceTypeId) throws KeyStoreException {
  char[] secretAsChars=secret.toCharArray();
  Certificate certificate=null;
  Key key=null;
  try {
    KeyStore tempKeyStore=load("PKCS12",path,secretAsChars);
    String alias="1";
    key=tempKeyStore.getKey(alias,secretAsChars);
    certificate=tempKeyStore.getCertificate(alias);
  }
 catch (  KeyStoreException|NoSuchAlgorithmException|UnrecoverableKeyException e) {
    throw new KeyStoreException("Unable to get X.509 certificate from P12 file",e);
  }
  storeCertificate("private",certificate,key);
}

public void storeDeviceTypeCertificate ( String path , String secret , String deviceTypeId ) throws KeyStoreException { char [ ] secretAsChars = secret . toCharArray ( ) ; Certificate certificate = null ; Key key = null ; try { KeyStore tempKeyStore = load ( "PKCS12" , path , secretAsChars ) ; String alias = "1" ; key = tempKeyStore . getKey ( alias , secretAsChars ) ; certificate = tempKeyStore . getCertificate ( alias ) ; } catch ( KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e ) { throw new KeyStoreException ( "Unable to get X.509 certificate from P12 file" , e ) ; } storeCertificate ( "private" , certificate , key ) ; }
decodes the device type p12 certificate and stores x509 in the key store
