001/* 002 * nimbus-jose-jwt 003 * 004 * Copyright 2012-2016, Connect2id Ltd. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.jose.jwk; 019 020 021import java.security.KeyPair; 022import java.security.PrivateKey; 023import java.security.PublicKey; 024 025import com.nimbusds.jose.JOSEException; 026 027 028/** 029 * Asymmetric (pair) JSON Web Key (JWK). 030 * 031 * @author Vladimir Dzhuvinov 032 * @version 2015-12-08 033 */ 034public interface AssymetricJWK { 035 036 037 /** 038 * Returns a Java public key representation of the JWK. 039 * 040 * @return The Java public key. 041 * 042 * @throws JOSEException If conversion failed. 043 */ 044 PublicKey toPublicKey() 045 throws JOSEException; 046 047 048 /** 049 * Returns a Java private key representation of this JWK. 050 * 051 * @return The Java private key, {@code null} if not specified. 052 * 053 * @throws JOSEException If conversion failed. 054 */ 055 PrivateKey toPrivateKey() 056 throws JOSEException; 057 058 059 /** 060 * Returns a Java key pair representation of this JWK. 061 * 062 * @return The Java key pair. The private key will be {@code null} if 063 * not specified. 064 * 065 * @throws JOSEException If conversion failed. 066 */ 067 KeyPair toKeyPair() 068 throws JOSEException; 069}