2015-03-31 19:10:03 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Ken Ellinwood
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2018-04-19 16:18:24 +02:00
|
|
|
|
2015-03-31 19:10:03 +02:00
|
|
|
package kellinwood.security.zipsigner;
|
|
|
|
|
|
|
|
import java.security.PrivateKey;
|
|
|
|
import java.security.cert.X509Certificate;
|
|
|
|
|
|
|
|
public class KeySet {
|
|
|
|
|
|
|
|
String name;
|
2018-04-19 16:18:24 +02:00
|
|
|
|
2015-03-31 19:10:03 +02:00
|
|
|
// certificate
|
|
|
|
X509Certificate publicKey = null;
|
2018-04-19 16:18:24 +02:00
|
|
|
|
2015-03-31 19:10:03 +02:00
|
|
|
// private key
|
2018-04-19 16:18:24 +02:00
|
|
|
PrivateKey privateKey = null;
|
2015-03-31 19:10:03 +02:00
|
|
|
|
|
|
|
// signature block template
|
|
|
|
byte[] sigBlockTemplate = null;
|
|
|
|
|
|
|
|
String signatureAlgorithm = "SHA1withRSA";
|
2018-04-19 16:18:24 +02:00
|
|
|
|
2015-03-31 19:10:03 +02:00
|
|
|
public KeySet() {
|
|
|
|
}
|
2018-04-19 16:18:24 +02:00
|
|
|
|
|
|
|
public KeySet(String name, X509Certificate publicKey, PrivateKey privateKey, byte[] sigBlockTemplate) {
|
2015-03-31 19:10:03 +02:00
|
|
|
this.name = name;
|
|
|
|
this.publicKey = publicKey;
|
|
|
|
this.privateKey = privateKey;
|
|
|
|
this.sigBlockTemplate = sigBlockTemplate;
|
|
|
|
}
|
|
|
|
|
2018-04-19 16:18:24 +02:00
|
|
|
public KeySet(String name, X509Certificate publicKey, PrivateKey privateKey, String signatureAlgorithm, byte[] sigBlockTemplate) {
|
2015-03-31 19:10:03 +02:00
|
|
|
this.name = name;
|
|
|
|
this.publicKey = publicKey;
|
|
|
|
this.privateKey = privateKey;
|
|
|
|
if (signatureAlgorithm != null) this.signatureAlgorithm = signatureAlgorithm;
|
|
|
|
this.sigBlockTemplate = sigBlockTemplate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public X509Certificate getPublicKey() {
|
|
|
|
return publicKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPublicKey(X509Certificate publicKey) {
|
|
|
|
this.publicKey = publicKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
public PrivateKey getPrivateKey() {
|
|
|
|
return privateKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPrivateKey(PrivateKey privateKey) {
|
|
|
|
this.privateKey = privateKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
public byte[] getSigBlockTemplate() {
|
|
|
|
return sigBlockTemplate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSigBlockTemplate(byte[] sigBlockTemplate) {
|
|
|
|
this.sigBlockTemplate = sigBlockTemplate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSignatureAlgorithm() {
|
|
|
|
return signatureAlgorithm;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSignatureAlgorithm(String signatureAlgorithm) {
|
|
|
|
if (signatureAlgorithm == null) signatureAlgorithm = "SHA1withRSA";
|
|
|
|
else this.signatureAlgorithm = signatureAlgorithm;
|
|
|
|
}
|
|
|
|
}
|