private JwkKeys loadPlainPublicKey(String stringContent) { return JwkKeys.builder() .addKey(JwkRSA.builder() .publicKey((RSAPublicKey) KeyConfig.pemBuilder() .publicKey(Resource.create("public key from PKCS8", stringContent)) .build() .publicKey() .orElseThrow(() -> new DeploymentException( "Failed to load public key from string content"))) .build()) .build(); }
/** * Updated this builder instance from configuration. * Keys configured will override existing fields in this builder, others will be left intact. * If certification path is already defined, configuration based cert-path will be added. * * @param config configuration to update this builder from * @return updated builder instance */ public Builder config(Config config) { updateWith(pemBuilder().config(config)); updateWith(keystoreBuilder().config(config)); return this; } }
/** * Build this instance from PEM files (usually a pair of private key and certificate chain). * Call {@link PemBuilder#build()} to build the instance. * If you need to add additional information to {@link KeyConfig}, use {@link PemBuilder#toFullBuilder()}. * * @return builder for PEM files */ public static PemBuilder pemBuilder() { return new PemBuilder(); }
private JwkKeys loadPlainPublicKey(String stringContent) { return JwkKeys.builder() .addKey(JwkRSA.builder() .publicKey((RSAPublicKey) KeyConfig.pemBuilder() .publicKey(Resource.create("public key from PKCS8", stringContent)) .build() .publicKey() .orElseThrow(() -> new DeploymentException( "Failed to load public key from string content"))) .build()) .build(); }
/** * Get a builder filled from this builder to add additional information (such as public key from certificate etc.). * * @return builder for {@link KeyConfig} */ public Builder toFullBuilder() { return updateBuilder(KeyConfig.fullBuilder()); }
/** * Build {@link KeyConfig} based on information from PEM files only. * * @return new instance configured from this builder */ @Override public KeyConfig build() { return toFullBuilder().build(); }
/** * Updated this builder instance from configuration. * Keys configured will override existing fields in this builder, others will be left intact. * If certification path is already defined, configuration based cert-path will be added. * * @param config configuration to update this builder from * @return updated builder instance */ public Builder config(Config config) { updateWith(pemBuilder().config(config)); updateWith(keystoreBuilder().config(config)); return this; } }
/** * Build this instance from PEM files (usually a pair of private key and certificate chain). * Call {@link PemBuilder#build()} to build the instance. * If you need to add additional information to {@link KeyConfig}, use {@link PemBuilder#toFullBuilder()}. * * @return builder for PEM files */ public static PemBuilder pemBuilder() { return new PemBuilder(); }
/** * Get a builder filled from this builder to add additional information (such as public key from certificate etc.). * * @return builder for {@link KeyConfig} */ public Builder toFullBuilder() { return updateBuilder(KeyConfig.fullBuilder()); }
/** * Build {@link KeyConfig} based on information from PEM files only. * * @return new instance configured from this builder */ @Override public KeyConfig build() { return toFullBuilder().build(); }