View Javadoc
1   package civitas.crypto.rsaprivatekey;
2   
3   import java.security.spec.PKCS8EncodedKeySpec;
4   import java.util.Arrays;
5   
6   import org.mockito.ArgumentMatcher;
7   
8   public class KeySpecMatcherPrivate implements ArgumentMatcher<PKCS8EncodedKeySpec> {
9   	private final PKCS8EncodedKeySpec spec;
10  
11  	public KeySpecMatcherPrivate(final PKCS8EncodedKeySpec keyspecPrivate) {
12  		this.spec = keyspecPrivate;
13  	}
14  
15  	@Override
16  	public boolean matches(final PKCS8EncodedKeySpec argument) {
17  		if (null == argument) {
18  			return null == spec;
19  		}
20  		return Arrays.equals(spec.getEncoded(), argument.getEncoded());
21  	}
22  }