diff --git a/cli/Commands/OAuth2/Keys.php b/cli/Commands/OAuth2/Keys.php
index 8274dbc7b4831f1953ef2fae86224bc72e55f530..609ac4e6b5ae072f5e14610f76f8341ed8a56aa0 100644
--- a/cli/Commands/OAuth2/Keys.php
+++ b/cli/Commands/OAuth2/Keys.php
@@ -47,8 +47,8 @@ class Keys extends Command
         $this->storeKeyContentsToFile($encryptionKey, $this->generateEncryptionKey());
 
         $keys = RSA::createKey(4096);
-        $this->storeKeyContentsToFile($publicKey, $keys['publickey']);
-        $this->storeKeyContentsToFile($privateKey, $keys['privatekey']);
+        $this->storeKeyContentsToFile($publicKey, $keys->getPublicKey()->toString('PKCS1'));
+        $this->storeKeyContentsToFile($privateKey, $keys->toString('PKCS1'));
 
         $io->info('Schlüsseldateien erfolgreich angelegt.');