<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">

    <ol class="breadcrumb">
        <li><a href="#/realms/{{realm.realm}}/clients">{{:: 'clients' | translate}}</a></li>
        <li>{{client.clientId}}</li>
    </ol>

    <kc-tabs-client></kc-tabs-client>

    <form class="form-horizontal" name="keyForm" novalidate kc-read-only="!client.access.configure">
        <fieldset>
            <legend collapsed><span class="text">{{:: 'import-keys-and-cert' | translate}}</span> <kc-tooltip>{{:: 'import-keys-and-cert.tooltip' | translate}}</kc-tooltip></legend>
            <div class="form-group">
                <label class="col-md-2 control-label" for="uploadKeyFormat">{{:: 'archive-format' | translate}}</label>
                <div class="col-sm-6">
                    <div>
                        <select class="form-control" id="uploadKeyFormat"
                                ng-model="uploadKeyFormat"
                                ng-options="f for f in keyFormats">
                        </select>
                    </div>
                </div>
                <kc-tooltip>{{:: 'archive-format.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="uploadKeyAlias">{{:: 'key-alias' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" type="text" id="uploadKeyAlias" name="uploadKeyAlias" data-ng-model="uploadKeyAlias" autofocus required>
                </div>
                <kc-tooltip>{{:: 'key-alias.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="uploadKeyPas">{{:: 'key-password' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" kc-password id="uploadKeyPas" name="uploadKeyPassword" data-ng-model="uploadKeyPassword" autofocus required>
                </div>
                <kc-tooltip>{{:: 'key-password.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="uploadStorePas">{{:: 'store-password' | translate}}</label>
                <div class="col-md-6">
                    <input class="form-control" kc-password id="uploadStorePas" name="uploadStorePas" data-ng-model="uploadStorePassword" autofocus required>
                </div>
                <kc-tooltip>{{:: 'store-password.tooltip' | translate}}</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">{{:: 'upload-keys' | translate}} </label>
                <div class="col-md-6">
                    <div class="controls kc-button-input-file" data-ng-show="!files || files.length == 0">
                        <a href="#" class="btn btn-default"><span class="kc-icon-upload">Icon: Upload</span>{{:: 'choose-a-file.placeholder' | translate}}</a>
                        <input id="import-file" type="file" class="transparent" ng-file-select="onFileSelect($files)">
                    </div>
                    <span class="kc-uploaded-file" data-ng-show="files.length > 0">
                        {{files[0].name}}
                    </span>
                </div>
            </div>
            <div class="pull-right form-actions" data-ng-show="files.length > 0">
                <button type="submit" data-ng-click="clearFileSelect()" class="btn btn-lg btn-default">{{:: 'cancel' | translate}}</button>
                <button type="submit" data-ng-click="uploadFile()" class="btn btn-lg btn-primary">{{:: 'upload' | translate}}</button>
            </div>
        </fieldset>
        <fieldset class="form-group col-sm-10" data-ng-hide="!keyInfo.privateKey">
            <legend collapsed><span class="text">{{:: 'download-keys-and-cert' | translate}}</span>  <kc-tooltip>Client key pair, cert, and realm certificate will be stuffed into a PKCS12 or Java keystore that you can use in your clients.</kc-tooltip></legend>
            <div class="form-group">
                <label class="col-md-2 control-label" for="downloadKeyFormat">{{:: 'archive-format' | translate}}</label>
                <div class="col-sm-6">
                    <div>
                        <select class="form-control" id="downloadKeyFormat"
                                ng-model="jks.format"
                                ng-options="f for f in keyFormats">
                        </select>
                    </div>
                </div>
                <kc-tooltip>Java keystore or PKCS12 archive format.</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="keyAlias">Key Alias</label>
                <div class="col-md-6">
                    <input class="form-control" type="text" id="keyAlias" name="keyAlias" data-ng-model="jks.keyAlias" autofocus required>
                </div>
                <kc-tooltip>Archive alias for your private key and certificate.</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="keyPas">Key Password</label>
                <div class="col-md-6">
                    <input class="form-control" kc-password id="keyPas" name="keyPas" data-ng-model="jks.keyPassword" autofocus required>
                </div>
                <kc-tooltip>Password to access the private key in the archive</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="realmAlias">Realm Certificate Alias</label>
                <div class="col-md-6">
                    <input class="form-control" type="text" id="realmAlias" name="realmAlias" data-ng-model="jks.realmAlias" autofocus required>
                </div>
                <kc-tooltip>Realm certificate is stored in archive too.  This is the alias to it.</kc-tooltip>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label" for="storePas">Store Password</label>
                <div class="col-md-6">
                    <input class="form-control" kc-password id="storePas" name="storePas" data-ng-model="jks.storePassword" autofocus required>
                </div>
                <kc-tooltip>Password to access the archive itself</kc-tooltip>
           </div>
            <div class="form-group" data-ng-show="access.manageRealm">
                <div class="pull-right">
                    <button class="btn btn-primary" type="submit" data-ng-click="downloadJKS()">Download</button>
                </div>
            </div>
        </fieldset>
        <fieldset class="form-group col-sm-10">
            <legend><span class="text">Keys and Certificate</span>  <kc-tooltip>Keys and cert in PEM format.</kc-tooltip></legend>
            <div class="form-group" data-ng-hide="!keyInfo.privateKey">
                <label class="col-md-2 control-label" for="publicKey">Private key</label>

                <div class="col-sm-10">
                    <textarea type="text" id="Private" name="publicKey" class="form-control" rows="5"
                              kc-select-action="click" readonly>{{keyInfo.privateKey}}</textarea>
                </div>
            </div>
            <div class="form-group" data-ng-hide="!keyInfo.privateKey">
                <label class="col-md-2 control-label" for="publicKey">Public key</label>

                <div class="col-sm-10">
                    <textarea type="text" id="publicKey" name="publicKey" class="form-control" rows="5"
                              kc-select-action="click" readonly>{{keyInfo.publicKey}}</textarea>
                </div>
            </div>
            <div class="form-group" data-ng-hide="!keyInfo.privateKey">
                <label class="col-md-2 control-label" for="publicKey">Certificate</label>

                <div class="col-sm-10">
                    <textarea type="text" id="certificate" name="certificate" class="form-control" rows="5"
                              kc-select-action="click" readonly>{{keyInfo.certificate}}</textarea>
                </div>
            </div>
            <div class="form-group" data-ng-show="client.access.configure">
                <div class="pull-right">
                    <button class="btn btn-primary" type="submit" data-ng-click="generate()">Generate new keys</button>
                </div>
            </div>
        </fieldset>
    </form>
</div>

<kc-menu></kc-menu>